Re: [R] computer algebra in R

2023-11-28 Thread Søren Højsgaard via R-help
nt how to transfer this into R. All the best, Konrad __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented,

Re: [R] R emulation of FindRoot in Mathematica

2023-01-19 Thread Søren Højsgaard via R-help
<mailto:R-help@r-project.org> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see <https://stat.ethz.ch/mailman/listinfo/r-help> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide <http://www.R-project.o

[R] Handling dependencies on Bioconductor packages for packages on CRAN

2021-12-04 Thread Søren Højsgaard
Dear all My gRbase package imports the packages from Bioconductor: graph, RBGL and Rgraphviz If these packages are not installed, then gRbase can not be installed. The error message is: ERROR: dependency ‘graph’ is not available for package ‘gRbase’ If I, prior to installation, run

Re: [R] question about the difference of AIC()

2021-05-12 Thread Søren Højsgaard
In the first model, I believe you estimate two parameters: the mean and the variance: > fm <- lm(y ~ 1) > 2*2 - 2 * logLik(fm) 'log Lik.' 40.49275 (df=2) > AIC(fm) [1] 40.49275 A zero mean model: fm0 <- lm(y ~ -1) > 2*1 - 2 * logLik(fm0) 'log Lik.' 39.00611 (df=1) > AIC(fm0) [1] 39.00611

Re: [R] NLSR package newDeriv function

2021-04-14 Thread Søren Højsgaard
One approach is to compute things exact using the caracas package; see below. Best regards Søren > library(caracas) > f <- function(x,y){x+y} > def_sym(x,y,z) > f <- x+y^2+y*z^2 > f [caracas]: 2 2 x + y + y⋅z > > d1 <- der(f, c(x,y,z)) > d2 <- der2(f, c(x,y,z)) > >

[R] Installing bioconduction packages in connection with loading an R package

2020-10-11 Thread Søren Højsgaard
Dear all, My gRbase package imports functionality from the bioconductor packages graph, Rgraphviz and RBGL. To make installation of gRbase easy, I would like to have these bioconductor packages installed in connection with installation of gRbase, but to do so the user must use

[R] Possible bug in optimize (related to naming the arguments)

2020-05-07 Thread Søren Højsgaard
Dear all, I am wondering if there is a minor bug in the optimimize function; please see below: --- > ## example taken from optimize documentation > f <- function (x, a) (x - a)^2 > xmin <- optimize(f, c(0, 1), tol = 0.0001, a = 1/3) > xmin $minimum [1] 0.333 $objective [1] 0 > ## if we

[R] consider running tools::compactPDF(gs_quality = "ebook")

2018-07-08 Thread Søren Højsgaard
Dear all, I run R CMD build --compact-vignettes="both" gRbase and/or R CMD build --compact-vignettes="gs+qpdf" gRbase and in the log from r-devel (on winbuilder) I get * checking sizes of PDF files under 'inst/doc' ... WARNING 'gs+qpdf' made some significant size reductions:

[R] When was the script editor introduced in Rgui for windows?

2018-01-26 Thread Søren Højsgaard
Dear all, Can anyone please tell me when the script editor was introduced in the Rgui on windows? (And/or where to look for a listing of changes throughout history). Best regards Søren __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

[R] Checking whether specific packages (from bioconductor) are installed when loading a package

