[R] Does file.info man page describe ctime corrrectly?
(R 2.8.0 on Debian GNU/Linux sid) ?file.info contains: mtime, ctime, atime: integer of class 'POSIXct': file modification, creation and last access times. This implies that ctime is file [...] creation [...] time Has R implemented ctime differently to Unix? I understand, on Linux at least, that ctime is the last change time (not the creation time). See man ls which says: -c [...] ctime (time of last modification of file status information) [...] However, testing seems to indicate file.info is returning the change time, not creation time (I'm not sure we can actually determine creation time of a file on Linux). Perhaps just a file.info documentation slip? Regards, Graham __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] I need course in R
I am interested to take a course in R. Someone know of some course in europe for the first semester of the next year?. Happy Year Thank you, Xavier [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] I need course in R
xavier ordoñez wrote: I am interested to take a course in R. Someone know of some course in europe for the first semester of the next year?. Yes, some, but hard to suggest commercial companies or universities and certain courses, because it depends on so many facts: - the languages you understand - the European regions that are fine for you to travel to - the level and kind of R stuff you expect in the course (basics, applications in a certain field, or just programming) - your a priori knowledge about statistics Best wishes, Uwe Ligges Happy Year Thank you, Xavier [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] can a function alter the ... argument and passed the result to another function?
Dan Kelley wrote: Is there a way a function ('parent', say) can manipulate the ... argument, and then pass the manipulated value into another function ('child', say) that it calls? What I'm trying to do is to use some plotting defaults within 'parent' that are not part of parent's argument list, but to let the use over-ride these defaults if they choose. A sketch is below. parent - function(stuff, ...) { dots - list(...) if (!type in names(list)) dots$type='p' plot(stuff, unlist(dots)) # or alist()? or what? } do.call() is your friend here, because you can easily pass a *list* of arguments to the function when calling it: parent - function(stuff, ...) { dots - list(...) if (!type %in% names(list)) dots$type - 'l' do.call(plot, c(list(x=stuff), dots)) } Best, Uwe Ligges I know, I can just make type be a formal argument of 'parent', and I'm happy to do that, but I'm still in the learning stages with R, and so I'm trying to become more familiar with as much R syntax as I can, even if I end up doing things differently later on. D. Kelley Oceanography Department, Dalhousie University Halifax, Nova Scotia, Canada __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] I need course in R
R is not as daunting as it first seems and you might get by without having to get formal training. Speaking as someone who taught themselves to use R for statistics, graphics and data manipulation, I found that the Introduction to R book (the small yellow one) and the numerous pdfs available online are fantastic and walk you through the very basics (the one by Emanuel Paradis is excellent). So, as long as you can read and understand English there are alot of free resources out there (maybe there are some of these already translated to other languages, I dont know). It is a steep learning curve, but once you get to grips with the basics, I've found that I can find out everything else I need to know by searching these archives... Hope this helps, Simon Pickett. - Original Message - From: Uwe Ligges lig...@statistik.tu-dortmund.de To: xavier ordoñez rlistxa...@gmail.com Cc: R help r-h...@stat.math.ethz.ch Sent: Friday, December 19, 2008 10:24 AM Subject: Re: [R] I need course in R xavier ordoñez wrote: I am interested to take a course in R. Someone know of some course in europe for the first semester of the next year?. Yes, some, but hard to suggest commercial companies or universities and certain courses, because it depends on so many facts: - the languages you understand - the European regions that are fine for you to travel to - the level and kind of R stuff you expect in the course (basics, applications in a certain field, or just programming) - your a priori knowledge about statistics Best wishes, Uwe Ligges Happy Year Thank you, Xavier [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Predict
Ricardo L Gómez rgomezye at educ.umass.edu writes: lm(formula = outcom ~ vari1 + vari2 + dummy1 + dummy2) .. but now, using this model, I need to calculate the predicted value of OUTCOM (only for one observation) , when vari1=8 and vari 2 =64, and also the confidence interval(the data set has total of 24 observations), There is an example in predict.lm that does exactly what you need. Dieter __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] Akaike weight in R
Hi folks, Wondering how can I generate Akaike weight with R? I know the description, but is there any function to generate by R on the web-site or R library? I am using GLM or GLMM (family=binomial), so would be appreciated if you help me. Thanks for your contributions in advance, Regards, Odette [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Akaike weight in R
Odette Wondering how can I generate Akaike weight with R? I know the description, but is there any function to generate by R on the web-site or R library? I am using GLM or GLMM (family=binomial), so would be appreciated if you help me. You could have a look at this. http://bm2.genes.nig.ac.jp/RGM2/R_current/library/aod/man/summary.aic.html Which is in the OAD package Graham __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Akaike weight in R
I'm pretty sure you have to work it out yourself. Here is an example of how you would tabulate the AIC weights from three models (check that my calculations are correct before using this yourself!). Basically model.name$aic will cut out the AIC values then write a formula to calculate the weights... m1-glm(trantot~unimpgrass+impgrass,family=poisson,data=bbs[bbs$species==unique(bbs$species)[1],]) m2-glm(trantot~marginwidth,family=poisson,data=bbs[bbs$species==unique(bbs$species)[1],]) m3-glm(trantot~impgrass,family=poisson,data=bbs[bbs$species==unique(bbs$species)[1],]) aics-data.frame(paste(m,1:3,sep=),c(m1$aic,m2$aic,m3$aic),row.names=NULL) colnames(aics)-c(model,AIC) aics-aics[order(-aics$AIC),] for(i in 1:dim(aics)[1]){ aics$diff[i]-aics$AIC[1]-aics$AIC[i]} aics$wi-2.71828182845904523536^(-0.5*aics$diff) aics$aic.weights-aics$wi/sum(aics$wi) - Original Message - From: Odette Gaston odette.gas...@gmail.com To: r-help@r-project.org Sent: Friday, December 19, 2008 11:26 AM Subject: [R] Akaike weight in R Hi folks, Wondering how can I generate Akaike weight with R? I know the description, but is there any function to generate by R on the web-site or R library? I am using GLM or GLMM (family=binomial), so would be appreciated if you help me. Thanks for your contributions in advance, Regards, Odette [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] parm argument in confint.multinom () nnet package
Dear R users, The nnet package includes the multinom method for the confint function. The R Help file (?confint) for the generic function in the stats package and the help files for the glm and nls methods in the MASS package indicate that one can use the parm argument as a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered. Although the confint.multinom() function in the nnet package accepts the parm argument, it doesn't appear to offer this functionality if there are more than two response categories. Since this method isn't documented, maybe I shouldn't expect it to, but there seems to be a simple solution. Compare: library(MASS) example(birthwt) (bwt.mu - multinom(low ~ ., bwt)) confint(bwt.mu,age) with (bwt.mu2 - multinom(race ~ ., bwt)) confint(bwt.mu2,age) It looks like John Fox has something going on R-Forge regarding another version of the confint.multinom() function (http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/utilities.R?rev=2root=rcmdr http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/utilities.R?rev=2root=rcmdr). However, with a few minor changes, the function in the nnet package could work as I had expected it to: confint.mult-function (object, parm, level = 0.95, ...) { cf - coef(object) pnames - if (is.matrix(cf)) colnames(cf) else names(cf) if (missing(parm)) parm - seq_along(pnames) else if (is.character(parm)) parm - match(parm, pnames, nomatch = 0) a - (1 - level)/2 a - c(a, 1 - a) pct - paste(round(100 * a, 1), %) fac - qnorm(a) if (is.matrix(cf)) { ## Ensure that ses and cf remain matrices after parameter selection. ## Otherwise they may turn into numeric vectors. ses - matrix(sqrt(diag(vcov(object))), ncol = ncol(cf), byrow = TRUE)[, parm, drop = FALSE] cf - cf[, parm, drop = FALSE] ## Move step to create ci to after redefinition of cf. ci - array(NA, dim = c(dim(cf), 2), dimnames = c(dimnames(cf), list(pct))) ci[, , 1] - cf + ses * fac[1] ci[, , 2] - cf + ses * fac[2] aperm(ci, c(2, 3, 1)) } else { ci - array(NA, dim = c(length(parm), 2), dimnames = list(pnames[parm], pct)) ses - sqrt(diag(vcov(object)))[parm] ci[] - cf[parm] + ses %o% fac ci } } confint.mult(bwt.mu2,age) Would it be possible to update the code in the nnet package? Or have I missed a point somewhere? Kind regards, -Ben Barnes Doctoral Student Research Group Environmental Epidemiology German Cancer Research Center [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] obtaining output from an evaluated expression
Hi I am trying to use the deriv and eval functions to obtain the value of a function , say xi-(alpha0+alpha1*gi) , differentiated with respect to alpha0 and alpha1, in the following way # for gi = 0 dU1dtheta - deriv(~ xi-(alpha0+alpha1*gi), c(alpha0,alpha1)) eval(dU1dtheta) (Intercept) -0.2547153 attr(,gradient) alpha0 alpha1 [1,] -1 0 I want to extract the output gradient values of -1 and 0 but I don't know how to access them. The only thing I can access is the intercept term via. eval(dU1dtheta)[1]. I'm sorry if this is too basic a question for the list, but any help would be greatly appreciated Jack -- Dr Jack Bowden MRC Biostatistics Unit Institute of Public Health Forvie Site Robinson Way Cambridge CB2 0SR Tel: (01223) 330385 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] I need course in R
You can also try the R for SAS and SPSS users at http://rforsasandspssusers.com/ in case you are an existing user of analytics software...its quite user friendly. Regards, Ajay www.decisionstats.com Douglas MacArthur - We are not retreating - we are advancing in another direction. On Fri, Dec 19, 2008 at 4:20 PM, Simon Pickett simon.pick...@bto.orgwrote: R is not as daunting as it first seems and you might get by without having to get formal training. Speaking as someone who taught themselves to use R for statistics, graphics and data manipulation, I found that the Introduction to R book (the small yellow one) and the numerous pdfs available online are fantastic and walk you through the very basics (the one by Emanuel Paradis is excellent). So, as long as you can read and understand English there are alot of free resources out there (maybe there are some of these already translated to other languages, I dont know). It is a steep learning curve, but once you get to grips with the basics, I've found that I can find out everything else I need to know by searching these archives... Hope this helps, Simon Pickett. - Original Message - From: Uwe Ligges lig...@statistik.tu-dortmund.de To: xavier ordoñez rlistxa...@gmail.com Cc: R help r-h...@stat.math.ethz.ch Sent: Friday, December 19, 2008 10:24 AM Subject: Re: [R] I need course in R xavier ordoñez wrote: I am interested to take a course in R. Someone know of some course in europe for the first semester of the next year?. Yes, some, but hard to suggest commercial companies or universities and certain courses, because it depends on so many facts: - the languages you understand - the European regions that are fine for you to travel to - the level and kind of R stuff you expect in the course (basics, applications in a certain field, or just programming) - your a priori knowledge about statistics Best wishes, Uwe Ligges Happy Year Thank you, Xavier [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] re ad.table
Hi , I want to use the read.table to the following example 'data.txt' format: a b c d e f SPX LSZ 100 C 0 34.4 SPX LSZ 100 P 0 1.3 SPX LSZ 105 C 0 30.3 SPX LSZ 105 P 0 1.85 SPX LSZ 110 C 0 26.4 and I want to have the columns a,b,d read as the 'character' data, a the remaining columns as 'numeric'. What I did was: read.table(data.txt,header=T, colClasses=c(character,character,numeric,character, numeric,numeric), but I could not get what I want, since all values were in the 'character' format. I will apprecaite any suggestions. best, robert -- View this message in context: http://www.nabble.com/read.table-tp21090550p21090550.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] re ad.table
Seems to work for me: x - read.table(textConnection(a b c d e f + SPX LSZ 100 C 0 34.4 + SPX LSZ 100 P 0 1.3 + SPX LSZ 105 C 0 30.3 + SPX LSZ 105 P 0 1.85 + SPX LSZ 110 C 0 26.4), + header=T, colClasses=c(character,character,numeric,character, + numeric,numeric)) x a b c d e f 1 SPX LSZ 100 C 0 34.40 2 SPX LSZ 100 P 0 1.30 3 SPX LSZ 105 C 0 30.30 4 SPX LSZ 105 P 0 1.85 5 SPX LSZ 110 C 0 26.40 str(x) 'data.frame': 5 obs. of 6 variables: $ a: chr SPX SPX SPX SPX ... $ b: chr LSZ LSZ LSZ LSZ ... $ c: num 100 100 105 105 110 $ d: chr C P C P ... $ e: num 0 0 0 0 0 $ f: num 34.4 1.3 30.3 1.85 26.4 sessionInfo() R version 2.8.0 (2008-10-20) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats grDevices utils datasets graphics methods base other attached packages: [1] MASS_7.2-44 On Fri, Dec 19, 2008 at 7:35 AM, threshold r.kozar...@gmail.com wrote: Hi , I want to use the read.table to the following example 'data.txt' format: a b c d e f SPX LSZ 100 C 0 34.4 SPX LSZ 100 P 0 1.3 SPX LSZ 105 C 0 30.3 SPX LSZ 105 P 0 1.85 SPX LSZ 110 C 0 26.4 and I want to have the columns a,b,d read as the 'character' data, a the remaining columns as 'numeric'. What I did was: read.table(data.txt,header=T, colClasses=c(character,character,numeric,character, numeric,numeric), but I could not get what I want, since all values were in the 'character' format. I will apprecaite any suggestions. best, robert -- View this message in context: http://www.nabble.com/read.table-tp21090550p21090550.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] svyglm and sandwich estimator of variance
Hi, I would like to estimate coefficients using poisson regression and then get standard errors that are adjusted for heteroskedasticity, using a complex sample survey data. Then I will calculate prevalence ratio and confidence intervals. Can sandwich estimator of variance be used when observations arent independent? In my case, observations are independent across groups (clusters), but not necessarily within groups. Can I calculate the standard errors with robust variance, in complex sample survey data using R? Outputs: design_tarv-svydesign(ids=~X2, strata=~X3, data=banco, weights=~X4) banco.glm7 - svyglm(y ~x1, data = banco, family = poisson (link= log), design= design_tarv) summary(banco.glm7) Call: svyglm(y ~ x1, data = banco, family = poisson(link = log), design = design_tarv) Survey design: svydesign(ids = ~X2, strata = ~X3, data = banco, weights = ~X4) Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -0.918930.04696 -19.570 2e-16 *** x1 0.197100.06568 3.001 0.00603 ** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 (Dispersion parameter for poisson family taken to be 0.5722583) Number of Fisher Scoring iterations: 5 library(sandwich) vcovHC(banco.glm7) (Intercept)x1 (Intercept) 4.806945e-13 -4.771409e-13 x1 -4.771409e-137.127168e-13 sqrt(diag(vcovHC(banco.glm7, type=HC0))) (Intercept) x1 6.923295e-078.426314e-07 # I think this result isnt correct, because standard errors are so small. Thank you for the help, Roberta Niquini. -- ENSP - Fiocruz __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] re ad.table
probably best just to change each variable one by one to the correct classification after you have read the data frame in. variable-as.character(variable) - Original Message - From: threshold r.kozar...@gmail.com To: r-help@r-project.org Sent: Friday, December 19, 2008 12:35 PM Subject: [R] re ad.table Hi , I want to use the read.table to the following example 'data.txt' format: a b c d e f SPX LSZ 100 C 0 34.4 SPX LSZ 100 P 0 1.3 SPX LSZ 105 C 0 30.3 SPX LSZ 105 P 0 1.85 SPX LSZ 110 C 0 26.4 and I want to have the columns a,b,d read as the 'character' data, a the remaining columns as 'numeric'. What I did was: read.table(data.txt,header=T, colClasses=c(character,character,numeric,character, numeric,numeric), but I could not get what I want, since all values were in the 'character' format. I will apprecaite any suggestions. best, robert -- View this message in context: http://www.nabble.com/read.table-tp21090550p21090550.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Akaike weight in R
Try AICtab in the bbmle package - Original Message - From: Odette Gaston odette.gas...@gmail.com To: r-help@r-project.org Sent: Friday, December 19, 2008 11:26 AM Subject: [R] Akaike weight in R Hi folks, Wondering how can I generate Akaike weight with R? I know the description, but is there any function to generate by R on the web-site or R library? I am using GLM or GLMM (family=binomial), so would be appreciated if you help me. Thanks for your contributions in advance, -- View this message in context: http://www.nabble.com/Akaike-weight-in-R-tp21089767p21091392.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] autologistic modelling in R
Charlotte Bell charlotte.bell at sheffield.ac.uk writes: Hi, I have spatially autocorrelated data (with a binary response variable and continuous predictor variables). I believe I need to do an autologistic model, does anyone know a method for doing this in R? There are several approaches that you could try. One direct spatial approach is the off-CRAN Rcitrus package: http://www.leg.ufpr.br/Rcitrus/ which although the documentation is in Portuguese, should get you most of the way there. You could also look at geoRglm on CRAN, which handles a similar setting in a geostatistical way. You may also find it helpful to look at the handling of spatial autocorrelation in the nlme package in a GLMM context, using the CorSpatial approach. If you like, you could also look at a GAMM approach in mgcv. The glmmBUGS package can be used for preparing a GLMM for running in *BUGS if the spatial autocorrelation is expressed through a spatial weights matrix rather than as a function of distance. Hope this helps, Roger Bivand. PS. RSiteSearch on autologistic does find: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/147538.html which is a posting by Elias Krainski on R-sig-geo, where a further link is given for a forthcoming stLattice package. Many thanks C Bell __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] obtaining output from an evaluated expression
Jack Bowden jack.bowden at mrc-bsu.cam.ac.uk writes: dU1dtheta - deriv(~ xi-(alpha0+alpha1*gi), c(alpha0,alpha1)) eval(dU1dtheta) (Intercept) -0.2547153 attr(,gradient) alpha0 alpha1 [1,] -1 0 I want to extract the output gradient values of -1 and 0 but I don't know how to access them. The only thing I can access is the intercept term via. eval(dU1dtheta)[1]. It probably easiest to ask for a function to be returned using function.arg, as the example in deriv shows. Having been bitten by deriv in the past, I prefer to use it to give me the function or expression, and paste it explicitly into my code, doing some sanity check first. It's not very general, but tells you better what is happening. Dieter ## function with defaulted arguments: (fx - deriv(y ~ b0 + b1 * 2^(-x/th), c(b0, b1, th), function(b0, b1, th, x = 1:7){} ) ) fx(2,3,4) attr(fx(2,3,4),gradient) __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] diagonal lines in legends of ggplot2
Hi, I have the following problem with ggplot2: When I specify black contours for bars in a barplot, ggplot automatically shows diagonal lines in the legend boxes. Is there a way, to remove these diagonal lines? Here's a simple example: library(ggplot2) df-data.frame(x=gl(6,1),y=rnorm(6,100,50)) ggplot(df,aes(y=y,x=x,fill=x))+geom_bar(aes(group=x),colour='black',size=1)+ scale_fill_brewer(palette='Greys') Thanks for your help! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] obtaining output from an evaluated expression
On Fri, 19 Dec 2008, Dieter Menne wrote: Jack Bowden jack.bowden at mrc-bsu.cam.ac.uk writes: dU1dtheta - deriv(~ xi-(alpha0+alpha1*gi), c(alpha0,alpha1)) eval(dU1dtheta) (Intercept) -0.2547153 attr(,gradient) alpha0 alpha1 [1,] -1 0 I want to extract the output gradient values of -1 and 0 but I don't know how to access them. The only thing I can access is the intercept term via. eval(dU1dtheta)[1]. It probably easiest to ask for a function to be returned using function.arg, as the example in deriv shows. Having been bitten by deriv in the past, I prefer to use it to give me the function or expression, and paste it explicitly into my code, doing some sanity check first. It's not very general, but tells you better what is happening. But he is stil going to need to learn about attr(): attr(eval(dU1dtheta)[1], gradient) does the job (I presume, we don't have all the data in this message, nor I think in the previous one although you inexplicably silently removed the line that said gi = 0). Dieter ## function with defaulted arguments: (fx - deriv(y ~ b0 + b1 * 2^(-x/th), c(b0, b1, th), function(b0, b1, th, x = 1:7){} ) ) fx(2,3,4) attr(fx(2,3,4),gradient) -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] diagonal lines in legends of ggplot2
Hi Erich, Can you explain why you don't want them? The philosophy behind the legend code is to attempt to match the appearance of the geoms in the plot as closely as possible. There are a few exceptions, like this diagonal line, where the legends are slightly different to make it easier to see certain features of the geom (in this case edge colour and size) Regards, Hadley On Fri, Dec 19, 2008 at 8:42 AM, Erich Studerus erich.stude...@bli.uzh.ch wrote: Hi, I have the following problem with ggplot2: When I specify black contours for bars in a barplot, ggplot automatically shows diagonal lines in the legend boxes. Is there a way, to remove these diagonal lines? Here's a simple example: library(ggplot2) df-data.frame(x=gl(6,1),y=rnorm(6,100,50)) ggplot(df,aes(y=y,x=x,fill=x))+geom_bar(aes(group=x),colour='black',size=1)+ scale_fill_brewer(palette='Greys') Thanks for your help! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. -- http://had.co.nz/ __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] newbie question on snow/Rmpi
Does anyone know if these errors can be safely ignored? [linuxsvr.kls.corp:16242] mca: base: component_find: unable to open osc pt2pt: file not found (ignored) this is on RHEL5 w/ openMPI 1.2.7 -Whit On Mon, Dec 15, 2008 at 6:31 PM, Dirk Eddelbuettel e...@debian.org wrote: On Mon, Dec 15, 2008 at 01:16:46PM -0500, Whit Armstrong wrote: I have a network of four machines set up. I'm having trouble spawning my slaves on these machines. All the examples I have found so far use makeCluster with type=MPI, and I guess I'm missing some kind of cluster configuration in my environment variables because all my clusters are formed on the machine where my initial session is running. Can anyone refer me to a link that illustrates how to set up the environment for MPI (listing node names, number of slots, etc) that will allow the makeCluster command take advantage of the other nodes? It depends on which MPI library you use. I like Open MPI. Thanks, Whit simple example: library(Rmpi) library(snow) cl - makeCluster(2, type = MPI) You must call R (or r or Rscript) 'inside' orterun (or mpirun) which allows you to set hostnames on that invocation. See my UseR 2008 tutorial for some examples. Dirk -- Three out of two people have difficulties with fractions. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] understanding lexical scope
Thomas, Jeff, Mark, Antonio, Thank you for your answers. They have helped me clarify how R functions work. They work differently from SAS functions (which SAS calls macros.) If you know SAS, consider the following code: * %macro q(y); data one; outvar = y. + x.; output; call symputx(outvar, outvar, G); run; %mend; %macro w(x); %q(x.); %put outvar.; %mend; ** Then %w(2); will result in the value 4 being placed in the SAS log. To me, while the coding is quite awkward, the execution is logical. The variable x has been defined by the call to the macro w, so there is no problem when SAS encounters a reference to x in the macro q. But in the equivalent code in R, q - function(y) y +x; w - function(x) q(x); w(2); when R can't find the second argument of q in the local environment of the macro q, it doesn't look in the local environment of the macro w, it goes all the way back to the global environment, as you have all pointed out. So in my little model of how R functions work, when a function is called 1. R rewrites the body of the function, replacing all of the parameter names with the values given to them in the function call. 2. R then tries to execute the expressions. But R only remembers the assignment of values to parameter names during step 1. Thus in our example it has to go the global environment to find a value for x referenced in q. Is this right? Joe Boyer Statistical Sciences Renaissance Bldg 510, 3233-D Mail Stop RN0320 8-275-3661 cell: (610) 209-8531 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] I need course in R
yes I did, sorry. obviously good for stats rather than general code but still good bed time reading :-) Simon. - Original Message - From: June Kim junea...@gmail.com To: Simon Pickett simon.pick...@bto.org Sent: Friday, December 19, 2008 3:28 PM Subject: Re: [R] I need course in R On Fri, Dec 19, 2008 at 7:50 PM, Simon Pickett simon.pick...@bto.org wrote: R is not as daunting as it first seems and you might get by without having to get formal training. Speaking as someone who taught themselves to use R for statistics, graphics and data manipulation, I found that the Introduction to R book (the small yellow one) and the numerous pdfs available online are fantastic and walk I can't find a book named Introduction to R whose cover is yellow. You must be talking about Dalgaard's. http://www.amazon.com/Introductory-Statistics-R-Computing/dp/0387790535 you through the very basics (the one by Emanuel Paradis is excellent). So, as long as you can read and understand English there are alot of free resources out there (maybe there are some of these already translated to other languages, I dont know). It is a steep learning curve, but once you get to grips with the basics, I've found that I can find out everything else I need to know by searching these archives... Hope this helps, Simon Pickett. - Original Message - From: Uwe Ligges lig...@statistik.tu-dortmund.de To: xavier ordoñez rlistxa...@gmail.com Cc: R help r-h...@stat.math.ethz.ch Sent: Friday, December 19, 2008 10:24 AM Subject: Re: [R] I need course in R xavier ordoñez wrote: I am interested to take a course in R. Someone know of some course in europe for the first semester of the next year?. Yes, some, but hard to suggest commercial companies or universities and certain courses, because it depends on so many facts: - the languages you understand - the European regions that are fine for you to travel to - the level and kind of R stuff you expect in the course (basics, applications in a certain field, or just programming) - your a priori knowledge about statistics Best wishes, Uwe Ligges Happy Year Thank you, Xavier [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] specify formula for nonliear mxed model equation
How can I specify formula using nlme to estimate y=exp(X'B)/(1+exp(X'B)) ? Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237) 22040246 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] Plot multiple lines, same plot, different axes?
The plotrix package does this (). However, maybe only for lines. The code below will plot as many graphs of different types one on another, and it contains a plot with a different axis. The graphs are self scaling for y axis and date axis. I have included background code for setting up date data, + the table used for graphing. (It looks much more intelligible in Tinn-R.) names(survis) [1] Province District SubDistrict Village Date Activity StatusRapidTestDone AnigenResult [10] HPAICompEvent class(survis$Date) [1] POSIXt POSIXct #SET UP DATA survis2-survis #rename fields #Return date as month number survismth-as.numeric(format(survis2$Date, %m)) #set up axis labels date.bins - seq(from = min(survis2$Date), format = %d/%m/%y, to = max(survis2$Date), format = %d/%m/%y, by = 1 month) date.lab - as.character(date.bins, format = %b-%y) print(join6) mthvis0 1 testsdone anigenpos testpercr 4 954 819 135 135 105 11.01 52090 1929 161 161 114 5.45 62723 2545 178 178 126 4.63 72600 2460 140 14093 3.58 82580 2392 188 188 106 4.11 92415 2240 175 175 104 4.31 10 2354 2263 919142 1.78 11 1595 1526 696936 2.26 #GRAPH THE RESULTS par(las=2) mthlgth-max(survismth)-min(survismth)+1 plotvis-barplot(join6[,mthvis],col=grey90,main=Visit numbers, test numbers and HPAI detection rates\n - ALL PROVINCES,font.main=4,ylab=Number of visits,border=grey20,ylim = c(0, max(join6[,mthvis]+20)), space=0, xlim=c(0,mthlgth),names=date.lab) #Second barplot overlying par(new = TRUE) plottests-barplot(join6[,anigenpos],col=dark green,space=0, axes=FALSE, names.arg=, ylim=c(0, max(join6[,mthvis]+20))) #no axes, ylim to align y axis #Create graph with second plot with second axis with different scale, with points centred on barplot columns par(new = TRUE) ; par(las=0) plotperc-plot(join6[,testpercr], type = o, axes = FALSE, bty = n, xlab = , ylab=, col=red,lwd=2,lty=1, xlim=c(0.5,(mthlgth+0.5))) axis(side=4, at = pretty(range(testpercr)), col=red, lwd=2) mtext(HPAI diagnoses per 100 visits, side = 4, line = -1.15, outer = FALSE, at = NA, adj = NA, padj = NA, cex = NA, col = NA, font = NA) savePlot(filename = ALL PROVINCES, type = c(png), device = dev.cur()) Ron Thornton ron.thorn...@fao.org __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Trouble pulling data from a messy ASCII file...
Thanks to all who replied! This is great! I am going to dig into this over the holidays. I will post what I end up with... Thanks again, James Planey Graduate Research Assistant Department of Animal Biology University of Illinois @ Urbana-Champaign -- View this message in context: http://www.nabble.com/Trouble-pulling-data-from-a-messy-ASCII-file...-tp21059239p21093949.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] newbie question on snow/Rmpi
Whit, On 19 December 2008 at 10:17, Whit Armstrong wrote: | Does anyone know if these errors can be safely ignored? | | [linuxsvr.kls.corp:16242] mca: base: component_find: unable to open | osc pt2pt: file not found (ignored) | | this is on RHEL5 w/ openMPI 1.2.7 Yes. Hao (of Rmpi fame) and I also see it on 64-bit Debian and Ubuntu, but not on the 32-bit variants. AFAIK it has something to do with how OMPI uses dlopen and which symbols get across to different library. You can suppress it via $ tail -4 /etc/openmpi/openmpi-mca-params.conf # edd 18 Dec 2008 mca_component_show_load_errors = 0 or using the equivalent switches on the command-line or via an env. var -- see the OMPI docs. You may want to subscribe to r-sig-hpc to ask these types of questions there. Dirk -- Three out of two people have difficulties with fractions. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] newbie question on snow/Rmpi
Thanks, Dirk. I had read your very long conversation on the openMPI list but wasn't sure if there was a resolution. I had overlooked the fact that there is an hpc list, will post there from now on. Cheers, Whit On Fri, Dec 19, 2008 at 11:52 AM, Dirk Eddelbuettel e...@debian.org wrote: Whit, On 19 December 2008 at 10:17, Whit Armstrong wrote: | Does anyone know if these errors can be safely ignored? | | [linuxsvr.kls.corp:16242] mca: base: component_find: unable to open | osc pt2pt: file not found (ignored) | | this is on RHEL5 w/ openMPI 1.2.7 Yes. Hao (of Rmpi fame) and I also see it on 64-bit Debian and Ubuntu, but not on the 32-bit variants. AFAIK it has something to do with how OMPI uses dlopen and which symbols get across to different library. You can suppress it via $ tail -4 /etc/openmpi/openmpi-mca-params.conf # edd 18 Dec 2008 mca_component_show_load_errors = 0 or using the equivalent switches on the command-line or via an env. var -- see the OMPI docs. You may want to subscribe to r-sig-hpc to ask these types of questions there. Dirk -- Three out of two people have difficulties with fractions. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] package install error in CentOS
I am trying to install package Cairo on CentOS 5.2, but I keep getting this error: * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' The downloaded packages are in /tmp/Rtmp8ML568/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Cairo) : installation of package 'Cairo' had non-zero exit status I tried to do it manually but with no luck: [jer...@138 shizzle]$ sudo R CMD INSTALL Cairo_1.4-4.tar.gz * Installing to library '/usr/lib64/R/library' * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' I have tried to changing the $TMPDIR to another dir, and giving it 777 permissions, but I keep getting the error. Some info: sessionInfo() R version 2.8.0 (2008-10-20) x86_64-redhat-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base [jer...@138 shizzle]$ gcc --version gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- View this message in context: http://www.nabble.com/package-install-error-in-CentOS-tp21094790p21094790.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] package install error in CentOS
Check that your data partitions have the 'exec' flag set in /etc/fstab, particulary the /tmp partition: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=1687forum=31 Jeff Jeroen Ooms wrote: I am trying to install package Cairo on CentOS 5.2, but I keep getting this error: * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' The downloaded packages are in /tmp/Rtmp8ML568/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Cairo) : installation of package 'Cairo' had non-zero exit status I tried to do it manually but with no luck: [jer...@138 shizzle]$ sudo R CMD INSTALL Cairo_1.4-4.tar.gz * Installing to library '/usr/lib64/R/library' * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' I have tried to changing the $TMPDIR to another dir, and giving it 777 permissions, but I keep getting the error. Some info: sessionInfo() R version 2.8.0 (2008-10-20) x86_64-redhat-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base [jer...@138 shizzle]$ gcc --version gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] understanding lexical scope
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of joseph.g.bo...@gsk.com Sent: Friday, December 19, 2008 7:41 AM To: Thomas Lumley Cc: r-help@r-project.org Subject: Re: [R] understanding lexical scope Thomas, Jeff, Mark, Antonio, Thank you for your answers. They have helped me clarify how R functions work. They work differently from SAS functions (which SAS calls macros.) Well, SAS macros are not functions in the traditional sense. The SAS macro language for the most part just does text substitution prior to the SAS code being sent to the SAS compiler/interpreter. So, your description of rewriting the function body in step 1. below, is fairly accurate for SAS macro, but it is not accurate for R. If you try to fit R functions into a SAS macro language mold you will only confuse yourself on both accounts. I will leave the technical details of R functions to the R experts. If you know SAS, consider the following code: * %macro q(y); data one; outvar = y. + x.; output; call symputx(outvar, outvar, G); run; %mend; %macro w(x); %q(x.); %put outvar.; %mend; ** Then %w(2); will result in the value 4 being placed in the SAS log. To me, while the coding is quite awkward, the execution is logical. The variable x has been defined by the call to the macro w, so there is no problem when SAS encounters a reference to x in the macro q. But in the equivalent code in R, q - function(y) y +x; w - function(x) q(x); w(2); when R can't find the second argument of q in the local environment of the macro q, it doesn't look in the local environment of the macro w, it goes If you want to try to compare the R language to SAS language (not favorable to SAS for most on this list), the better comparison for understanding is the data step language, not SAS macro. all the way back to the global environment, as you have all pointed out. So in my little model of how R functions work, when a function is called 1. R rewrites the body of the function, replacing all of the parameter names with the values given to them in the function call. 2. R then tries to execute the expressions. But R only remembers the assignment of values to parameter names during step 1. Thus in our example it has to go the global environment to find a value for x referenced in q. Is this right? I bet one of the expeRts on the list will provide you with more detail than could have ever hoped for. Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] How to write a Surv object to a csv-file?
Dear All, trying to write a data.frame, containing Surv objects to a csv-file I get Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent. See example below. May be, I overlooked something, but I expected that also data.frames containing Surv objects may be written to csv files. Is there a better way to write to csv files? Thanks, Heinz Tüchler ### write Surv-object in csv-file library(survival) ## create example data soa - Surv(1:5, c(0, 0, 1, 0, 1)) df.soa - data.frame(soa) write.csv(df.soa, 'df.soa.csv')## works as I expected read.csv('df.soa.csv') ## works as I expected df.soa2 - data.frame(soa, soa2=soa) write.csv(df.soa2, 'df.soa2.csv') ## works as I expected read.csv('df.soa2.csv')## works as I expected char1 - letters[1:5] df.soac - data.frame(soa, char1) write.csv(df.soac, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent df.csoa - data.frame(char1, soa) write.csv(df.csoa, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 8.0 year 2008 month 11 day10 svn rev46884 language R version.string R version 2.8.0 Patched (2008-11-10 r46884) sessionInfo() R version 2.8.0 Patched (2008-11-10 r46884) i386-pc-mingw32 locale: LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] survival_2.34-1 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] Tab completion / X11 fatal IO error
Dear colleagues, I have two questions about R that I cannot answer via google searching: 1) Is there any way to speed up tab completion? This is near-instant in bash, and occasionally takes upwards of 10 seconds in R. When I hit tab, I've usually typed dataframe$ab or lst$ab or something, and length(colnames(dataframe)) or length(names(lst)) are rarely very long. 2) I often run R from the linux command-line in a screen session on a remote computer. As such, to see graphics, I tunnel X through ssh, then run screen, then run X11(localhost:10) which opens an X window on my screen, just as desired. However, if I forget to dev.off() before logging out of ssh (or before the ssh connection drops on its own, which it does with some frequency, hence running 'screen'), I come back to an error like this one: Error: X11 fatal IO error: please save work and shut down R ...and then I shut down R (saving my data, which takes a few minutes) and then load R again (loading my data, which once again takes several minutes), which is a pretty big time sink. Is this error message quite serious? I know and do not mind that the X connection has died, and I can't imagine that this would really cause too many troubles, but I'm a bit afraid to ignore a message that says to save and shut down. version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 8.0 year 2008 month 10 day20 svn rev46754 language R version.string R version 2.8.0 (2008-10-20) Thanks in advance, Adam Kramer __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] png() and jpg() devices acting weird.
I use a CentOS 5.2 VPS to generate graphs through an R web-application. I generate generate both pdf() and png() formats of the graphs. The pdf works just fine and generates perfect pictures. However, the figures generated by the png() (and also the jpg) device are messed up. The weird thing is that it does not generate an error. It does generate a file with a figure of the correct size, but the figures are mostly just white space, or small parts of the actual figure. X11 is not installed on the machine so I have to use type=cairo. I have tried installing and updating cairo, glib2, gtk+ in linux, and installed the R-package Cairo, but with no result. sessionInfo() R version 2.8.0 (2008-10-20) x86_64-redhat-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] Cairo_1.4-4 -- View this message in context: http://www.nabble.com/png%28%29-and-jpg%28%29-devices-acting-weird.-tp21098121p21098121.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] R/Finance 2009: Applied Finance with R -- Call for Papers
Call for Papers The Finance Department of the University of Illinois at Chicago (UIC), the International Center for Futures and Derivatives at UIC, and members of the R finance community are pleased to announce R/Finance 2009: Applied Finance with R on April 24 and 25, 2009, in Chicago, IL, USA Confirmed keynote speakers include: Patrick Burns (Burns Statistics) David Kane (Kane Capital) Roger Koenker (U of Illinois at Urbana/Champaign) David Ruppert (Cornell) Diethelm Wuertz (ETH Zürich) Eric Zivot (U of Washington) We invite all users of R in Finance to submit one-page abstracts or complete papers (in txt/pdf/doc format). We encourage papers both on academic research topics and related to use of R by Finance practitioners. Presenters are strongly encouraged to provide working R code to accompany the presentation/paper. Datasets need not be made public. Please send submissions to commit...@rinfinance.com. The submission deadline is January 31st, 2009. Submissions will be evaluated and submitters notified via email on a rolling basis. Additional details about the conference will be announced as available. For the program committee: Gib Bassett, Peter Carl, Dirk Eddelbuettel, John Miller, Brian Peterson, Dale Rosenthal, Jeffrey Ryan ___ r-annou...@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] comparing distributions
On Fri, Dec 19, 2008 at 05:44:47AM -0800, kdebusk wrote: I have data sets from three different sites. None of the data sets are normally distributed and can not be log-transformed to a normal distribution. I would like to compare the data sets to see if any of the sites are similar to each other, and would like something more powerful than a non-parametric wilcoxen test. Does anyone have any suggestions on more powerful ways of comparing non-normal data sets? If it helps, the data sets follow a Gamma distribution. Thanks for all input. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. If the data are gamma distributed, then a glm with family Gamma should be a good option. albyn __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] How to write a Surv object to a csv-file?
On Dec 19, 2008, at 2:04 PM, Heinz Tuechler wrote: Dear All, trying to write a data.frame, containing Surv objects to a csv-file I get Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent. See example below. May be, I overlooked something, but I expected that also data.frames containing Surv objects may be written to csv files. Is there a better way to write to csv files? Yes, if the goal is creating an ASCII structure that can be recovered by an R interpreter: ?dput ?dget dput(df.soac, test) copy.df.soac - dget(test) all.equal(df.soac, copy.df.soac) Doesn't give you a result that you would want to read with Excel, but that does not appear to be your goal. You can examine it with a text editor. -- David Winsemius Thanks, Heinz Tüchler ### write Surv-object in csv-file library(survival) ## create example data soa - Surv(1:5, c(0, 0, 1, 0, 1)) df.soa - data.frame(soa) write.csv(df.soa, 'df.soa.csv')## works as I expected read.csv('df.soa.csv') ## works as I expected df.soa2 - data.frame(soa, soa2=soa) write.csv(df.soa2, 'df.soa2.csv') ## works as I expected read.csv('df.soa2.csv')## works as I expected char1 - letters[1:5] df.soac - data.frame(soa, char1) write.csv(df.soac, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent df.csoa - data.frame(char1, soa) write.csv(df.csoa, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 8.0 year 2008 month 11 day10 svn rev46884 language R version.string R version 2.8.0 Patched (2008-11-10 r46884) sessionInfo() R version 2.8.0 Patched (2008-11-10 r46884) i386-pc-mingw32 locale: LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria. 1252;LC_MONETARY=German_Austria. 1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] survival_2.34-1 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] How to write a Surv object to a csv-file?
Dear David! Thank you for your response. I like csv files, because in that case I can easily compare different versions of similar data.frames. Similar in this case means that I may add a column or change some transformation command for one column. With dput it's rather difficult, and when I tried the compare package, I had no success comparing data.frames containing Surv objects. Thanks again Heinz At 22:31 19.12.2008, David Winsemius wrote: On Dec 19, 2008, at 2:04 PM, Heinz Tuechler wrote: Dear All, trying to write a data.frame, containing Surv objects to a csv-file I get Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent. See example below. May be, I overlooked something, but I expected that also data.frames containing Surv objects may be written to csv files. Is there a better way to write to csv files? Yes, if the goal is creating an ASCII structure that can be recovered by an R interpreter: ?dput ?dget dput(df.soac, test) copy.df.soac - dget(test) all.equal(df.soac, copy.df.soac) Doesn't give you a result that you would want to read with Excel, but that does not appear to be your goal. You can examine it with a text editor. -- David Winsemius Thanks, Heinz Tüchler ### write Surv-object in csv-file library(survival) ## create example data soa - Surv(1:5, c(0, 0, 1, 0, 1)) df.soa - data.frame(soa) write.csv(df.soa, 'df.soa.csv')## works as I expected read.csv('df.soa.csv') ## works as I expected df.soa2 - data.frame(soa, soa2=soa) write.csv(df.soa2, 'df.soa2.csv') ## works as I expected read.csv('df.soa2.csv')## works as I expected char1 - letters[1:5] df.soac - data.frame(soa, char1) write.csv(df.soac, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent df.csoa - data.frame(char1, soa) write.csv(df.csoa, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 8.0 year 2008 month 11 day10 svn rev46884 language R version.string R version 2.8.0 Patched (2008-11-10 r46884) sessionInfo() R version 2.8.0 Patched (2008-11-10 r46884) i386-pc-mingw32 locale: LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria. 1252;LC_MONETARY=German_Austria. 1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] survival_2.34-1 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] How to write a Surv object to a csv-file?
On Fri, 19 Dec 2008, Heinz Tuechler wrote: Dear David! Thank you for your response. I like csv files, because in that case I can easily compare different versions of similar data.frames. Similar in this case means that I may add a column or change some transformation command for one column. With dput it's rather difficult, and when I tried the compare package, I had no success comparing data.frames containing Surv objects. Heinz, Is this good enough? mat - as.data.frame( lapply( df.soac, unclass ) ) write.csv(mat,'mat.csv') read.csv('mat.csv') X soa.time soa.status char1 1 11 0 1 2 22 0 2 3 33 1 3 4 44 0 4 5 55 1 5 The bug seems to be in as.matrix.data.frame. HTH, Chuck Thanks again Heinz At 22:31 19.12.2008, David Winsemius wrote: On Dec 19, 2008, at 2:04 PM, Heinz Tuechler wrote: Dear All, trying to write a data.frame, containing Surv objects to a csv-file I get Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent. See example below. May be, I overlooked something, but I expected that also data.frames containing Surv objects may be written to csv files. Is there a better way to write to csv files? Yes, if the goal is creating an ASCII structure that can be recovered by an R interpreter: ?dput ?dget dput(df.soac, test) copy.df.soac - dget(test) all.equal(df.soac, copy.df.soac) Doesn't give you a result that you would want to read with Excel, but that does not appear to be your goal. You can examine it with a text editor. -- David Winsemius Thanks, Heinz Tüchler ### write Surv-object in csv-file library(survival) ## create example data soa - Surv(1:5, c(0, 0, 1, 0, 1)) df.soa - data.frame(soa) write.csv(df.soa, 'df.soa.csv')## works as I expected read.csv('df.soa.csv') ## works as I expected df.soa2 - data.frame(soa, soa2=soa) write.csv(df.soa2, 'df.soa2.csv') ## works as I expected read.csv('df.soa2.csv')## works as I expected char1 - letters[1:5] df.soac - data.frame(soa, char1) write.csv(df.soac, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent df.csoa - data.frame(char1, soa) write.csv(df.csoa, 'df.soac.csv') ## generates the following error message: Error in dimnames(X) - list(dn[[1L]], unlist(collabs, use.names = FALSE)) : length of 'dimnames' [2] not equal to array extent platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 8.0 year 2008 month 11 day10 svn rev46884 language R version.string R version 2.8.0 Patched (2008-11-10 r46884) sessionInfo() R version 2.8.0 Patched (2008-11-10 r46884) i386-pc-mingw32 locale: LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria. 1252;LC_MONETARY=German_Austria. 1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] survival_2.34-1 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] Merging data frames of different length
Hello, everyone! I have list L that contains 99 data frames. All data frames have only one row, but a different number of columns. Some data frames have 3 columns, some - 6 columns, and some - 9 columns. The names of the first 3 columns are identical in all 99 data frames (e.g., A, B, and C). The names of columns 4:6 are identical in data frames that contain 6 and 9 columns (e.g., D, E, and F). So that L looks like this: L[[1]] A B C 2 3 4 L[[2]] A B C D E F 2 1 3 2 4 5 L[[3]] A B C D E F G H I 1 2 4 3 2 4 5 4 2 L[[4]] ... How can I merge all of those data frames into one large data frame - with 99 rows - such that all data are in the columns with correct names. Of course, I'd like the rows of the new large data frame that contain the data for less than 9 columns to have NAs in columns 4:9 (or 7:9). In other words, I want the first 3 rows of the new large data frame to look like this: A B C D E F G H I 2 3 4 NA NA NA NA NA NA 2 1 3 2 4 5 NA NA NA 1 2 4 3 2 4 5 4 2 Ideally, I'd like this merge to work for ANY number of individual small data frames in L - even if their total number within L is unknown. I tried merge - but it seems to me that it only works for 2 data frames, not for many. Thank you very much! -- Dimitri Liakhovitski MarketTools, Inc. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Merging data frames of different length
Try this: L - list(data.frame(A=2, B=3, C=4), + data.frame(A=2, B=1, C=3, D=2, E=4, F=5), + data.frame(A=1, B=2, C=4, D=3, E=2, F=4, G=5, H=4, I=2)) library(plyr) do.call(rbind.fill, L) A B C D E F G H I 1 2 3 4 NA NA NA NA NA NA 2 2 1 3 2 4 5 NA NA NA 3 1 2 4 3 2 4 5 4 2 On Fri, Dec 19, 2008 at 5:48 PM, Dimitri Liakhovitski ld7...@gmail.com wrote: Hello, everyone! I have list L that contains 99 data frames. All data frames have only one row, but a different number of columns. Some data frames have 3 columns, some - 6 columns, and some - 9 columns. The names of the first 3 columns are identical in all 99 data frames (e.g., A, B, and C). The names of columns 4:6 are identical in data frames that contain 6 and 9 columns (e.g., D, E, and F). So that L looks like this: L[[1]] A B C 2 3 4 L[[2]] A B C D E F 2 1 3 2 4 5 L[[3]] A B C D E F G H I 1 2 4 3 2 4 5 4 2 L[[4]] ... How can I merge all of those data frames into one large data frame - with 99 rows - such that all data are in the columns with correct names. Of course, I'd like the rows of the new large data frame that contain the data for less than 9 columns to have NAs in columns 4:9 (or 7:9). In other words, I want the first 3 rows of the new large data frame to look like this: A B C D E F G H I 2 3 4 NA NA NA NA NA NA 2 1 3 2 4 5 NA NA NA 1 2 4 3 2 4 5 4 2 Ideally, I'd like this merge to work for ANY number of individual small data frames in L - even if their total number within L is unknown. I tried merge - but it seems to me that it only works for 2 data frames, not for many. Thank you very much! -- Dimitri Liakhovitski MarketTools, Inc. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] package install error in CentOS
solved: There was indeed a problem with exec rights in the /tmp dir as they were set by my VPS host. I fixed it by creating a dir 'tempdir' in my homedir, and giving it 777 rights. Then set the environment variable TMPDIR in R: Sys.setenv(TMPDIR=/home/jeroen/tempdir); install.packages(Cairo); thank you :) Jeffrey Horner wrote: Check that your data partitions have the 'exec' flag set in /etc/fstab, particulary the /tmp partition: http://www.centos.org/modules/newbb/viewtopic.php?topic_id=1687forum=31 Jeff Jeroen Ooms wrote: I am trying to install package Cairo on CentOS 5.2, but I keep getting this error: * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' The downloaded packages are in /tmp/Rtmp8ML568/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Cairo) : installation of package 'Cairo' had non-zero exit status I tried to do it manually but with no luck: [jer...@138 shizzle]$ sudo R CMD INSTALL Cairo_1.4-4.tar.gz * Installing to library '/usr/lib64/R/library' * Installing *source* package 'Cairo' ... /usr/lib64/R/bin/INSTALL: ./configure: /bin/sh: bad interpreter: Permission denied ERROR: configuration failed for package 'Cairo' ** Removing '/usr/lib64/R/library/Cairo' I have tried to changing the $TMPDIR to another dir, and giving it 777 permissions, but I keep getting the error. Some info: sessionInfo() R version 2.8.0 (2008-10-20) x86_64-redhat-linux-gnu locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base [jer...@138 shizzle]$ gcc --version gcc (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/package-install-error-in-CentOS-tp21094790p21097936.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] Help in Lattice!
Hi - How can I add different notes in different panels? My data looks like ID Dose Visit Value 110 0.5 -6.5802e-02 210 1.0 2.4085e-01 310 1.5 -2.2907e-01 410 2.0 2.4074e-01 ... ... ... ... ... 270 45 30 3.0 -8.1316e-01 271 46 30 0.5 -2.0786e-01 272 46 30 1.0 -2.9336e-01 273 46 30 1.5 -5.5657e-01 274 46 30 2.0 -2.1659e-01 I use xyplot(Value ~ Visit | factor(ID), data = dataM, typ = 'o',layout = c(3,3),as.table=TRUE); to plot each patient longitudinal observations. How can I add dose information to each panel? e.g., adding Dose = 30 Best, Haoda __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
[R] Problems installing lme4 on Ubuntu
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 While I'm not an R expert, I have used R on Windows XP. Now I've moved to Ubuntu (Intrepid), and I'm trying to configure R to work with the Gelman and Hill _Data Analysis Using Regression and Multilevel/Hierarchical Models_. So far, it's not working. I start by following the instructions for installing arm and BRugs at http://www.stat.columbia.edu/~gelman/bugsR/. At first, it kept failing, but I kept installing more Ubuntu packages. Finally, I installed the science-statistics package, and things seemed to work: I got the required packages to show up as loaded when I run library(). When I run library(arm) (FWIW, I'm using ESS in Emacs), I get , | library(arm) | Loading required package: MASS | Loading required package: Matrix | Loading required package: lattice | | Attaching package: 'Matrix' | | | The following object(s) are masked from package:stats : | |xtabs | | Loading required package: lme4 | Error in dyn.load(file, DLLpath = DLLpath, ...) : | function 'cholmod_start' not provided by package 'Matrix' | Error: package 'lme4' could not be loaded ` even though , | library() | Packages in library '/home/bill/R/i486-pc-linux-gnu-library/2.7': | | arm Data Analysis Using Regression and | Multilevel/Hierarchical Models | codaOutput analysis and diagnostics for MCMC | Matrix Sparse and Dense Matrix Classes and Methods | R2WinBUGS Running WinBUGS and OpenBUGS from R / S-PLUS | | Packages in library '/usr/lib/R/site-library': | . | . | latticeExtraExtra Graphical Utilities Based on Lattice | lme4Linear mixed-effects models using S4 classes | lmtest Testing Linear Regression Models | . | . | | Packages in library '/usr/lib/R/library': | | . | . | . | | Warning message: | In library() : library ‘/usr/local/lib/R/site-library’ contains no packages ` and , | library(help = arm) | | Information on package 'arm' | | Description: | | Package: arm | Version: 1.1-17 | Date: 2008-11-25 | Title: Data Analysis Using Regression and |Multilevel/Hierarchical Models | Author:Andrew Gelman gel...@stat.columbia.edu, Yu-Sung Su |ys...@columbia.edu, Masanao Yajima |my2...@columbia.edu, Jennifer Hill |jh1...@columbia.edu, Maria Grazia Pittau |gra...@stat.columbia.edu, Jouni Kerman |jo...@kerman.com and Tian Zheng |tzh...@stat.columbia.edu | Maintainer:Yu-Sung Su ys...@columbia.edu | Depends: methods, R (= 2.6.0), MASS, Matrix (= 0.999375-10), |lme4 (= 0.999375-16), R2WinBUGS | Suggests: car, foreign | Description: R functions for processing lm, glm, mer and polr |outputs. | URL: http://www.stat.columbia.edu/~gelman/software/ | License: GPL (= 2) | Packaged: Tue Nov 25 15:26:57 2008; SUYS | Built: R 2.7.1; ; 2008-12-17 21:31:22; unix | | Index: | | GO-classFunction to Recall Last Source File | balance Functions to compute the balance statistics | bayesglmBayesian generalized linear models. | bayespolr Bayesian Ordered Logistic or Probit Regression | binnedplot Binned Residual Plot | coefplotGeneric Function for Making Coefficient Plot | contr.bayes.ordered Contrast Matrices | corrplotCorrelation Plot | display Functions for Processing lm, glm, mer and polr | Output | fround Formating the Rounding of Numbers | invlogitInverse logistic function | lalonde Lalonde Dataset | matchingSingle Nearest Neighborhood Matching | model.matrix.bayes Construct Design Matrices | multicomp.plot Multiple Comparison Plot | rescale Function for Standardizing by Centering and | Dividing by 2 sd's | residual.plot residual plot for the observed values | se.coef Extract Standard Errors of Model Coefficients | sigma.hat Extract Residual Errors | sim Functions to Get Posterior Distributions | standardize Function for Standardizing Regression | Predictors by Centering and Dividing by 2 sd's | traceplot Trace plot of bugs object | triangleplotTriangle Plot ` To demonstrate that things aren't well, , | display() | Error: could not find function display ` Any suggestions on next steps? The best I found in searching was that I needed to load certain packages in Ubuntu, and I hoped I had done that when I finally loaded science-statistics. Thanks, Bill - --
Re: [R] Problems installing lme4 on Ubuntu
This may just be version incompatibilities. A similar discussion recently transpired on r-sig-mixed-models, see e.g. https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q4/001526.html HTH Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: smckinney +at+ bccrc +dot+ ca tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada -Original Message- From: r-help-boun...@r-project.org on behalf of Bill Harris Sent: Fri 12/19/2008 5:13 PM To: r-help@r-project.org Subject: [R] Problems installing lme4 on Ubuntu -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 While I'm not an R expert, I have used R on Windows XP. Now I've moved to Ubuntu (Intrepid), and I'm trying to configure R to work with the Gelman and Hill _Data Analysis Using Regression and Multilevel/Hierarchical Models_. So far, it's not working. I start by following the instructions for installing arm and BRugs at http://www.stat.columbia.edu/~gelman/bugsR/. At first, it kept failing, but I kept installing more Ubuntu packages. Finally, I installed the science-statistics package, and things seemed to work: I got the required packages to show up as loaded when I run library(). When I run library(arm) (FWIW, I'm using ESS in Emacs), I get , | library(arm) | Loading required package: MASS | Loading required package: Matrix | Loading required package: lattice | | Attaching package: 'Matrix' | | | The following object(s) are masked from package:stats : | |xtabs | | Loading required package: lme4 | Error in dyn.load(file, DLLpath = DLLpath, ...) : | function 'cholmod_start' not provided by package 'Matrix' | Error: package 'lme4' could not be loaded ` even though , | library() | Packages in library '/home/bill/R/i486-pc-linux-gnu-library/2.7': | | arm Data Analysis Using Regression and | Multilevel/Hierarchical Models | codaOutput analysis and diagnostics for MCMC | Matrix Sparse and Dense Matrix Classes and Methods | R2WinBUGS Running WinBUGS and OpenBUGS from R / S-PLUS | | Packages in library '/usr/lib/R/site-library': | . | . | latticeExtraExtra Graphical Utilities Based on Lattice | lme4Linear mixed-effects models using S4 classes | lmtest Testing Linear Regression Models | . | . | | Packages in library '/usr/lib/R/library': | | . | . | . | | Warning message: | In library() : library '/usr/local/lib/R/site-library' contains no packages ` and , | library(help = arm) | | Information on package 'arm' | | Description: | | Package: arm | Version: 1.1-17 | Date: 2008-11-25 | Title: Data Analysis Using Regression and |Multilevel/Hierarchical Models | Author:Andrew Gelman gel...@stat.columbia.edu, Yu-Sung Su |ys...@columbia.edu, Masanao Yajima |my2...@columbia.edu, Jennifer Hill |jh1...@columbia.edu, Maria Grazia Pittau |gra...@stat.columbia.edu, Jouni Kerman |jo...@kerman.com and Tian Zheng |tzh...@stat.columbia.edu | Maintainer:Yu-Sung Su ys...@columbia.edu | Depends: methods, R (= 2.6.0), MASS, Matrix (= 0.999375-10), |lme4 (= 0.999375-16), R2WinBUGS | Suggests: car, foreign | Description: R functions for processing lm, glm, mer and polr |outputs. | URL: http://www.stat.columbia.edu/~gelman/software/ | License: GPL (= 2) | Packaged: Tue Nov 25 15:26:57 2008; SUYS | Built: R 2.7.1; ; 2008-12-17 21:31:22; unix | | Index: | | GO-classFunction to Recall Last Source File | balance Functions to compute the balance statistics | bayesglmBayesian generalized linear models. | bayespolr Bayesian Ordered Logistic or Probit Regression | binnedplot Binned Residual Plot | coefplotGeneric Function for Making Coefficient Plot | contr.bayes.ordered Contrast Matrices | corrplotCorrelation Plot | display Functions for Processing lm, glm, mer and polr | Output | fround Formating the Rounding of Numbers | invlogitInverse logistic function | lalonde Lalonde Dataset | matchingSingle Nearest Neighborhood Matching | model.matrix.bayes Construct Design Matrices | multicomp.plot Multiple Comparison Plot | rescale Function for Standardizing by Centering and | Dividing by 2 sd's | residual.plot residual plot for the observed values | se.coef Extract Standard Errors of Model Coefficients | sigma.hat
Re: [R] Help in Lattice!
Write a panel= function: dataM - structure(list(ID = c(1L, 1L, 1L, 1L, 45L, 46L, 46L, 46L, 46L ), Dose = c(0L, 0L, 0L, 0L, 30L, 30L, 30L, 30L, 30L), Visit = c(0.5, 1, 1.5, 2, 3, 0.5, 1, 1.5, 2), Value = c(-0.065802, 0.24085, -0.22907, 0.24074, -0.81316, -0.20786, -0.29336, -0.55657, -0.21659 )), .Names = c(ID, Dose, Visit, Value), class = data.frame, row.names = c(1, 2, 3, 4, 270, 271, 272, 273, 274)) library(lattice) library(grid) xyplot(Value ~ Visit | factor(ID), data = dataM, typ = 'o', as.table = TRUE, subscripts = TRUE, Dose = dataM$Dose, panel = function(x, y, subscripts, Dose, ...) { panel.xyplot(x, y, ...) grid.text(paste(Dose =, Dose[subscripts][1]), .15, .15, gp = gpar(cex = 0.6)) } ) On Fri, Dec 19, 2008 at 7:07 PM, Haoda Fu fu...@yahoo.com.cn wrote: Hi - How can I add different notes in different panels? My data looks like ID Dose Visit Value 110 0.5 -6.5802e-02 210 1.0 2.4085e-01 310 1.5 -2.2907e-01 410 2.0 2.4074e-01 ... ... ... ... ... 270 45 30 3.0 -8.1316e-01 271 46 30 0.5 -2.0786e-01 272 46 30 1.0 -2.9336e-01 273 46 30 1.5 -5.5657e-01 274 46 30 2.0 -2.1659e-01 I use xyplot(Value ~ Visit | factor(ID), data = dataM, typ = 'o',layout = c(3,3),as.table=TRUE); to plot each patient longitudinal observations. How can I add dose information to each panel? e.g., adding Dose = 30 Best, Haoda __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Problems installing lme4 on Ubuntu
On 19 December 2008 at 17:13, Bill Harris wrote: | While I'm not an R expert, I have used R on Windows XP. Now I've moved | to Ubuntu (Intrepid), and I'm trying to configure R to work with the | Gelman and Hill _Data Analysis Using Regression and | Multilevel/Hierarchical Models_. So far, it's not working. | | I start by following the instructions for installing arm and BRugs at | http://www.stat.columbia.edu/~gelman/bugsR/. At first, it kept | failing, but I kept installing more Ubuntu packages. Finally, I | installed the science-statistics package, and things seemed to work: I | got the required packages to show up as loaded when I run library(). First off, see the R FAQ and the Ubuntu README on CRAN: http://cran.r-project.org/bin/linux/ubuntu/ This shows you how you can get current R binaries with just one apt-get command. With that, you then get to decide if you want the prebuild r-cran-* packages (as e.g. r-cran-lme4) or whether you want to built them yourself in R via install.packages(). In which case r-base-dev will be helpful to install needed packages. Either way, I have no problems with lme4 etc. or arm, see below. Also note that there is a Debian/Ubuntu specific mailing list r-sig-debian where you may want to subscribe. You are likely to find more focussed help for Ubuntu there, and we'd be glad to walk you through individual steps. Welcome to Debian and Ubuntu :) Regards, Dirk From my Debian system running the beta release of R 2.8.1: library(arm) Loading required package: MASS Loading required package: Matrix Loading required package: lattice Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs The following object(s) are masked from package:base : colMeans, colSums, rcond, rowMeans, rowSums Loading required package: lme4 Loading required package: R2WinBUGS Loading required package: coda Attaching package: 'coda' The following object(s) are masked from package:lme4 : HPDinterval arm (Version 1.1-17, built: 2008-11-25) Working directory is /home/edd options( digits = 2 ) Loading required package: car Loading required package: foreign Attaching package: 'arm' The following object(s) are masked from package:coda : traceplot -- Three out of two people have difficulties with fractions. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Problems installing lme4 on Ubuntu
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Steven McKinney smckin...@bccrc.ca writes: This may just be version incompatibilities. A similar discussion recently transpired on r-sig-mixed-models, see e.g. https://stat.ethz.ch/pipermail/r-sig-mixed-models/2008q4/001526.html Steven, That did sound promising. I ran , | sudo R CMD REMOVE -l /usr/lib/R/site-library/ lme4 ` and the files disappeared. Then I ran , | install.packages(lme4) ` - From inside R, selected a mirror in WA (USA), and let it run. I got , | trying URL 'http://cran.fhcrc.org/src/contrib/lme4_0.999375-28.tar.gz' | Content type 'application/x-gzip' length 678443 bytes (662 Kb) | opened URL | == | downloaded 662 Kb | | * Installing *source* package 'lme4' ... | ** libs | gcc -std=gnu99 -I/usr/share/R/include -I/home/bill/R/i486-pc-linux-gnu-library/2.7/Matrix/include -fpic -g -O2 -c init.c -o init.o | gcc -std=gnu99 -I/usr/share/R/include -I/home/bill/R/i486-pc-linux-gnu-library/2.7/Matrix/include -fpic -g -O2 -c lmer.c -o lmer.o | gcc -std=gnu99 -I/usr/share/R/include -I/home/bill/R/i486-pc-linux-gnu-library/2.7/Matrix/include -fpic -g -O2 -c local_stubs.c -o local_stubs.o | gcc -std=gnu99 -shared -o lme4.so init.o lmer.o local_stubs.o -llapack -lblas -lgfortran -lm -L/usr/lib/R/lib -lR | ** R | ** data | ** moving datasets to lazyload DB | ** inst | ** preparing package for lazy loading | Loading required package: Matrix | Loading required package: lattice | | Attaching package: 'Matrix' | | | The following object(s) are masked from package:stats : | |xtabs | | Creating a new generic function for coef in lme4 | Creating a new generic function for confint in lme4 | Creating a new generic function for plot in lme4 | Creating a new generic function for formula in lme4 | Creating a new generic function for anova in lme4 | Creating a new generic function for deviance in lme4 | Creating a new generic function for fitted in lme4 | Creating a new generic function for logLik in lme4 | Creating a new generic function for predict in lme4 | Creating a new generic function for residuals in lme4 | Creating a new generic function for resid in lme4 | Creating a new generic function for simulate in lme4 | Creating a new generic function for model.frame in lme4 | Creating a new generic function for model.matrix in lme4 | Creating a new generic function for terms in lme4 | Creating a new generic function for vcov in lme4 | Creating a new generic function for with in lme4 | Creating a new generic function for as.data.frame in lme4 | Creating a new generic function for xyplot in lme4 | Creating a new generic function for densityplot in lme4 | Creating a new generic function for qqmath in lme4 | ** help | Building/Updating help pages for package 'lme4' | Formats: text html latex example | BIC texthtmllatex | Dyestuff texthtmllatex example | HPDinterval texthtmllatex | Pastestexthtmllatex example | Penicillintexthtmllatex example | VarCorr-class texthtmllatex | VarCorr texthtmllatex example | VerbAgg texthtmllatex example | cake texthtmllatex example | cbpp texthtmllatex example | fixef texthtmllatex example | lmList-class texthtmllatex | lmListtexthtmllatex example | lmer texthtmllatex example | mcmcsamp texthtmllatex example | mer-class texthtmllatex example | merMCMC-class texthtmllatex example | ranef texthtmllatex example | refit texthtmllatex example | sleepstudytexthtmllatex example | ** building package indices ... | * DONE (lme4) | | The downloaded packages are in | /tmp/RtmpZmO6Lb/downloaded_packages | display() | Error: could not find function display ` The two unexpected things were the fact it seemed to load Matrix after getting lme4 -- did that mess anything up? -- and The following object(s) are masked from package:stats : xtabs statement, which seemed odd but I don't know what it means. Did I misunderstand something? Thanks, Bill - -- Bill Harris http://facilitatedsystems.com/weblog/ Facilitated Systems Everett, WA 98208 USA http://facilitatedsystems.com/ phone: +1 425 337-5541 -BEGIN PGP
Re: [R] Problems installing lme4 on Ubuntu
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dirk Eddelbuettel e...@debian.org writes: First off, see the R FAQ and the Ubuntu README on CRAN: http://cran.r-project.org/bin/linux/ubuntu/ Dirk, Thanks; that looks promising! This shows you how you can get current R binaries with just one apt-get command. With that, you then get to decide if you want the prebuild r-cran-* packages (as e.g. r-cran-lme4) or whether you want to built them yourself in R via install.packages(). In which case r-base-dev will be helpful to install needed packages. I tried that, but using the mirrors at fhcrc and wustl both gave me errors when I tried to install: , | WARNING: The following packages cannot be authenticated! | ess r-base-core r-cran-lattice r-cran-mgcv r-cran-vr r-base r-recommended | r-cran-rodbc r-base-html | Install these packages without verification [y/N]? ` Is that to be expected? I aborted the process, but, if you say that's normal, I'll try again. Either way, I have no problems with lme4 etc. or arm, see below. Also note that there is a Debian/Ubuntu specific mailing list r-sig-debian where you may want to subscribe. You are likely to find more focussed help for Ubuntu there, and we'd be glad to walk you through individual steps. Welcome to Debian and Ubuntu :) Thanks. I'll sign up shortly. I had used Debian some years ago in a colinux setting, and it's truly fun to compute again now that I'm on Ubuntu. The following object(s) are masked from package:stats : xtabs Ah. So, whatever that means, it must be okay. :-) Bill - -- Bill Harris http://facilitatedsystems.com/weblog/ Facilitated Systems Everett, WA 98208 USA http://facilitatedsystems.com/ phone: +1 425 337-5541 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAklMb5UACgkQ3J3HaQTDvd8ZTwCcCiP4gSaEI2eN87kmviY6qVX2 BngAn0hn56BS1fnP445VIifxguUOT4xV =FP2i -END PGP SIGNATURE- __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Problems installing lme4 on Ubuntu
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bill Harris bill_har...@facilitatedsystems.com writes: This shows you how you can get current R binaries with just one apt-get command. With that, you then get to decide if you want the prebuild r-cran-* packages (as e.g. r-cran-lme4) or whether you want to built them yourself in R via install.packages(). In which case r-base-dev will be helpful to install needed packages. I tried that, but using the mirrors at fhcrc and wustl both gave me errors when I tried to install: , | WARNING: The following packages cannot be authenticated! | ess r-base-core r-cran-lattice r-cran-mgcv r-cran-vr r-base r-recommended | r-cran-rodbc r-base-html | Install these packages without verification [y/N]? ` Is that to be expected? I aborted the process, but, if you say that's normal, I'll try again. I should have said I tried the process shown on that page under SECURE APT: , | $ gpg --keyserver subkeys.pgp.net --recv-key E2A11821 | gpg: requesting key E2A11821 from hkp server subkeys.pgp.net | gpg: key E2A11821: Vincent Goulet vincent.gou...@act.ulaval.ca not changed | gpg: Total number processed: 1 | gpg: unchanged: 1 | $ gpg -a --export E2A11821 | sudo apt-key add - | OK ` Bill - -- Bill Harris http://facilitatedsystems.com/weblog/ Facilitated Systems Everett, WA 98208 USA http://facilitatedsystems.com/ phone: +1 425 337-5541 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAklMccoACgkQ3J3HaQTDvd9CygCeLw7BSsZPghGgEoToz3zKD+D/ QA8AnjsCLqrf7cyXX11B1aBzg3FpWREJ =qlMf -END PGP SIGNATURE- __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.
Re: [R] Problems installing lme4 on Ubuntu
On 19 December 2008 at 19:53, Bill Harris wrote: | That did sound promising. I ran | | , | | sudo R CMD REMOVE -l /usr/lib/R/site-library/ lme4 | ` | | and the files disappeared. Still not a good idea. See /etc/R/Renviron -- the directory /usr/lib/R/site-library is used by your Ubuntu R/CRAN packages. As you installed them via apt-get / aptitude / ... you should uninstall them via the package management system. R and Ubuntu and somewhat unaware of their respective package systems. So your Ubuntu system now thinks it has files below /usr/lib/R/site-library/lme4/ when it really doesn't anymore. This can lead to inconsistent bahviour. You could just re-install the Ubuntu version, and then remove it, or you could leave it as it is. As a general rule, files below /usr/local or /opt or /home are yours, everything else is done via the package management system. | Then I ran | | , | | install.packages(lme4) | ` | | - From inside R, selected a mirror in WA (USA), and let it run. I got You can also hardwire a mirror via ~/.Rprofile and a line like options(repos=c(CRAN=http://cran.us.r-project.org;)) which selects the same Fred Hutch. mirror too. | , | | trying URL 'http://cran.fhcrc.org/src/contrib/lme4_0.999375-28.tar.gz' | | Content type 'application/x-gzip' length 678443 bytes (662 Kb) | | opened URL | | == | | downloaded 662 Kb | | | | * Installing *source* package 'lme4' ... | | ** libs [...] That's what I suggested in my last email too. | | display() | | Error: could not find function display | ` | | The two unexpected things were the fact it seemed to load Matrix after | getting lme4 -- did that mess anything up? -- and The following Normal -- that is what the Depends: the DESCRIPTION file for lme4 imples. | object(s) are masked from package:stats : xtabs statement, which seemed | odd but I don't know what it means. Normal warning telling you that the xtabs function are masked. Not to worry. Hope this helps, Dirk -- Three out of two people have difficulties with fractions. __ R-help@r-project.org mailing list 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, minimal, self-contained, reproducible code.