2015-03-11 Thread Søren Højsgaard
Dear all, My package 'gRbase' uses three packages from Bioconductor and these are not automatically installed when gRbase is installed. My instructions (on the package webpage) to users are therefore to run: source(http://bioconductor.org/biocLite.R;); biocLite(c(graph,RBGL,Rgraphviz)) When

Re: [R] Lme4 Package Help!

2014-11-09 Thread Søren Højsgaard
Actually, I believe that for a brief period (around 2006) lmer did return p-values (chisq-based), but then 2006 is a long time ago... If the question pertains p-values in the usual output of coef( summary( model ) ), I'll just mention that with doBy and pbkrtest you can do linest( model,

Re: [R] Testing general hypotheses on regression coefficients

2014-09-05 Thread Søren Højsgaard
AFAICS you are not testing a linear hypothesis (which is of the form Lb=b0 where L is a matrix and b=(a,B1,B2,B3,B3) is the parameter vector). If, for simplicity, your model is E(y) = a + bx then -a/b is the x-value for which y is zero. When you turn to estimates then u = -a/b is the ratio of

Re: [R] degrees of freedom

2014-01-24 Thread Søren Højsgaard
As a supplement to Bens reply: The pbkrtest package allows calculation of degrees of freedom by the Kenward-Roger method; something like library(lme4) model1 - lmer(value~group + (1|animal), data=bip) summary(model1) anova(model1) model0 - update(model1, .~.-group) anova(model1, model0)

Re: [R] descriptive stats by cells in factorial design

2013-08-03 Thread Søren Højsgaard
The summaryBy function in the doBy package may help you. Regards Søren Sendt fra Samsung mobil Oprindelig meddelelse Fra: Mike Miller mbmille...@gmail.com Dato: Til: R-Help List r-h...@stat.math.ethz.ch Emne: [R] descriptive stats by cells in factorial design I'm looking

[R] Vignettes do not appear on CRAN if files are placed in /vignette subdirectory - but they do appear if placed in /inst/doc

2013-06-30 Thread Søren Højsgaard
Dear all, In my gRbase package there are 3 vignettes placed in the /vignette subdirectory. These vignettes do not appear on http://cran.r-project.org/web/packages/gRbase/index.html and neither do they appear if I open a browser with help(gRbase). However, if instead I place the vignettes in

Re: [R] Vignettes do not appear on CRAN if files are placed in /vignette subdirectory - but they do appear if placed in /inst/doc

2013-06-30 Thread Søren Højsgaard
Sorry, yes it is plural - but changing to plural has no effect. Regards Søren -Original Message- From: Martin Morgan [mailto:mtmor...@fhcrc.org] Sent: 30. juni 2013 23:09 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Vignettes do not appear on CRAN if files

Re: [R] Vignettes do not appear on CRAN if files are placed in /vignette subdirectory - but they do appear if placed in /inst/doc

2013-06-30 Thread Søren Højsgaard
that it works for him. I don't know what to make of this. Regards Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 1. juli 2013 00:45 To: Søren Højsgaard Cc: Martin Morgan; R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Vignettes do not appear

Re: [R] Vignettes do not appear on CRAN if files are placed in /vignette subdirectory - but they do appear if placed in /inst/doc

2013-06-30 Thread Søren Højsgaard
Yes, these packages are all installed. Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 1. juli 2013 01:59 To: Søren Højsgaard Cc: Martin Morgan; R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Vignettes do not appear on CRAN if files are placed

[R] Issue with Imports in NAMESPACE

2013-06-25 Thread Søren Højsgaard
Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Søren Højsgaard
...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have

Re: [R] Issue with Imports in NAMESPACE

2013-06-25 Thread Søren Højsgaard
: Søren Højsgaard; R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On Tue, 25 Jun 2013, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions

[R] Built-in function for extracting mantissa and exponent of a numeric

2013-06-23 Thread Søren Højsgaard
Dear all, Given a number x-1.234e12 is there a built-in function for extracting 1.234 and 12 ? The following hack seems clumpsy: a-strsplit(format(x, scientific=T),e)[[1]] a [1] 1.234 +12 as.numeric(a[1]) [1] 1.234 as.integer(a[2]) [1] 12 Regards Søren

Re: [R] evaluation of equations from Ryacas

2013-06-19 Thread Søren Højsgaard
Dear Erin, Not exactly elegant, but e-expression(list(R == 100 * (1 - 2 * y/1))) ee - e[[1]][2] ee (R == 100 * (1 - 2 * y/1))() eval(parse(text=(substring(paste(ee), 5))), list(y=5)) [1] 99.9 Regards Søren -Original Message- From: r-help-boun...@r-project.org

Re: [R] Ryacas loads but yacas has an error

2013-06-19 Thread Søren Højsgaard
Dear Erin, I don't have solution, but there is a remark on connection issues at http://code.google.com/p/ryacas/ An alternative could be to look at the rSymPy or rmathpiper packages which may do what you want. Regards Søren -Original Message- From: r-help-boun...@r-project.org

[R] Modifying a function programmatically

2013-02-04 Thread Søren Højsgaard
Dear list # I have a function ff - function(a,b=2,c=4){a+b+c} # which I programmatically want to modify to a more specialized function in which a is replaced by 1 ff1 - function(b=2,c=4){1+b+c} # I do as follows: vals - list(a=1) (expr1 - as.expression(body(ff))) expression({ a + b +

Re: [R] Modifying a function programmatically

2013-02-04 Thread Søren Højsgaard
] Sent: 4. februar 2013 11:11 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re: [R] Modifying a function programmatically Hi, Is it what you are looking for? ff - function(a,b,c){a+b+c} ff(1,10,12) [1] 23 ff(589,2,4) [1] 595 HTH, Pascal Le 04/02/2013 19:00, Søren Højsgaard a écrit

Re: [R] Modifying a function programmatically

2013-02-04 Thread Søren Højsgaard
] Sent: 4. februar 2013 17:31 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re: [R] Modifying a function programmatically On Mon, Feb 4, 2013 at 5:00 AM, Søren Højsgaard sor...@math.aau.dk wrote: Dear list # I have a function ff - function(a,b=2,c=4){a+b+c} # which I programmatically

Re: [R] Reading extremly large comma separated files?

2012-12-19 Thread Søren Højsgaard
The sqldf package may be of help to you. Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Öhagen Patrik Sent: 19. december 2012 10:48 To: R hELP Subject: [R] Reading extremly large comma separated files? Dear List,

[R] Dispatching on a dgCMatrix does not work.

2012-12-11 Thread Søren Højsgaard
I represent a graph as an adjacency matrix of class dgCMatrix (from the Matrix package). xx 5 x 5 sparse Matrix of class dgCMatrix a b c d e a . 1 1 . . b 1 . 1 . . c 1 1 . 1 1 d . . 1 . 1 e . . 1 1 . To check if the matrix defines and undirected graph, I have made the following

[R] Having two different versions of a package in the same R installation

2012-10-02 Thread Søren Højsgaard
Dear list, I am making some comparisons of two versions of the lme4 package: The CRAN version and the R-Forge version. For the moment I have two different R installations, each with a different version of lme4. However it would be convenient if I could have the same version within the same R

Re: [R] Having two different versions of a package in the same R installation

2012-10-02 Thread Søren Højsgaard
to a directory called lme4 on the fly. I don't know if it would work, but I just wonder if there would possibly a more elegant way. Regards Søren -Original Message- From: Greg Snow [mailto:538...@gmail.com] Sent: 2. oktober 2012 22:27 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re

[R] eval inside a function call in connection with updating the data slot in the call of lmer

2012-09-17 Thread Søren Højsgaard
Dear list, Given a linear mixed model (from lme4) I want to 1) first change the input dataset and then 2) change the model formula. I want this to happen in a function call; Please see below. Options 1) and 2) below work whereas 3) fails with the message foo() Error in is.data.frame(data) :

Re: [R] Some kind of inverse of names

2012-08-20 Thread Søren Højsgaard
Is this what you want?: li - list(a=1, b=2, c=3, d=4) li $a [1] 1 $b [1] 2 $c [1] 3 $d [1] 4 unlist(li) a b c d 1 2 3 4 unname(unlist(li)) [1] 1 2 3 4 Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Julio

Re: [R] Symbolic computation in R-solving system of equations

2012-08-16 Thread Søren Højsgaard
Ryacas provides an interface to yacas from R. So my suggestion is to search the web to see if yacas can solve your specific problem. Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jpm miao Sent: 16. august 2012

[R] Creating sparse matrix of type dgCMatrix directly

2012-07-28 Thread Søren Højsgaard
I want to create a sparse matrix of type dgCMatrix using the Matrix package (and the matrix must be of this type even if other more compact representations may exist). I do library(Matrix) m1-Matrix(rep(1,4),nrow=2,ncol=2,sparse=T) m1 2 x 2 sparse Matrix of class dsCMatrix [1,] 1 1

Re: [R] Creating sparse matrix of type dgCMatrix directly

2012-07-28 Thread Søren Højsgaard
-Original Message- From: dmba...@gmail.com [mailto:dmba...@gmail.com] On Behalf Of Douglas Bates Sent: 28. juli 2012 20:36 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re: [R] Creating sparse matrix of type dgCMatrix directly On Sat, Jul 28, 2012 at 7:26 AM, Søren Højsgaard sor

Re: [R] Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there faster alternatives?

2012-06-26 Thread Søren Højsgaard
...@gmail.com] Sent: 25. juni 2012 11:27 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re: [R] Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there faster alternatives? On 12-06-24 4:50 PM, Søren Højsgaard wrote: Dear all, Indexing matrices from the Matrix

Re: [R] Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there faster alternatives?

2012-06-26 Thread Søren Højsgaard
::MappedSparseMatrixdouble MSpMat; const MSpMat X(asMSpMat(XX_)); int i = asint(ii_)-1; int j = asint(jj_)-1; double ans = X.coeff(i,j); return(wrap(ans)); ' -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Søren Højsgaard Sent: 27

Re: [R] rgraphviz problem

2012-06-24 Thread Søren Højsgaard
Dear Anton, You may find the description on http://people.math.aau.dk/~sorenh/software/gR/index.html helpful. Regards -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Anton Gerostathos Sent: 24. juni 2012 14:28 To:

Re: [R] rgraphviz problem

2012-06-24 Thread Søren Højsgaard
Perhaps you could try to see if you can get the 32 bit version to work AND you could also report the result of running sessionInfo() in your mail. Regards Søren -Original Message- From: Anton Gerostathos [mailto:antonios.gerostat...@windowslive.com] Sent: 24. juni 2012 18:43 To: Søren

[R] Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there faster alternatives?

2012-06-24 Thread Søren Højsgaard
Dear all, Indexing matrices from the Matrix package with [i,j] seems to be very slow. For example: library(rbenchmark) library(Matrix) mm - matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20) MM - as(mm, Matrix) lookup - function(mat){ for (i in 1:nrow(mat)){ for (j in 1:ncol(mat)){

Re: [R] Help with ordering values

2012-05-19 Thread Søren Højsgaard
Will y[order(match(y,x))] [1] 9 8 11 2 1 do? Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Lars Bishop Sent: 20. maj 2012 01:05 To: r-help@r-project.org Subject: [R] Help with ordering values Hi, Is it

Re: [R] Imputing missing values using LSmeans (i.e., population marginal means) - advice in R?

2012-04-07 Thread Søren Højsgaard
Dear Jenn, Could you please provide a reproducible example. In your case, you could for example provide the data (using dput(dat)). Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jenn Barrett Sent: 6. april 2012

Re: [R] summaryBy: transformed variable on RHS of formula?

2012-04-02 Thread Søren Højsgaard
Sorry, no - you will have to do something like the latter suggestion. Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alexander Shenkin Sent: 2. april 2012 17:59 To: r-help@r-project.org Subject: [R] summaryBy:

Re: [R] expand.grid (the half!)

2012-03-24 Thread Søren Højsgaard
Something like this? x - expand.grid(c(1,2,3),c(1,2,3)) x[x[,2]=x[,1],] Var1 Var2 111 412 522 713 823 933 Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios

Re: [R] Fitting loglinear model with glm() and loglm()

2012-03-20 Thread Søren Højsgaard
Dear Christofer, loglm uses an iterative proportional scaling (IPS) algorithm for fitting a log-linear model to a contingency table. glm uses an iteratively reweighted least squares algorithm. The result from IPS is exact. Regards Søren -Oprindelig meddelelse- Fra:

Re: [R] gee: suppress printout

2012-02-02 Thread Søren Højsgaard
I don't think it can be removed, a message like this has been coming out for several years and there may be a good reason why it is there. Your best bet is probably to approach the package maintainer with a suggestion to alter the code. Regards Søren -Oprindelig meddelelse- Fra:

[R] Calling update on an lm-object inside a function

2012-01-22 Thread Søren Højsgaard
Dear all, I want to update an lm (or glm) object by changing the response variable and I want to do so inside a function. Doing the update outside of a function is straight forward: x - 1:5 y - c(1,2,3,3,6) mm - lm(y~x) y2 - c(1,3,3,4,6) mm2- update(mm, y2 ~ .) But I want to make the

Re: [R] Relationship between covariance and inverse covariance matrices

2011-12-08 Thread Søren Højsgaard
Your question is not all that R-related, but inverse covariance matrices with zero entries corresponds to conditional independence restrictions in the multivaritate normal distribution. Such inverse covariance matrices are key ingredients in graphical Gaussian models (also known as covariance

Re: [R] How do I query ... in a function call?

2011-11-21 Thread Søren Højsgaard
You can do something like this: test - function(x,...){ print(x) args = list(...) if('y' %in% names(args))print(args$y) if('z' %in% names(args))print(args$z) } Regards Søren Fra: r-help-boun...@r-project.org

Re: [R] multicore combn

2011-10-16 Thread Søren Højsgaard
Just thought I'd let you know the following: In the gRbase package there is a function called combnPrim which does the same as combn but it is implemented in C - and is quite a bit faster than combn(). Regards Søren Fra: r-help-boun...@r-project.org

[R] Package snow: is there any way to check if a cluster is acticve

2011-10-12 Thread Søren Højsgaard
Is there a 'proper' way of checking if cluster is active. For example, I create a cluster called .PBcluster str(.PBcluster) List of 4 $ :List of 3 ..$ con :Classes 'sockconn', 'connection' atomic [1:1] 3 .. .. ..- attr(*, conn_id)=externalptr ..$ host: chr localhost ..$ rank: int 1

Re: [R] Can't get installing a package source (.tar.gz) from a web page to work...

2011-09-16 Thread Søren Højsgaard
...@statistik.tu-dortmund.de] Sendt: 15. september 2011 10:47 Til: Søren Højsgaard Cc: r-h...@stat.math.ethz.ch Emne: Re: [R] Can't get installing a package source (.tar.gz) from a web page to work... On 15.09.2011 10:34, Søren Højsgaard wrote: I have created an R-package with datasets which I want my

[R] Can't get installing a package source (.tar.gz) from a web page to work...

2011-09-15 Thread Søren Højsgaard
I have created an R-package with datasets which I want my students to install (the package is not on CRAN). 1) I've put the package on the web in a directory called 'data' and I thought I could do:

Re: [R] installing Rgraphviz

2011-07-21 Thread Søren Højsgaard
Hardly an R question, but a google search with the string change the path variable windows 7 gave quite a few hits, for example http://geekswithblogs.net/renso/archive/2009/10/21/how-to-set-the-windows-path-in-windows-7.aspx Regards Søren Fra:

Re: [R] using stimulate(model) for parametric bootstrapping in lmer repeatabilities

2011-06-08 Thread Søren Højsgaard
Dear Jenni, In the newest version of the doBy package there is a function called PBrefdist (and PBrefdist.mer) for calculating the reference distribution of the likelihood ratio statistic for comparing nested models. Looking into this function may help you. Perhaps the functions PBmodcomp and

Re: [R] problem with makeSOCKcluster depending on R patch version

2011-05-15 Thread Søren Højsgaard
That raises another question: Will that patched version (2011-05-13 r55886) be made available as a windows binary - and if so: when? Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af Uwe Ligges

Re: [R] problem with makeSOCKcluster depending on R patch version

2011-05-15 Thread Søren Højsgaard
Fra: Uwe Ligges [lig...@statistik.tu-dortmund.de] Sendt: 15. maj 2011 15:25 Til: Søren Højsgaard Cc: Ulrich Halekoh; r-help@r-project.org Emne: Re: SV: [R] problem with makeSOCKcluster depending on R patch version On 15.05.2011 12:27, Søren Højsgaard wrote: That raises another question

Re: [R] Problems with Rterm 2.13.0 - but not RGui

2011-05-03 Thread Søren Højsgaard
A safe way out of this mess is to install R somewhere else. For example, create a directory c:\Programs and install R there. Regards Søren -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af Jonathan Daily Sendt: 3. maj 2011

Re: [R] Simulation from discrete uniform

2011-04-08 Thread Søren Højsgaard
?sample -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af cassie jones Sendt: 8. april 2011 03:16 Til: r-help@r-project.org Emne: [R] Simulation from discrete uniform Dear all, I am trying to simulate from discrete uniform

Re: [R] Quasipoisson with geeglm

2011-04-07 Thread Søren Højsgaard
Dear Ivy, In gee there is no quasipossion, because gee is in a way already quasi. With GEE we do not fit a poisson glm, but use in the construction of the sandwich covariance matrix the variance function of the poisson family. In Gee always an 'overdispersion' is estimated. Regards Søren

[R] Assigning a class attribute to a list or vector slows [ down

2011-04-04 Thread Søren Højsgaard
Dear list, I've noticed that if a list or a vector is given a class (by class(x) - something) then the selection operator slows down - quite a bit. For example: lll - as.list(letters) system.time({for(ii in 1:20)lll[-(1:4)]}) user system elapsed 0.480.000.49 class(lll) -

Re: [R] Strange result from sort: sort(c(aa, ff)) gives ff aa with R.2.12.1 on windows 7

2011-02-02 Thread Søren Højsgaard
?? Regards Søren Højsgaard -Oprindelig meddelelse- Fra: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Sendt: 2. februar 2011 13:21 Til: Søren Højsgaard Cc: r-h...@stat.math.ethz.ch Emne: Re: [R] Strange result from sort: sort(c(aa, ff)) gives ff aa with R.2.12.1 on windows 7 'Strange

[R] Strange result from sort: sort(c(aa, ff)) gives ff aa with R.2.12.1 on windows 7

2011-01-24 Thread Søren Højsgaard
Dear list, Please consider the following call of sort sort(c(a,f)) [1] a f sort(c(f,a)) [1] a f sort(c(aa,ff)) [1] ff aa sort(c(ff,aa)) [1] ff aa The last two results look strange to me. Is that a bug??? The result seems to come from calls to order: order(c(a,f)) [1] 1 2 order(c(f,a))

Re: [R] Using summaryBy with weighted data

2011-01-17 Thread Søren Højsgaard
It is currently not possible to pass weights in summaryBy. Regards Søren Fra: Joshua Wiley [jwiley.ps...@gmail.com] Sendt: 17. januar 2011 08:16 Til: Solomon Messing Cc: r-help@r-project.org; Søren Højsgaard Emne: Re: [R] Using summaryBy with weighted

Re: [R] Changing a logical matrix into a numeric matrix

2011-01-10 Thread Søren Højsgaard
Just multiply by 1: m - matrix(c(T,T,F,T),nr=2) m [,1] [,2] [1,] TRUE FALSE [2,] TRUE TRUE m*1 [,1] [,2] [1,]10 [2,]11 -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af emj83 Sendt: 10. januar

Re: [R] Bayesian Belief Networks

2010-12-23 Thread Søren Højsgaard
Probability propragation is provided in the gRain package. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af Michael Bedward [michael.bedw...@gmail.com] Sendt: 24. december 2010 00:01 Til: Data AnalyticsCorp.

[R] Sweave: Setting options with SweaveOpts{} when using driver=RweaveHTML

2010-12-10 Thread Søren Højsgaard
When using Sweave in connection with the driver RweaveLatex(), global options can be set with \SweaveOpts{}, e.g. \SweaveOpts{keep.source=T}. Does anybody know if it is possible to set global options in the same way when using Sweave with the driver RweaveHTML(). Regards Søren

[R] Calling substitute(expr, list(a=1)) when expr - expression(a+b+c)

2010-11-26 Thread Søren Højsgaard
# The result I am after is the result after a substitution in an expression, such as substitute(expression(a+b+c), list(a=1)) expression(1 + b + c) # However, the way I want to do it is for a an expression stored as a variable as (expr - expression(a+b+c)) expression(a + b + c) # a) The

Re: [R] Calling substitute(expr, list(a=1)) when expr - expression(a+b+c)

2010-11-26 Thread Søren Højsgaard
in a simpler way? Regards Søren -Oprindelig meddelelse- Fra: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sendt: 26. november 2010 14:39 Til: Søren Højsgaard Cc: r-h...@stat.math.ethz.ch Emne: Re: [R] Calling substitute(expr, list(a=1)) when expr - expression(a+b+c) On Fri, Nov 26, 2010

[R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col)

2010-11-16 Thread Søren Højsgaard
When using odfWeave on an OpenOffice input document, I can not open the output document. I get the message Format error discovered in the file in sub-document content.xml at 2,4047 (row,col) Can anyone help me on this? (Apologies if this has been discussed before; I have not been able to find

Re: [R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col)

2010-11-16 Thread Søren Højsgaard
: Søren Højsgaard; r-h...@stat.math.ethz.ch Emne: RE: [R] odfWeave - Format error discovered in the file in sub-document content.xml at 2, 4047 (row, col) From: soren.hojsga...@agrsci.dk To: r-h...@stat.math.ethz.ch Date: Tue, 16 Nov 2010 11:32:06 +0100

Re: [R] how to view the top 20 lines in a long dataset

2010-11-01 Thread Søren Højsgaard
See ?head Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af Louis Plough [lplo...@usc.edu] Sendt: 1. november 2010 20:40 Til: r-help@r-project.org Emne: [R] how to view the top 20 lines in a long dataset Hi,

Re: [R] GEE with user-specified link function

2010-10-12 Thread Søren Højsgaard
For geepack there are no facilities for user defined link functions. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af Kun Liu [victo...@hotmail.co.uk] Sendt: 12. oktober 2010 11:50 Til: r-help@r-project.org

[R] Extracting elements from list: Is [[ always faster than $ ??

2010-09-08 Thread Søren Højsgaard
Dear list It seems to me that extracting elements from a list using '[[' is somewhat faster than using '$'. For example: x- as.list(1:25) names(x) - letters[1:length(x)] dput(x) structure(list(a = 1L, b = 2L, c = 3L, d = 4L, e = 5L, f = 6L, g = 7L, h = 8L, i = 9L, j = 10L, k =

Re: [R] transformation of data.frame

2010-07-08 Thread Søren Højsgaard
Like this? library(doBy) (ddd - read.table(foo.txt,header=T)) ID gen 1 42787 gen2 2 16070 gen2 3 16070 gen3 4 7409 Gen1 5 7409 gen3 6 6511 gen2 7 6417 gen3 8 16070 gen4 9 6511 gen4 aa-lapplyBy(~ID, data=ddd, + FUN=function(uu){ + list(uu$ID[1], paste(uu$gen, collapse=:)) + })

Re: [R] Generalised Estimating Equations on approx normal outcome with limited range

2010-06-24 Thread Søren Højsgaard
Hi, 1) There is no feature in geeglm for that sort of truncation of the outcome. 2) It is generally fragile - and not recommendable - to use corstr=unstructured in geeglm. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org]

Re: [R] More efficient alternative to combn()?

2010-03-27 Thread Søren Højsgaard
Perhaps slightly off topic but there is a faster alternative to combn() called combnPrim() in the gRbase package: library(gRbase) system.time({for (ii in 1:1) combn(1:6,3)}) user system elapsed 4.020.004.02 system.time({for (ii in 1:1) combnPrim(1:6,3)}) user

Re: [R] Creating named lists

2010-03-12 Thread Søren Højsgaard
Rune, I doubt that this is possible because R-objects will typically not know their own name. Med venlig hilsen / Regards Søren Højsgaard -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af Rune Schjellerup Philosof Sendt: 12

Re: [R] identical() mystery

2010-03-01 Thread Søren Højsgaard
It might have to do with the storage.mode(): reference - c(11, 14, 16, 5, 4, 2, 0, 15, 9, 0) storage.mode(reference) [1] double cpgDensity - as.integer(reference) storage.mode(cpgDensity) [1] integer identical(reference,cpgDensity) [1] FALSE regards Søren

Re: [R] summary statistics for grouped data

2010-02-12 Thread Søren Højsgaard
You might find the summaryBy function in the doBy package useful. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af jose romero [jlauren...@yahoo.com] Sendt: 12. februar 2010 18:23 Til: r-help@r-project.org

Re: [R] R very large files

2009-12-16 Thread Søren Højsgaard
The sqldf package may be of help to you. Regards Søren -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af Albert-Jan Roskam Sendt: 16. december 2009 11:59 Til: r-help@r-project.org Emne: [R] R very large files Hi,   I very

Re: [R] different fits for geese and geeglm in geepack?

2009-11-26 Thread Søren Højsgaard
It looks strange. If you send me data for a small reproducible example then I'll look into the issue. Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org] P#229; vegne af Achaz von Hardenberg [achaz.hardenb...@gmail.com] Sendt:

[R] Define lm/glm object without evaluating them

2009-11-17 Thread Søren Højsgaard
For e.g. lm/glm type models I would like to separate model specification and model fitting and then only fit the models later 'when data arrives'. To be specific, I would like make a specification like m1 - lm(rate~conc) m2 - lm(rate~I(conc^2)) and then later I want to 'put data into' the

[R] Defining S3-methods for S4-objects: cannot coerce type 'S4' to vector of type 'integer'

2009-10-19 Thread Søren Højsgaard
that such issues must have come up for others in the past but I've been unable to find questions/answers in the archives. Sorry if the topic has already been covered. Regards Søren Højsgaard [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] array slice notation?

2009-08-05 Thread Søren Højsgaard
you generalize this to select multiple rows eg with indexes given by a vector 'v'? Søren Højsgaard wrote: You can do A - HairEyeColor do.call([, c(list(A),list(1,T,T))) Sex Eye Male Female Brown 32 36 Blue11 9 Hazel 10 5 Green3 2

Re: [R] array slice notation?

2009-08-04 Thread Søren Højsgaard
You can do A - HairEyeColor do.call([, c(list(A),list(1,T,T))) Sex Eye Male Female Brown 32 36 Blue11 9 Hazel 10 5 Green3 2 Regards Søren Fra: r-help-boun...@r-project.org [r-help-boun...@r-project.org]

Re: [R] How to comment in R

2009-02-11 Thread Søren Højsgaard
: on 11-02-2009 10:54 Til: thierry.onkel...@inbo.be; Søren Højsgaard; r-help@r-project.org Emne: AW: [R] How to comment in R Still doesn't work. I did Format -- Block -- Comment and chose /* for begin comment, */ for end comment but R doesn't recognize the signs as such. Maybe I should work

Re: [R] faster version of split()?

2009-01-16 Thread Søren Højsgaard
Hi, R version 2.2.1 is slightly old. You may want to upgrade to the current version, R.2.8.1!!! You can for example do library(doBy) dd - data.frame(x=c(1,1,1,2,2,2), y=c(1,1,2, 1,1,1)) summaryBy(y~x, data=dd, FUN=function(x)length(unique(x))) Regards Søren -Oprindelig meddelelse-

Re: [R] summary with variance / sd

2009-01-11 Thread Søren Højsgaard
You can use summaryBy() in the doBy package: summaryBy(y+x~group, data=mydata, FUN=c(mean,sd)) Søren Fra: r-help-boun...@r-project.org på vegne af Jörg Groß Sendt: sø 11-01-2009 22:38 Til: r-help@r-project.org Emne: [R] summary with variance / sd Hi, I

Re: [R] Memory Efficiency of Symmetric Matrix

2009-01-06 Thread Søren Højsgaard
You can do mat[lower.tri(mat, diag=F)] Søren Fra: r-help-boun...@r-project.org på vegne af Nathan S. Watson-Haigh Sendt: on 07-01-2009 01:28 Til: r-help@r-project.org Emne: [R] Memory Efficiency of Symmetric Matrix -BEGIN PGP SIGNED MESSAGE- Hash:

Re: [R] Summary information by groups programming assitance

2008-12-22 Thread Søren Højsgaard
Maybe summaryBy (or lapplyBy/splitBy) in the doBy package might help you. Regards Søren Fra: r-help-boun...@r-project.org på vegne af Ranney, Steven Sendt: ma 22-12-2008 22:51 Til: r-help@r-project.org Emne: [R] Summary information by groups programming assitance

[R] Rcmd build problem: gcc.exe no input files (R.2.8.0 on Win XP)

2008-12-02 Thread Søren Højsgaard
Building a package using R.2.8.0 on Windows XP gives problems when compiling C code: Trying to run 'rcmd build' on R.2.8.0 on Windows XP gives ... -- Making package gRbase adding build stamp to DESCRIPTION making DLL ... gcc -std=gnu99 -Ic:/Programs/R/current/include

[R] Rcmd install problem: cannot open the connection and No such file or directory

2008-11-17 Thread Søren Højsgaard
Dear all, On Windows XP with R 2.8.0, I get the error message below when I try install a package from the command line. (Installing as a local zip-file from the menu in the GUI works fine.) Could anybody point me towards the source (and solution) to the problem? Regards Søren

Re: [R] Exact test in nxm contingency table

2008-09-17 Thread Søren Højsgaard
Using r2dtable() you can simulate general tables nxm with given margins. Based on these you acn calculate a Monte Carlo p-value for a conditional test for independence. Regards Søren -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Magnus

[R] Extracting eg A[, , 3, 1, ] from an array but using dimension names and levels

2008-08-20 Thread Søren Højsgaard
Consider the extraction HairEyeColor[,3,1] Black Brown Red Blond 1025 7 5 Suppose I have the appropriate dimensions and levels given as variables, e.g. d1 -2 l1 -3 d2 -3 l2 -1 How can I then make the extraction above using d1, l1, d2, l2 (for an array of arbitrary

Re: [R] Exponential smoothing?

2008-08-19 Thread Søren Højsgaard
Try ?HoltWinters and ?filter Regards Søren -Oprindelig meddelelse- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Öhagen Patrik Sendt: 19. august 2008 10:00 Til: R hELP Emne: [R] Exponential smoothing? Dear List, I have used all my resources (i.e. help.search) and I

[R] How to build a package which loads Rgraphviz (if installed)...

2008-07-12 Thread Søren Højsgaard
Dear List, I use Rgraphviz for display of graphs in some packages. Since Rgraphviz is no longer on CRAN it needs to be installed from Bioconductor and that is fine, but I have trouble figureing out the following: I create a plot method which - if Rgraphviz is installed - uses Rgraphviz for

Re: [R] How to build a package which loads Rgraphviz (if installed)...

2008-07-12 Thread Søren Højsgaard
are stuck with the same problem??? Cheers Søren Fra: William Revelle [mailto:[EMAIL PROTECTED] Sendt: lø 12-07-2008 23:47 Til: Søren Højsgaard; [EMAIL PROTECTED] Emne: Re: [R] How to build a package which loads Rgraphviz (if installed)... Soren, When I had

Re: [R] How to build a package which loads Rgraphviz (if installed)...

2008-07-12 Thread Søren Højsgaard
:[EMAIL PROTECTED] Sendt: sø 13-07-2008 00:36 Til: Søren Højsgaard Cc: William Revelle; [EMAIL PROTECTED] Emne: Re: [R] How to build a package which loads Rgraphviz (if installed)... On 12/07/2008 6:27 PM, Søren Højsgaard wrote: Bill, Thanks for the suggestion, but it does not solve the problem; I

  1   2   >