Re: [R] dataframe of dataframes?
raje...@cse.iitm.ac.in wrote: Hi, I create several dataframes in a nested loop and would like to maintain them in a matrix form with each dataframe represented by the row and the column. How can I do this? You can't, at least as you describe it. However, you can add a column for row ID and a column for column ID to each of your result data frames and rbind them together. It is also possible to create lists of lists... but I believe the single augmented dataframe will be way more useful in the long run. __ 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] xlab with text and expression
One more question, given that plot(rnorm(1),rnorm(1), ylab=expression(a~b = 3), cex.lab=1.2) then sign = seems to be smaller than the rest, seems like cex.lab=1.2 affects only the text in ylab. 1) Is there any way to alter its size to follow the size of the whole expression? It works nice for legend but not for ylab. 2) Is there any other way to put text into expression? since if you put ylab=expression(a:~b = 3) then an additional space pops up between 'a' and ':'. thanks a lot, robert -- View this message in context: http://r.789695.n4.nabble.com/xlab-with-text-and-expression-tp2535732p2538502.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] apply over parallel lists and their elements
On Tue, Sep 14, 2010 at 12:44 AM, David Winsemius dwinsem...@comcast.net wrote: The second argument to mean is trim. I am not sure what mean(1, 3) is supposed to do but what it return is 1. Thanks for the info. On this particular point I find the documentation confusing. In ?mapply : '‘mapply’ applies ‘FUN’ to the first elements of each ... argument, ' mapply(FUN, ..., MoreArgs = NULL, [..] ' ...: arguments to vectorize over (list or vector).' In my understanding this suggests that '...' can take several comma separated objects, so that in mapply(mean, tree[[1]]$node$values, tree[[2]]$node$values) the second object should not be treated as a 'MoreArgs' argument. But I'm probably wrong. If you wanted 2,3,4 ..., 11 then you would perhaps do: mean( mapply(c, tree[[1]]$node$values, tree[[2]]$node$values) ) I think the original poster was more interested in finding the mean() by rows. Instead of mean( mapply(c, tree[[1]]$node$values, tree[[2]]$node$values) ) [1] 6.5 he probably looks for apply( mapply(c, tree[[1]]$node$values, tree[[2]]$node$values), 2, mean ) [1] 2 3 4 5 6 7 8 9 10 11 although I'm positive there is a neater way to do this. For example, apply( data.frame(tree[[1]]$node$values, tree[[2]]$node$values), 1, mean ) Assembling your data in a data.frame prior to using an *pply function would eliminate the need to write them all by hand. Regards Liviu __ 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] dataframe of dataframes?
You can create an empty matrix (or even array) of list elements and then assign your data frames to whichever element you want. Example: # Allocate empty matrix... x - matrix(list(), nrow=2, ncol=3); # ...alternatively x - array(list(), dim=c(2,3)); print(x); [,1] [,2] [,3] [1,] NULL NULL NULL [2,] NULL NULL NULL To assign a data frame to one of the elements, make sure to use double bracket notation, e.g. x[[1,1]] - data.frame(a=1, b=2:4); x[[1,2]] - data.frame(c=2:3); x[[2,3]] - data.frame(x=1, y=2:4); print(x); [,1] [,2] [,3] [1,] List,2 List,1 NULL [2,] NULL NULL List,2 Same is needed to extract an element, e.g. str(x[[2,3]]); 'data.frame': 3 obs. of 2 variables: $ x: num 1 1 1 $ y: int 2 3 4 Compare with: str(x[2,3]); List of 1 $ :'data.frame': 3 obs. of 2 variables: ..$ x: num [1:3] 1 1 1 ..$ y: int [1:3] 2 3 4 str(x[1,]); List of 3 $ :'data.frame': 3 obs. of 2 variables: ..$ a: num [1:3] 1 1 1 ..$ b: int [1:3] 2 3 4 $ :'data.frame': 2 obs. of 1 variable: ..$ c: int [1:2] 2 3 $ : NULL My $.02 /Henrik On Mon, Sep 13, 2010 at 11:18 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: raje...@cse.iitm.ac.in wrote: Hi, I create several dataframes in a nested loop and would like to maintain them in a matrix form with each dataframe represented by the row and the column. How can I do this? You can't, at least as you describe it. However, you can add a column for row ID and a column for column ID to each of your result data frames and rbind them together. It is also possible to create lists of lists... but I believe the single augmented dataframe will be way more useful in the long run. __ 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] solve integrate(,..) varying limits of integration
Dear List, Is there a way to solve integrate(func.1,x, Inf) $value =0.05 by varying the lower limit of integration (x in the example above)? So far I got: r- 0.730163 s--2 func.1- function(t) {1/(2*pi*sqrt(1-r^2))*exp(-1/(2*(1-r^2))*(s^2-2*r*s*t+t^2))} I can change the lower limit manually, like: integrate(func.1, -2.5, Inf) $value [1] 0.05053265 integrate(func.1, -2.4, Inf) $value [1] 0.04942731 integrate(func.1, -2.45, Inf) $value [1] 0.05000923 but this is very time-consuming. So I was wondering if there is a better, preferably an automated way to solve the equation? Thanks, Tonja ___ Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02 __ 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] Object oriented programming in R.
Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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] solve integrate(,..) varying limits of integration
have a look at uniroot(), e.g., ff - function (low, r, s) { f - function (t, r, s) { exp(-(s^2 - 2*r*s*t + t^2) / (2*(1-r^2))) / (2*pi*sqrt(1-r^2)) } integrate(f, low, Inf, r = r, s = s)$value - 0.05 } uniroot(ff, c(-3, -2), r = 0.730163, s = -2)$root I hope it helps. Best, Dimitris On 9/14/2010 9:15 AM, Tonja Krueger wrote: Dear List, Is there a way to solve integrate(func.1,x, Inf) $value =0.05 by varying the lower limit of integration (x in the example above)? So far I got: r- 0.730163 s--2 func.1- function(t) {1/(2*pi*sqrt(1-r^2))*exp(-1/(2*(1-r^2))*(s^2-2*r*s*t+t^2))} I can change the lower limit manually, like: integrate(func.1, -2.5, Inf) $value [1] 0.05053265 integrate(func.1, -2.4, Inf) $value [1] 0.04942731 integrate(func.1, -2.45, Inf) $value [1] 0.05000923 but this is very time-consuming. So I was wondering if there is a better, preferably an automated way to solve the equation? Thanks, Tonja ___ Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02 __ 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. -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 __ 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] Object oriented programming in R.
Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+RDid you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Tue, Sep 14, 2010 at 9:20 AM, Alaios ala...@yahoo.com wrote: Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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] How to uncompress a gz file in R
Dear Fellows, I would like to know how to uncompress a gz file at the R console. I could not find out any help from the R-help archive. Thanks for your great help. Best Regards, Wonsang You - -- Wonsang You Special Lab Non-Invasive Brain Imaging Leibniz Institute for Neurobiology http://www.ifn-magdeburg.de -- View this message in context: http://r.789695.n4.nabble.com/How-to-uncompress-a-gz-file-in-R-tp2538669p2538669.html Sent from the R help mailing list archive at Nabble.com. [[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] How to uncompress a gz file in R
See ?gzfile Uwe Ligges On 14.09.2010 11:02, Wonsang You wrote: Dear Fellows, I would like to know how to uncompress a gz file at the R console. I could not find out any help from the R-help archive. Thanks for your great help. Best Regards, Wonsang You - -- Wonsang You Special Lab Non-Invasive Brain Imaging Leibniz Institute for Neurobiology http://www.ifn-magdeburg.de __ 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] The future of R - Ross Ihaka stirs discussions around the web
On 14.09.2010 04:02, Spencer Graves wrote: Hello: On 9/13/2010 3:44 PM, Vojtěch Zeisek wrote: Hello Dne Po 13. zářà 2010 14:51:39 Tal Galili napsal(a): snip But here, I wish point out one issue, which can be fixed relatively easily: R would deserve much more better web running some good open-source CMS. I have very good experince with Drupal (IMHO the best available CMS) and Plone. Current state is one big dissaster. Web with all modern features, user forum and so on. It would be really helpful. Please excuse my ignorance: I'm not familiar with CMS, wether Drupal, Plone or anything else. What disaster do you perceive? I'm too stupid and blind to even see it. ... and that is also true for probably all CRAN maintainers. I think nobody is going to bother with these CMS systems. I had to for our department and I feel almost unable to maintain my own website now that it is impossible to quickly change some html code via a low-bandwidth ssh connection as I was used to before. Uwe Spencer Best regards, __ 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] xyplot legends
On 2010-09-13 17:45, array chip wrote: Thanks David. It almost does what I wanted, except it's plotting the point characters 3 time for each line (left, middle and right): o---o---o I can live with that if there is no way to get rid of the point characters at the ends. You can add the 'divide=' argument to key(): key(divide = 1, etc) See the 'key' section in ?xyplot. -Peter Ehlers Thanks very much! John - Original Message From: David Winsemiusdwinsem...@comcast.net To: array chiparrayprof...@yahoo.com Cc: r-help@r-project.org Sent: Mon, September 13, 2010 4:05:04 PM Subject: Re: [R] xyplot legends On Sep 13, 2010, at 6:25 PM, array chip wrote: Hi all, I When I plot both lines and points using type=c('l', 'p') in xyplot(), if I want to include in legend both of them using keys=list(lines=list(col=1:3), points=list(pch=1:3)), the lines and points are plotted side by side in legend. Is there anyway to plot the points in the middle of the lines instead? It's key, not keys See if this is closer to what you had in mind: key=list(type=o, lines=list(col=1:3,pch=1:3, size=4 ) that is the default is plotting like this: - o but I want something like this: ---o--- The best I could do was: -o--o--o- --David Winsemius, MD West Hartford, CT __ 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] Problem (environment?) with R CMD CHECK
I do not see any problem, we'd need to look at the package in order to help, I think. Best, Uwe Ligges On 14.09.2010 00:20, Peter Langfelder wrote: Hi all, I have a package that contains a function foo that calls a function .fooInternal via match.fun('.fooInternal'). This step is necessary because I want to give the user an option to override .fooInternal with a custom function. The .fooInternal function name is not exported. The function foo runs perfectly well when used in a normal R session. However, the function fails the R CMD CHECK command with the error Error in get(as.character(FUN), mode = function, envir = envir) : object '.fooInternal' of mode 'function' was not found I'm wondering if this is some environment misspecification issue? I also tried replacing .fooInternal by packageName:::.fooInternal (replacing packageName with actual package name, of course), to no avail. Thanks in advance for all replies. Peter __ 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] Specify a minimum number of valid arguments for the mean function
On 13.09.2010 17:43, Luana Marotta wrote: Hello all, I want to specify a minimum number of valid arguments for the mean function--I have 5 variables but I want the mean only of cases that have at least 3 valid answers. What is the best way to do that? If your 5 variables are in a data.frame dat: sapply(dat, function(x) if(sum(!is.na(x)) 2) mean(x) else NA) Uwe Ligges Thank you very much! Luana [[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] Transparent Labels for Polar Plot
On 09/14/2010 06:25 AM, James MacCarthy wrote: Hello, I am currently using the polar.plot function in the plotrix package to graph data. Unfortunately, it seems that the default for the labels is to have a background color that is covering the line representing my data, making it difficult to read. Is there a way to make this label background transparent? Hi Jimmy, The easiest way is to change the following lines near the bottom of the radial.plot function: boxed.labels(grid.pos-radial.lim[1],ypos,radial.labels,border=FALSE, cex=par(cex.lab)) to text(grid.pos-radial.lim[1],ypos,radial.labels,cex=par(cex.lab)) If this is a Good Idea, I'll add an option to do one or the other. Jim __ 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] Homogeneity of regression slopes
Hi Thomas, Thanks for the additional information. Just wondering, and hoping to learn ... would any lack of homogeneity of variance (which is what I believe you mean by different stddev estimates) be found when performing standard regression diagnostics, such as residual plots, Levene's test (or equivalent), etc.? If so, then would a WLS routine or some type of variance stabilizing transformation be useful? Again, hoping to learn. I'll check out the gls() routine in the nlme package, as you mentioned. Thanks. Cliff On Mon, Sep 13, 2010 at 10:02 PM, Thomas Stewart tgstew...@gmail.comwrote: Allow me to add to Michael's and Clifford's responses. If you fit the same regression model for each group, then you are also fitting a standard deviation parameter for each model. The solution proposed by Michael and Clifford is a good one, but the solution assumes that the standard deviation parameter is the same for all three models. You may want to consider the degree by which the standard deviation estimates differ for the three separate models. If they differ wildly, the method described by Michael and Clifford may not be the best. Rather, you may want to consider gls() in the nlme package to explicitly allow the variance parameters to vary. -tgs On Mon, Sep 13, 2010 at 4:52 PM, Doug Adams f...@gmx.com wrote: Hello, We've got a dataset with several variables, one of which we're using to split the data into 3 smaller subsets. (as the variable takes 1 of 3 possible values). There are several more variables too, many of which we're using to fit regression models using lm. So I have 3 models fitted (one for each subset of course), each having slope estimates for the predictor variables. What we want to find out, though, is whether or not the overall slopes for the 3 regression lines are significantly different from each other. Is there a way, in R, to calculate the overall slope of each line, and test whether there's homogeneity of regression slopes? (Am I using that phrase in the right context -- comparing the slopes of more than one regression line rather than the slopes of the predictors within the same fit.) I hope that makes sense. We really wanted to see if the predicted values at the ends of the 3 regression lines are significantly different... But I'm not sure how to do the Johnson-Neyman procedure in R, so I think testing for slope differences will suffice! Thanks to any who may be able to help! Doug Adams __ 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. [[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] Problem with cat()
Dear all, I have a problem with the cat() function. Let say I have following: fn1 - function(n = 5){ mat - matrix(rnorm(5*5), 5, 5) cat(as.character(mat)) return(n) } However when I run above function I get this: fn1() -0.601930631438248 -1.16950049447942 0.469257329394626 -1.39766868242906 -1.02580943892082 1.4067931110327 -1.07245318857022 -0.0205043699310245 0.234628727206755 2.20623115088835 0.689246510169205 0.390165590650482 1.16264636627546 -1.26460050014308 -0.0618394808642369 1.55065748588694 -1.09179651631271 1.77868450520847 1.56281762714862 -0.0428547138289468 -1.5041448417776 0.221592557337622 -1.91535929883353 -0.712994991755814 -0.440738636680476[1] 5 How can I preserve the matrix format while printing? Thanks, __ 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] Problem with cat()
Hello, If it does not *have* to be cat(), this would work: fn1 - function(n = 5){ mat - matrix(rnorm(5*5), 5, 5) print(mat) return(n) } Cheers, Josh On Tue, Sep 14, 2010 at 4:00 AM, Christofer Bogaso bogaso.christo...@gmail.com wrote: Dear all, I have a problem with the cat() function. Let say I have following: fn1 - function(n = 5){ mat - matrix(rnorm(5*5), 5, 5) cat(as.character(mat)) return(n) } However when I run above function I get this: fn1() -0.601930631438248 -1.16950049447942 0.469257329394626 -1.39766868242906 -1.02580943892082 1.4067931110327 -1.07245318857022 -0.0205043699310245 0.234628727206755 2.20623115088835 0.689246510169205 0.390165590650482 1.16264636627546 -1.26460050014308 -0.0618394808642369 1.55065748588694 -1.09179651631271 1.77868450520847 1.56281762714862 -0.0428547138289468 -1.5041448417776 0.221592557337622 -1.91535929883353 -0.712994991755814 -0.440738636680476[1] 5 How can I preserve the matrix format while printing? Thanks, __ 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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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 install in Fedora
Dear All I was trying to install R-2.10.0-2.fc11.X86 in Fedora-13-i386 but it makes error. Could you please tell me which is the exact version of R for Fedora 13. Thanks in advance Kind Regards Wesley [[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] Content analysis
Dear all, I planning to carry out a content analysis in R but I don't know which package to use. I tried rqda (http://rqda.r-forge.r-project.org/index.html) but it doesn't help. Any suggestion will be appreciated. Christian [[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] dataframe of dataframes?
This is great. Thanks - Original Message - From: Henrik Bengtsson h...@stat.berkeley.edu To: Jeff Newmiller jdnew...@dcn.davis.ca.us Cc: raje...@cse.iitm.ac.in, r-help r-help@r-project.org Sent: Tue, 14 Sep 2010 12:27:38 +0530 (IST) Subject: Re: [R] dataframe of dataframes? You can create an empty matrix (or even array) of list elements and then assign your data frames to whichever element you want. Example: # Allocate empty matrix... x - matrix(list(), nrow=2, ncol=3); # ...alternatively x - array(list(), dim=c(2,3)); print(x); [,1] [,2] [,3] [1,] NULL NULL NULL [2,] NULL NULL NULL To assign a data frame to one of the elements, make sure to use double bracket notation, e.g. x[[1,1]] - data.frame(a=1, b=2:4); x[[1,2]] - data.frame(c=2:3); x[[2,3]] - data.frame(x=1, y=2:4); print(x); [,1] [,2] [,3] [1,] List,2 List,1 NULL [2,] NULL NULL List,2 Same is needed to extract an element, e.g. str(x[[2,3]]); 'data.frame': 3 obs. of 2 variables: $ x: num 1 1 1 $ y: int 2 3 4 Compare with: str(x[2,3]); List of 1 $ :'data.frame': 3 obs. of 2 variables: ..$ x: num [1:3] 1 1 1 ..$ y: int [1:3] 2 3 4 str(x[1,]); List of 3 $ :'data.frame': 3 obs. of 2 variables: ..$ a: num [1:3] 1 1 1 ..$ b: int [1:3] 2 3 4 $ :'data.frame': 2 obs. of 1 variable: ..$ c: int [1:2] 2 3 $ : NULL My $.02 /Henrik On Mon, Sep 13, 2010 at 11:18 PM, Jeff Newmiller wrote: raje...@cse.iitm.ac.in wrote: Hi, I create several dataframes in a nested loop and would like to maintain them in a matrix form with each dataframe represented by the row and the column. How can I do this? You can't, at least as you describe it. However, you can add a column for row ID and a column for column ID to each of your result data frames and rbind them together. It is also possible to create lists of lists... but I believe the single augmented dataframe will be way more useful in the long run. __ 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.
Re: [R] Object oriented programming in R.
Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R Did you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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] question on staRt package
Dear Sirs, I have been using the package staRt but it has disappeared from the latest R versions. I emailed the author but he never replied. Is it possible to let me know if that package has been removed or if it has been replaced by another or what happened? The latest version is 1.1.12. I would like to know if I can keep using it or not. If it has been permanently removed, I should look for an alternative. Thank you very much Paulo Teles __ 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] Object oriented programming in R.
On Tue, Sep 14, 2010 at 12:55 PM, Alaios ala...@yahoo.com wrote: Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Is this what you need? for(i in 1:100){ assign(paste('tmp', i, sep=''), NULL) } ls() Liviu __ 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] xyplot axis line width
On Tue, Sep 14, 2010 at 4:26 AM, array chip arrayprof...@yahoo.com wrote: Hi, another question: is there any argument that controls the line width of axis box of xyplot()? I tried lwd=2 or lwd.axis=2 in xyplot() or within scales=list() argument, without success. xyplot(1:10 ~ 1:10, par.settings = list(axis.line = list(lwd = 2))) If you do not want this to affect the tick marks as well, then you additionally need scales = list(lwd = 1) -Deepayan __ 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] lattice package - wireframe plot : adding more than one surface and addiding a curve overlaid on the plot
On Sat, Sep 11, 2010 at 2:28 AM, Raffaello Vardavas r_varda...@hotmail.com wrote: Dear R help, Suppose I have a dataframe with three columns named p, v and C. Here C is a function of both p and v. I can plot the surface C(p,v) using the package lattice using the function wireframe. Now if I have another dataframe - with 2 columns named p_ind and v_ind and pind is a function of v_ind. I would like to overlay the plot of the curve p_ind, v_ind and C(p_ind, v_ind) onto my previous plot. I haven't found a way to do this. This is going to be fairly difficult with lattice. I would suggest trying the rgl package instead. -Deepayan __ 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] splines package (problem finding it)
On 14.09.2010 13:25, stephen sefick wrote: I can not install the splines package. Has it been removed/moved from/on CRAN? kindest regards, It should come with R since it is a base package. Uwe Ligges __ 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] Object oriented programming in R.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 14/09/10 13:51, Liviu Andronic wrote: On Tue, Sep 14, 2010 at 12:55 PM, Alaios ala...@yahoo.com wrote: Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Is this what you need? for(i in 1:100){ assign(paste('tmp', i, sep=''), NULL) } ls() Liviu __ 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. look at ?rep: x - rep(list(createTheObject(), 10) x will be a list containing 10 times the object created by createTheObject() Cheers, Rainer - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Natural Sciences Building Office Suite 2039 Stellenbosch University Main Campus, Merriman Avenue Stellenbosch South Africa Tel:+33 - (0)9 53 10 27 44 Cell: +27 - (0)8 39 47 90 42 Fax (SA): +27 - (0)8 65 16 27 82 Fax (D) : +49 - (0)3 21 21 25 22 44 Fax (FR): +33 - (0)9 58 10 27 44 email: rai...@krugs.de Skype: RMkrug -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyPY0kACgkQoYgNqgF2egr5hQCePJ+20z2d64SPVOtIFxv7dmBs ASwAnAhQbm4snJFqYj1dOn2w6NSRLIC+ =wuQC -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] Object oriented programming in R.
Hello, I think you will have to specify your requirements (or at least area of interest) in much greater detail to get any very meaningful input from people here. Meanwhile there are countless examples of object-oriented programming using R on the web complete with code. Michael On 14 September 2010 19:55, Alaios ala...@yahoo.com wrote: Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex __ 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] average matrices across a list
Gregory Ryslik rsaber at comcast.net writes: mymats - vector('list', 5) set.seed(246) # Generate a list of five 3 x 3 matrices for(i in 1:5) mymats[[i]] - matrix(sample(1:9), nrow = 3) mymats[[5]][1,1]-NA mymats[[4]][2,2]-NA mymats matrixadder-function(u,v){ na.u-is.na(u) na.v-is.na(v) ifelse(na.u na.v, NA, ifelse(na.u, 0, u)+ ifelse(na.v,0,v)) } Reduce('matrixadder',mymats) I was going to suggest that my solution would be faster, but it turns out to be slower (!) -- 11 seconds vs 6 seconds for 10,000 replications. It's cleverer, but I don't know if that's really a virtue. library(abind) apply(do.call(abind,c(mymats,list(along=3))),c(1,2),sum,na.rm=TRUE) system.time(replicate(1, apply(do.call(abind,c(mymats,list(along=3))), c(1,2),sum,na.rm=TRUE))) __ 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] Object oriented programming in R.
It depends on what you mean by objects. If you are just looking at creating many named variables that are going to hold values (e.g., reading in data from several files that you want to correlate separately), then consider the use of 'lists'. Can you provide a little more detail on exactly the problem that you are trying to solve, and then maybe we can propose a solution. On Tue, Sep 14, 2010 at 5:55 AM, Alaios ala...@yahoo.com wrote: Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R Did you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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. -- 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.
Re: [R] Object oriented programming in R.
Here are some more information: I would like to create some agents that span over a specific area map.Every agent needs to have its own data structures like one or two matrices and one list. I think that the best way to do this is to create objects and every instance of an object will be used for a single agent. The number of agents is not predetermined and it varies for any execution. So I read this value from the command line interface and then I would like to initiate so many objects as the agents. I think that the best way to do that is to create using a for loop a list containing as many objects as the agents are. I would like to thank you in advance for your help Best Regards Alex From: jim holtman jholt...@gmail.com Cc: Tal Galili tal.gal...@gmail.com; Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 1:40:37 PM Subject: Re: [R] Object oriented programming in R. It depends on what you mean by objects. If you are just looking at creating many named variables that are going to hold values (e.g., reading in data from several files that you want to correlate separately), then consider the use of 'lists'. Can you provide a little more detail on exactly the problem that you are trying to solve, and then maybe we can propose a solution. Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R R Did you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- - Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[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] TimeStamp
On 06.09.2010 03:51, Roberto Badilla Fuentes wrote: Hi, I have a dataset in .dbf format. It contains Coordinates and Time. The TIMESTAMP is as follows: 03/18/2006 13:30:37 I am not working with the TIMESTAMP column, but when I print out my manipulated dataset using *write.dbf* I get the value *390 *where the TIMESTAMP value should be. Can Anyone help me out why R does this and how I can correct it. Probably the timestamp was read in as a factor. Use as.character() followed by, e.g., strptime() to convert it to a time format. Best, Uwe Ligges Thanks -Roberto [[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] question on staRt package
On 14.09.2010 12:25, Paulo Teles wrote: Dear Sirs, I have been using the package staRt but it has disappeared from the latest R versions. I emailed the author but he never replied. Is it possible to let me know if that package has been removed or if it has been replaced by another or what happened? The latest version is 1.1.12. I would like to know if I can keep using it or not. If it has been permanently removed, I should look for an alternative. I cannot remember the reason why this has been archived. If it was not due to a maintainer's request to do so, then probably because the package does not pass checks OK any more and the maintainer was unresponsive. In any case, you can get the old source package from the archives and install and check it yourself. Since the package is GPL 2 according to the DESCRIPTION file, you could take over maintainership and submit a new version to CRAN. Best, Uwe Ligges Thank you very much Paulo Teles __ 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] R install in Fedora
On Sep 14, 2010, at 6:14 AM, wesley mathew wrote: Dear All I was trying to install R-2.10.0-2.fc11.X86 in Fedora-13-i386 but it makes error. Could you please tell me which is the exact version of R for Fedora 13. Thanks in advance Kind Regards Wesley The current R version for F13 is R-2.11.1-3.fc13: https://admin.fedoraproject.org/updates/R-2.11.1-3.fc13 You can install R from the CLI by using: yum install R as root. For any additional Fedora specific queries, please note that there is a R-SIG-Fedora list: https://stat.ethz.ch/mailman/listinfo/r-sig-fedora If you continue to have problems, please be sure to include the error message(s) that you get in your post. HTH, Marc Schwartz __ 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] average matrices across a list
You can try this also: Reduce('+', lapply(mymats, function(x)replace(x, is.na(x), 0))) On Sun, Sep 12, 2010 at 10:36 PM, Gregory Ryslik rsa...@comcast.net wrote: Hi Everyone, Thanks to everyone for their help. With your suggestions and some poking around, the following works for what I need. It basically adds all the matrices elementwise, and adds nothing if the element is NA. Thanks again! Code below: ** mymats - vector('list', 5) set.seed(246) # Generate a list of five 3 x 3 matrices for(i in 1:5) mymats[[i]] - matrix(sample(1:9), nrow = 3) mymats[[5]][1,1]-NA mymats[[4]][2,2]-NA mymats matrixadder-function(u,v){ na.u-is.na(u) na.v-is.na(v) ifelse(na.u na.v, NA, ifelse(na.u, 0, u)+ ifelse(na.v,0,v)) } Reduce('matrixadder',mymats) ** Cheers, Greg On Sep 12, 2010, at 8:33 PM, Ben Bolker wrote: My next suggestion (I don't have time to work out or test an example at the moment): library(abind) tmparr - abind(m1,m2,m3,...,along=3) OR tmparr - do.call(c(matlist,list(along=3))) apply(tmparr,c(1,2),mean,na.rm=TRUE) or something along those lines. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] Unable to do a post hoc test after Friedman's
I have R version 2.11.1 I am able to run a Friedman.test, but cant do further post.hoc test. Tried running friedman.test.with.post.hocetc It comes with Error: object 'friedman.test.with.post.hoc' not found This is after loading the packages coin and multcomp Could anyone please send in any suggestions how to ratify? -- View this message in context: http://r.789695.n4.nabble.com/Unable-to-do-a-post-hoc-test-after-Friedman-s-tp2538817p2538817.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] splines package (problem finding it)
I can not install the splines package. Has it been removed/moved from/on CRAN? kindest regards, -- Stephen Sefick | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849 | |___| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis A big computer, a complex algorithm and a long time does not equal science. -Robert Gentleman __ 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 compute when row length is different
hi guys..please help me with this i am working on two data frames one goes like this: DF1 Sample_id RepairHours Denatured Dose ZeroMean FourtyFiveMean NinetyMean 1 SDM071 0 1B 60.5 19.0 45.0 2 SDM071 1 1B 46.0 23.0 42.5 3 SDM071 2 1B 52.5 24.0 40.0 4 SDM071 3 1B 42.0 21.5 45.0 5 SDM053 0 1B 66.5 28.5 56.5 6 SDM053 1 1B 47.0 29.0 47.5 7 SDM053 2 1B 52.0 31.0 44.0 8 SDM053 3 1B 36.0 34.0 41.5 9 SDM059 0 1B 47.5 41.5 29.0 10SDM059 1 1B 47.0 36.0 35.0 11SDM059 2 1B 41.5 42.0 32.5 12SDM059 3 1B 46.5 41.5 32.0 and the other one: DF2 SampleId RepairHours Denatured Dose_uM Day_0_Read1 Day_0_Read2 Day_45_Read1 8SDM071 0 1 C 124 120 108 9SDM071 0 1 25 123 128 77 10 SDM071 0 1 50 132 138 79 11 SDM071 0 1 100 118 116 68 12 SDM071 0 1 200 125 146 73 20 SDM071 1 1 C 113 117 113 21 SDM071 1 1 25 108 115 132 22 SDM071 1 1 50 105 96 94 23 SDM071 1 1 100 101 101 88 24 SDM071 1 1 200 114 106 89 32 SDM071 2 1 C 143 136 109 33 SDM071 2 1 25 126 147 110 34 SDM071 2 1 50 109 122 107 35 SDM071 2 1 100 114 118 89 36 SDM071 2 1 200 118 128 88 44 SDM071 3 1 C 103 111 116 45 SDM071 3 1 25 108 105 115 46 SDM071 3 1 50 118 99 88 47 SDM071 3 1 100 98 103 105 48 SDM071 3 1 200 112 105 96 56 SDM053 0 1 C 214 208 158 57 SDM053 0 1 25 159 214 178 58 SDM053 0 1 50 170 169 112 59 SDM053 0 1 100 149 158 124 60 SDM053 0 1 200 201 171 115 68 SDM053 1 1 C 149 166 120 69 SDM053 1 1 25 145 134 118 70 SDM053 1 1 50 159 169 130 71 SDM053 1 1 100 113 126 110 72 SDM053 1 1 200 118 112 120 these are just part of the frames.. i have to subtract the first five values of dataframe2 from one value from dataframe1 eg: subtract-DF2$Day_0_Read1-DF1$ ZeroMean if u notice the repair hours in both have to match...along with their id's. i have tried this zeroday_subtract1=DF1$Day_0_Read1 - DF2[DF1$RepairHours,]$ZeroMean but it dosent work please help me with this...i know its basic but i needhelp thx in advance -- View this message in context: http://r.789695.n4.nabble.com/how-to-compute-when-row-length-is-different-tp2538930p2538930.html Sent from the R help mailing list archive at Nabble.com. [[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] Sweave and Miktex (Sweave.sty not found)
Hi all, I know from googling that this is a common problem; I've just tried what I understand to be the common solutions to know avail -- maybe I'm just confused. I installed Miktex 2.8 -- it seems to be working fine. I'm using this demo document: http://www.stat.berkeley.edu/~houston/demo.Rnw I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? Thanks! [[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] NA confusion (length question)
Hi folks, I am running a very simple regression using mylm - lm(mass ~ tarsus, na.action=na.exclude) I would like the use the residuals from this analysis for more regression but I'm running into a snag when I try cbind(mylm$residuals, mydata) # where my data is the original data set The error tells me that it cannot use cbind because the length of mylm$residuals is 50 and mydata is 52. This makes sense except I thought that na.exclude preserves length by inserting NA in residuals where there were NA's in the orginal data ( i = 3, 20). When I ask to see the residuals( mylm$residuals) I see 52 numbers. How can this be? I am just looking to see how I can produce a third vector with length = 52 and NA's for i=3,20. I'm using R 2.11.1 on Windows XP and the data are below Many thanks, Jeff tarsus mass 21.5 23.2 21.8 22.6 20.9 NA 21.6 20.8 21.5 21.5 22 23.2 21.6 23 22.1 21 21.1 21 20.6 22.9 20.1 21.8 22.2 20.4 21.9 21.5 21.1 21.3 21.5 20.1 19.9 21.4 22.1 27.3 20.1 19.7 19.6 16.7 20.9 NA 20.1 21.7 21.8 22.3 20.9 21.1 21.6 20.8 22.4 20.5 21.4 20.4 21.4 21 21.6 21 21.2 23.3 21.1 21.9 22 21 22.2 21.5 20.6 20.6 21.3 20.5 20.6 20.5 21.4 20.8 21.8 21.4 21.6 19.6 22.4 24.3 21.7 20.3 21.4 21.3 20.7 18.2 21.3 20.9 21.7 20.7 22.6 20 22 23 18.4 20 20.1 20.6 19.8 19.1 21.1 26.3 19.8 22.3 21.2 22.2 19.5 20.6 19.7 22.7 Jeffrey A. Stratford Department of Health and Biological Sciences 84 W. South Street Wilkes University, PA 18766 jeffrey.stratf...@wilkes.edu 570-408-4761 (office) 570-332-2942 (cell) http://web.wilkes.edu/jeffrey.stratford/ [[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] Object oriented programming in R.
Hi: You could create a list of lists, where the outer list would be between agents and the inner list within agents. The inner list could have the 'matrices and one list' as separate components for each agent. Of course, you would have to be able to keep all of this straight :) HTH, Dennis On Tue, Sep 14, 2010 at 5:00 AM, Alaios ala...@yahoo.com wrote: Here are some more information: I would like to create some agents that span over a specific area map.Every agent needs to have its own data structures like one or two matrices and one list. I think that the best way to do this is to create objects and every instance of an object will be used for a single agent. The number of agents is not predetermined and it varies for any execution. So I read this value from the command line interface and then I would like to initiate so many objects as the agents. I think that the best way to do that is to create using a for loop a list containing as many objects as the agents are. I would like to thank you in advance for your help Best Regards Alex From: jim holtman jholt...@gmail.com Cc: Tal Galili tal.gal...@gmail.com; Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 1:40:37 PM Subject: Re: [R] Object oriented programming in R. It depends on what you mean by objects. If you are just looking at creating many named variables that are going to hold values (e.g., reading in data from several files that you want to correlate separately), then consider the use of 'lists'. Can you provide a little more detail on exactly the problem that you are trying to solve, and then maybe we can propose a solution. Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R R Did you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- - Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[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. [[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] How to uncompress a gz file in R
To uncompress an *.gz file into another file on disk, see also ?gunzip in the R.utils package. /Henrik 2010/9/14 Uwe Ligges lig...@statistik.tu-dortmund.de: See ?gzfile Uwe Ligges On 14.09.2010 11:02, Wonsang You wrote: Dear Fellows, I would like to know how to uncompress a gz file at the R console. I could not find out any help from the R-help archive. Thanks for your great help. Best Regards, Wonsang You - -- Wonsang You Special Lab Non-Invasive Brain Imaging Leibniz Institute for Neurobiology http://www.ifn-magdeburg.de __ 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] average matrices across a list
Hi: It's certainly fast (0.97s for 1 reps on my box), but doesn't replacement by zero affect the denominator of the sum, thereby deflating the means (assuming the contents of the matrices are nonnegative or NA)? Dennis On Tue, Sep 14, 2010 at 5:28 AM, Henrique Dallazuanna www...@gmail.comwrote: You can try this also: Reduce('+', lapply(mymats, function(x)replace(x, is.na(x), 0))) On Sun, Sep 12, 2010 at 10:36 PM, Gregory Ryslik rsa...@comcast.net wrote: Hi Everyone, Thanks to everyone for their help. With your suggestions and some poking around, the following works for what I need. It basically adds all the matrices elementwise, and adds nothing if the element is NA. Thanks again! Code below: ** mymats - vector('list', 5) set.seed(246) # Generate a list of five 3 x 3 matrices for(i in 1:5) mymats[[i]] - matrix(sample(1:9), nrow = 3) mymats[[5]][1,1]-NA mymats[[4]][2,2]-NA mymats matrixadder-function(u,v){ na.u-is.na(u) na.v-is.na(v) ifelse(na.u na.v, NA, ifelse(na.u, 0, u)+ ifelse(na.v,0,v)) } Reduce('matrixadder',mymats) ** Cheers, Greg On Sep 12, 2010, at 8:33 PM, Ben Bolker wrote: My next suggestion (I don't have time to work out or test an example at the moment): library(abind) tmparr - abind(m1,m2,m3,...,along=3) OR tmparr - do.call(c(matlist,list(along=3))) apply(tmparr,c(1,2),mean,na.rm=TRUE) or something along those lines. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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. [[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] NA confusion (length question)
Hi Jeffrey, As a bit of a side note, data copied in html emails tends to show up poorly (since emails to the list are converted to plain text). Anyways, note the difference between: length(mylm$residuals) length(residuals(mylm)) Accessing the residuals value from mylm is *not* quite the same as calling the residuals() function on mylm. So, if you use: cbind(residuals(mylm), mydata) you should be good. Hope that helps, Josh On Tue, Sep 14, 2010 at 6:20 AM, Stratford, Jeffrey jeffrey.stratf...@wilkes.edu wrote: Hi folks, I am running a very simple regression using mylm - lm(mass ~ tarsus, na.action=na.exclude) I would like the use the residuals from this analysis for more regression but I'm running into a snag when I try cbind(mylm$residuals, mydata) # where my data is the original data set The error tells me that it cannot use cbind because the length of mylm$residuals is 50 and mydata is 52. This makes sense except I thought that na.exclude preserves length by inserting NA in residuals where there were NA's in the orginal data ( i = 3, 20). When I ask to see the residuals( mylm$residuals) I see 52 numbers. How can this be? I am just looking to see how I can produce a third vector with length = 52 and NA's for i=3,20. I'm using R 2.11.1 on Windows XP and the data are below Many thanks, Jeff tarsus mass 21.5 23.2 21.8 22.6 20.9 NA 21.6 20.8 21.5 21.5 22 23.2 21.6 23 22.1 21 21.1 21 20.6 22.9 20.1 21.8 22.2 20.4 21.9 21.5 21.1 21.3 21.5 20.1 19.9 21.4 22.1 27.3 20.1 19.7 19.6 16.7 20.9 NA 20.1 21.7 21.8 22.3 20.9 21.1 21.6 20.8 22.4 20.5 21.4 20.4 21.4 21 21.6 21 21.2 23.3 21.1 21.9 22 21 22.2 21.5 20.6 20.6 21.3 20.5 20.6 20.5 21.4 20.8 21.8 21.4 21.6 19.6 22.4 24.3 21.7 20.3 21.4 21.3 20.7 18.2 21.3 20.9 21.7 20.7 22.6 20 22 23 18.4 20 20.1 20.6 19.8 19.1 21.1 26.3 19.8 22.3 21.2 22.2 19.5 20.6 19.7 22.7 Jeffrey A. Stratford Department of Health and Biological Sciences 84 W. South Street Wilkes University, PA 18766 jeffrey.stratf...@wilkes.edu 570-408-4761 (office) 570-332-2942 (cell) http://web.wilkes.edu/jeffrey.stratford/ [[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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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] how to compute when row length is different
DF3 - merge(DF1, DF2, by=c(Sample_id, RepairHours), all.y=T) DF3$subtract - DF3$Day_0_Read1-DF3$ ZeroMean Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina nikhil.l...@gmail.com On Sep 14, 2010, at 8:38 AM, rasanpreet wrote: hi guys..please help me with this i am working on two data frames one goes like this: DF1 Sample_id RepairHours Denatured Dose ZeroMean FourtyFiveMean NinetyMean 1 SDM071 0 1B 60.5 19.0 45.0 2 SDM071 1 1B 46.0 23.0 42.5 3 SDM071 2 1B 52.5 24.0 40.0 4 SDM071 3 1B 42.0 21.5 45.0 5 SDM053 0 1B 66.5 28.5 56.5 6 SDM053 1 1B 47.0 29.0 47.5 7 SDM053 2 1B 52.0 31.0 44.0 8 SDM053 3 1B 36.0 34.0 41.5 9 SDM059 0 1B 47.5 41.5 29.0 10SDM059 1 1B 47.0 36.0 35.0 11SDM059 2 1B 41.5 42.0 32.5 12SDM059 3 1B 46.5 41.5 32.0 and the other one: DF2 SampleId RepairHours Denatured Dose_uM Day_0_Read1 Day_0_Read2 Day_45_Read1 8SDM071 0 1 C 124 120 108 9SDM071 0 1 25 123 128 77 10 SDM071 0 1 50 132 138 79 11 SDM071 0 1 100 118 116 68 12 SDM071 0 1 200 125 146 73 20 SDM071 1 1 C 113 117 113 21 SDM071 1 1 25 108 115 132 22 SDM071 1 1 50 105 96 94 23 SDM071 1 1 100 101 101 88 24 SDM071 1 1 200 114 106 89 32 SDM071 2 1 C 143 136 109 33 SDM071 2 1 25 126 147 110 34 SDM071 2 1 50 109 122 107 35 SDM071 2 1 100 114 118 89 36 SDM071 2 1 200 118 128 88 44 SDM071 3 1 C 103 111 116 45 SDM071 3 1 25 108 105 115 46 SDM071 3 1 50 118 99 88 47 SDM071 3 1 100 98 103 105 48 SDM071 3 1 200 112 105 96 56 SDM053 0 1 C 214 208 158 57 SDM053 0 1 25 159 214 178 58 SDM053 0 1 50 170 169 112 59 SDM053 0 1 100 149 158 124 60 SDM053 0 1 200 201 171 115 68 SDM053 1 1 C 149 166 120 69 SDM053 1 1 25 145 134 118 70 SDM053 1 1 50 159 169 130 71 SDM053 1 1 100 113 126 110 72 SDM053 1 1 200 118 112 120 these are just part of the frames.. i have to subtract the first five values of dataframe2 from one value from dataframe1 eg: subtract-DF2$Day_0_Read1-DF1$ ZeroMean if u notice the repair hours in both have to match...along with their id's. i have tried this zeroday_subtract1=DF1$Day_0_Read1 - DF2[DF1$RepairHours,]$ZeroMean but it dosent work please help me with this...i know its basic but i needhelp thx in advance -- View this message in context: http://r.789695.n4.nabble.com/how-to-compute-when-row-length-is-different-tp2538930p2538930.html Sent from the R help mailing list archive at Nabble.com. [[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] average matrices across a list
Hi, The denominator i compute seperately counting how many observations there were that were not NA. Thus the I divide each (n,m) cell by the number of counts it was not NA. Thanks, Greg On Sep 14, 2010, at 9:23 AM, Dennis Murphy wrote: Hi: It's certainly fast (0.97s for 1 reps on my box), but doesn't replacement by zero affect the denominator of the sum, thereby deflating the means (assuming the contents of the matrices are nonnegative or NA)? Dennis On Tue, Sep 14, 2010 at 5:28 AM, Henrique Dallazuanna www...@gmail.com wrote: You can try this also: Reduce('+', lapply(mymats, function(x)replace(x, is.na(x), 0))) On Sun, Sep 12, 2010 at 10:36 PM, Gregory Ryslik rsa...@comcast.net wrote: Hi Everyone, Thanks to everyone for their help. With your suggestions and some poking around, the following works for what I need. It basically adds all the matrices elementwise, and adds nothing if the element is NA. Thanks again! Code below: ** mymats - vector('list', 5) set.seed(246) # Generate a list of five 3 x 3 matrices for(i in 1:5) mymats[[i]] - matrix(sample(1:9), nrow = 3) mymats[[5]][1,1]-NA mymats[[4]][2,2]-NA mymats matrixadder-function(u,v){ na.u-is.na(u) na.v-is.na(v) ifelse(na.u na.v, NA, ifelse(na.u, 0, u)+ ifelse(na.v,0,v)) } Reduce('matrixadder',mymats) ** Cheers, Greg On Sep 12, 2010, at 8:33 PM, Ben Bolker wrote: My next suggestion (I don't have time to work out or test an example at the moment): library(abind) tmparr - abind(m1,m2,m3,...,along=3) OR tmparr - do.call(c(matlist,list(along=3))) apply(tmparr,c(1,2),mean,na.rm=TRUE) or something along those lines. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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. [[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] NA confusion (length question)
Josh, I am raising my cup of coffee to you - that worked perfectly. Cheers and thanks again! -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Tuesday, September 14, 2010 9:29 AM To: Stratford, Jeffrey Cc: r-help@r-project.org Subject: Re: [R] NA confusion (length question) Hi Jeffrey, As a bit of a side note, data copied in html emails tends to show up poorly (since emails to the list are converted to plain text). Anyways, note the difference between: length(mylm$residuals) length(residuals(mylm)) Accessing the residuals value from mylm is *not* quite the same as calling the residuals() function on mylm. So, if you use: cbind(residuals(mylm), mydata) you should be good. Hope that helps, Josh On Tue, Sep 14, 2010 at 6:20 AM, Stratford, Jeffrey jeffrey.stratf...@wilkes.edu wrote: Hi folks, I am running a very simple regression using mylm - lm(mass ~ tarsus, na.action=na.exclude) I would like the use the residuals from this analysis for more regression but I'm running into a snag when I try cbind(mylm$residuals, mydata) # where my data is the original data set The error tells me that it cannot use cbind because the length of mylm$residuals is 50 and mydata is 52. This makes sense except I thought that na.exclude preserves length by inserting NA in residuals where there were NA's in the orginal data ( i = 3, 20). When I ask to see the residuals( mylm$residuals) I see 52 numbers. How can this be? I am just looking to see how I can produce a third vector with length = 52 and NA's for i=3,20. I'm using R 2.11.1 on Windows XP and the data are below Many thanks, Jeff tarsus mass 21.5 23.2 21.8 22.6 20.9 NA 21.6 20.8 21.5 21.5 22 23.2 21.6 23 22.1 21 21.1 21 20.6 22.9 20.1 21.8 22.2 20.4 21.9 21.5 21.1 21.3 21.5 20.1 19.9 21.4 22.1 27.3 20.1 19.7 19.6 16.7 20.9 NA 20.1 21.7 21.8 22.3 20.9 21.1 21.6 20.8 22.4 20.5 21.4 20.4 21.4 21 21.6 21 21.2 23.3 21.1 21.9 22 21 22.2 21.5 20.6 20.6 21.3 20.5 20.6 20.5 21.4 20.8 21.8 21.4 21.6 19.6 22.4 24.3 21.7 20.3 21.4 21.3 20.7 18.2 21.3 20.9 21.7 20.7 22.6 20 22 23 18.4 20 20.1 20.6 19.8 19.1 21.1 26.3 19.8 22.3 21.2 22.2 19.5 20.6 19.7 22.7 Jeffrey A. Stratford Department of Health and Biological Sciences 84 W. South Street Wilkes University, PA 18766 jeffrey.stratf...@wilkes.edu 570-408-4761 (office) 570-332-2942 (cell) http://web.wilkes.edu/jeffrey.stratford/ [[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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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] Unable to do a post hoc test after Friedman's
On Sep 14, 2010, at 7:07 AM, shivanair wrote: I have R version 2.11.1 I am able to run a Friedman.test, but cant do further post.hoc test. Tried running friedman.test.with.post.hocetc It comes with Error: object 'friedman.test.with.post.hoc' not found This is after loading the packages coin and multcomp My guess is that you failed to copy the function from the blog in which you were reading this, most probably Ted Galili's blog. http://www.r-statistics.com/2010/02/post-hoc-analysis-for-friedmans-test-r-code/ -- David Winsemius, MD West Hartford, CT __ 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] Object oriented programming in R.
I would like to thank you very much all that you helped me so far. So I tried to check how the following works fred - list(happy = 1:10, name = squash) rep(fred, 5) This returns the following : fred[1] $happy [1] 1 2 3 4 5 6 7 8 9 10 fred[2] $name [1] squash What I am trying to do is to address the number 5 of the fred[1] $happy value. I tried something like fred[1][5] fred[1,5] but it didn't work I would like to thank you in advance for your help Best Regards Alex From: Dennis Murphy djmu...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 3:13:37 PM Subject: Re: [R] Object oriented programming in R. Hi: You could create a list of lists, where the outer list would be between agents and the inner list within agents. The inner list could have the 'matrices and one list' as separate components for each agent. Of course, you would have to be able to keep all of this straight :) HTH, Dennis Here are some more information: I would like to create some agents that span over a specific area map.Every agent needs to have its own data structures like one or two matrices and one list. I think that the best way to do this is to create objects and every instance of an object will be used for a single agent. The number of agents is not predetermined and it varies for any execution. So I read this value from the command line interface and then I would like to initiate so many objects as the agents. I think that the best way to do that is to create using a for loop a list containing as many objects as the agents are. I would like to thank you in advance for your help Best Regards Alex From: jim holtman jholt...@gmail.com Cc: Tal Galili tal.gal...@gmail.com; Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 1:40:37 PM Subject: Re: [R] Object oriented programming in R. It depends on what you mean by objects. If you are just looking at creating many named variables that are going to hold values (e.g., reading in data from several files that you want to correlate separately), then consider the use of 'lists'. Can you provide a little more detail on exactly the problem that you are trying to solve, and then maybe we can propose a solution. Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R R Did you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- - Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[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. [[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] NA confusion (length question)
You're quite welcome. If you've a hankering to learn more you can see the documentation for ?residuals.lm (note the .lm addition, which designates the particular method that gets dispatched since your object class was lm). For even more fun: ?naresid (which residuals() calls) and to see how it knew where to add the NAs: mylm$na.action On Tue, Sep 14, 2010 at 6:36 AM, Stratford, Jeffrey jeffrey.stratf...@wilkes.edu wrote: Josh, I am raising my cup of coffee to you - that worked perfectly. Cheers and thanks again! -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: Tuesday, September 14, 2010 9:29 AM To: Stratford, Jeffrey Cc: r-help@r-project.org Subject: Re: [R] NA confusion (length question) Hi Jeffrey, As a bit of a side note, data copied in html emails tends to show up poorly (since emails to the list are converted to plain text). Anyways, note the difference between: length(mylm$residuals) length(residuals(mylm)) Accessing the residuals value from mylm is *not* quite the same as calling the residuals() function on mylm. So, if you use: cbind(residuals(mylm), mydata) you should be good. Hope that helps, Josh On Tue, Sep 14, 2010 at 6:20 AM, Stratford, Jeffrey jeffrey.stratf...@wilkes.edu wrote: Hi folks, I am running a very simple regression using mylm - lm(mass ~ tarsus, na.action=na.exclude) I would like the use the residuals from this analysis for more regression but I'm running into a snag when I try cbind(mylm$residuals, mydata) # where my data is the original data set The error tells me that it cannot use cbind because the length of mylm$residuals is 50 and mydata is 52. This makes sense except I thought that na.exclude preserves length by inserting NA in residuals where there were NA's in the orginal data ( i = 3, 20). When I ask to see the residuals( mylm$residuals) I see 52 numbers. How can this be? I am just looking to see how I can produce a third vector with length = 52 and NA's for i=3,20. I'm using R 2.11.1 on Windows XP and the data are below Many thanks, Jeff tarsus mass 21.5 23.2 21.8 22.6 20.9 NA 21.6 20.8 21.5 21.5 22 23.2 21.6 23 22.1 21 21.1 21 20.6 22.9 20.1 21.8 22.2 20.4 21.9 21.5 21.1 21.3 21.5 20.1 19.9 21.4 22.1 27.3 20.1 19.7 19.6 16.7 20.9 NA 20.1 21.7 21.8 22.3 20.9 21.1 21.6 20.8 22.4 20.5 21.4 20.4 21.4 21 21.6 21 21.2 23.3 21.1 21.9 22 21 22.2 21.5 20.6 20.6 21.3 20.5 20.6 20.5 21.4 20.8 21.8 21.4 21.6 19.6 22.4 24.3 21.7 20.3 21.4 21.3 20.7 18.2 21.3 20.9 21.7 20.7 22.6 20 22 23 18.4 20 20.1 20.6 19.8 19.1 21.1 26.3 19.8 22.3 21.2 22.2 19.5 20.6 19.7 22.7 Jeffrey A. Stratford Department of Health and Biological Sciences 84 W. South Street Wilkes University, PA 18766 jeffrey.stratf...@wilkes.edu 570-408-4761 (office) 570-332-2942 (cell) http://web.wilkes.edu/jeffrey.stratford/ [[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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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.
[R] biclust - jaccardind
Hi, I looked at the help documentation, but couldn't find the algorithm for calculating the modified jaccard index for separate sets of biclusters. Is there a link to some documentation on this? many thanks! [[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] Object oriented programming in R.
On Sep 14, 2010, at 9:29 AM, Alaios wrote: I would like to thank you very much all that you helped me so far. So I tried to check how the following works fred - list(happy = 1:10, name = squash) rep(fred, 5) This returns the following : fred[1] $happy [1] 1 2 3 4 5 6 7 8 9 10 fred[2] $name [1] squash Not on my machine: fred - list(happy = 1:10, name = squash) rep(fred, 5) $happy [1] 1 2 3 4 5 6 7 8 9 10 $name [1] squash $happy [1] 1 2 3 4 5 6 7 8 9 10 $name [1] squash $happy [1] 1 2 3 4 5 6 7 8 9 10 $name [1] squash $happy [1] 1 2 3 4 5 6 7 8 9 10 $name [1] squash $happy [1] 1 2 3 4 5 6 7 8 9 10 $name [1] squash What I am trying to do is to address the number 5 of the fred[1] $happy value. I tried something like fred[1][5] fred[1,5] but it didn't work Almost: fred[[1]][5] [1] 5 I would like to thank you in advance for your help Best Regards Alex From: Dennis Murphy djmu...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 3:13:37 PM Subject: Re: [R] Object oriented programming in R. Hi: You could create a list of lists, where the outer list would be between agents and the inner list within agents. The inner list could have the 'matrices and one list' as separate components for each agent. Of course, you would have to be able to keep all of this straight :) HTH, Dennis Here are some more information: I would like to create some agents that span over a specific area map.Every agent needs to have its own data structures like one or two matrices and one list. I think that the best way to do this is to create objects and every instance of an object will be used for a single agent. The number of agents is not predetermined and it varies for any execution. So I read this value from the command line interface and then I would like to initiate so many objects as the agents. I think that the best way to do that is to create using a for loop a list containing as many objects as the agents are. I would like to thank you in advance for your help Best Regards Alex From: jim holtman jholt...@gmail.com Cc: Tal Galili tal.gal...@gmail.com; Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 1:40:37 PM Subject: Re: [R] Object oriented programming in R. It depends on what you mean by objects. If you are just looking at creating many named variables that are going to hold values (e.g., reading in data from several files that you want to correlate separately), then consider the use of 'lists'. Can you provide a little more detail on exactly the problem that you are trying to solve, and then maybe we can propose a solution. Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R R Did you look into them ? Contact Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex David Winsemius, MD West Hartford, CT __ 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] Object oriented programming in R.
I think this is what you want. Notice the use of 'list' in the rep to create a list of list: fred - list(happy = 1:10, name = squash) x - rep(list(fred), 5) str(x) List of 5 $ :List of 2 ..$ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10 ..$ name : chr squash $ :List of 2 ..$ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10 ..$ name : chr squash $ :List of 2 ..$ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10 ..$ name : chr squash $ :List of 2 ..$ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10 ..$ name : chr squash $ :List of 2 ..$ happy: int [1:10] 1 2 3 4 5 6 7 8 9 10 ..$ name : chr squash x[[1]]$happy[5] [1] 5 On Tue, Sep 14, 2010 at 9:29 AM, Alaios ala...@yahoo.com wrote: I would like to thank you very much all that you helped me so far. So I tried to check how the following works fred - list(happy = 1:10, name = squash) rep(fred, 5) This returns the following : fred[1] $happy [1] 1 2 3 4 5 6 7 8 9 10 fred[2] $name [1] squash What I am trying to do is to address the number 5 of the fred[1] $happy value. I tried something like fred[1][5] fred[1,5] but it didn't work I would like to thank you in advance for your help Best Regards Alex From: Dennis Murphy djmu...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 3:13:37 PM Subject: Re: [R] Object oriented programming in R. Hi: You could create a list of lists, where the outer list would be between agents and the inner list within agents. The inner list could have the 'matrices and one list' as separate components for each agent. Of course, you would have to be able to keep all of this straight :) HTH, Dennis Here are some more information: I would like to create some agents that span over a specific area map.Every agent needs to have its own data structures like one or two matrices and one list. I think that the best way to do this is to create objects and every instance of an object will be used for a single agent. The number of agents is not predetermined and it varies for any execution. So I read this value from the command line interface and then I would like to initiate so many objects as the agents. I think that the best way to do that is to create using a for loop a list containing as many objects as the agents are. I would like to thank you in advance for your help Best Regards Alex From: jim holtman jholt...@gmail.com Cc: Tal Galili tal.gal...@gmail.com; Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 1:40:37 PM Subject: Re: [R] Object oriented programming in R. It depends on what you mean by objects. If you are just looking at creating many named variables that are going to hold values (e.g., reading in data from several files that you want to correlate separately), then consider the use of 'lists'. Can you provide a little more detail on exactly the problem that you are trying to solve, and then maybe we can propose a solution. Thank you very much. I checked the tutorials that on that list but still I do not know how to create many objects of the same type. Can you please help me with that? Best Regards Alex From: Tal Galili tal.gal...@gmail.com Cc: Rhelp r-help@r-project.org Sent: Tue, September 14, 2010 10:11:36 AM Subject: Re: [R] Object oriented programming in R. Hello Alaios, I see a bunch of good materials here: http://www.google.co.il/search?sourceid=chromeie=UTF-8q=Object+oriented+programming+in+R R Did you look into them ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- - Hello everyone. I would like to create many objects with R. Does R support objects? The number of objects needed is not predetermined and it is a parameter specified by the user. If the user selects to create many objects like 100, would it be possible to handle each one by some index? I would like to thank you in advance for your help. Best Regards Alex [[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. [[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. -- Jim Holtman Cincinnati, OH +1 513 646
Re: [R] Problem with cat() == A related question
Code: fn1 - function(n = 5){ + mat - matrix(rnorm(5*5), 5, 5) + cat(print(mat)) + } fn1() [,1][,2] [,3][,4] [,5] [1,] -0.7101952 0.78992424 -0.8310871 2.49560703 -0.9543827 [2,] -0.1425682 -2.69186367 -0.5937949 0.03188572 -0.5512154 [3,] -0.3041728 0.05099222 -2.0905322 0.19254519 -0.1208534 [4,] 2.0812597 1.22048195 1.9347253 -1.25478253 1.2998755 [5,] 0.9256113 0.02686392 -0.1059670 -2.62715239 -0.4826737 -0.7101952 -0.1425682 -0.3041728 2.081260 0.9256113 0.7899242 -2.691864 0.05099222 1.220482 0.02686392 -0.8310871 -0.5937949 -2.090532 1.934725 -0.1059670 2.495607 0.03188572 0.1925452 -1.254783 -2.627152 -0.9543827 -0.5512154 -0.1208534 1.299876 -0.4826737 Question: Is there any control arguments can be used such that fn1() ONLY prints out the matrix part? -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-cat-tp2538811p2539017.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] how to compute when row length is different
Hi: Just to be different, here's a data.table solution: library(data.table) # It's always a good idea to have your merge key variables match in each data frame/table names(DF1)[1] - 'SampleId' dt1 - data.table(DF1, key = 'SampleId, RepairHours') dt2 - data.table(DF2, key = 'SampleId, RepairHours') dt3 - merge(dt1, dt2) dim(dt3) [1] 30 12 # check # Do the subtraction dt3$diff - with(dt3, Day_0_Read1 - ZeroMean) If you want to perform operations between two data frames/tables, you need to merge the data first before you can perform the calculation(s). Dr. Kaza's solution works if you change the ID variable name first in DF1 the way I did and substitute SampleId for Sample_id in his code, or if you change the ID variable in DF2 to Sample_id and use his code as is. HTH, Dennis On Tue, Sep 14, 2010 at 5:38 AM, rasanpreet rasanpreet.k...@gmail.comwrote: hi guys..please help me with this i am working on two data frames one goes like this: DF1 Sample_id RepairHours Denatured Dose ZeroMean FourtyFiveMean NinetyMean 1 SDM071 0 1B 60.5 19.0 45.0 2 SDM071 1 1B 46.0 23.0 42.5 3 SDM071 2 1B 52.5 24.0 40.0 4 SDM071 3 1B 42.0 21.5 45.0 5 SDM053 0 1B 66.5 28.5 56.5 6 SDM053 1 1B 47.0 29.0 47.5 7 SDM053 2 1B 52.0 31.0 44.0 8 SDM053 3 1B 36.0 34.0 41.5 9 SDM059 0 1B 47.5 41.5 29.0 10SDM059 1 1B 47.0 36.0 35.0 11SDM059 2 1B 41.5 42.0 32.5 12SDM059 3 1B 46.5 41.5 32.0 and the other one: DF2 SampleId RepairHours Denatured Dose_uM Day_0_Read1 Day_0_Read2 Day_45_Read1 8SDM071 0 1 C 124 120 108 9SDM071 0 1 25 123 128 77 10 SDM071 0 1 50 132 138 79 11 SDM071 0 1 100 118 116 68 12 SDM071 0 1 200 125 146 73 20 SDM071 1 1 C 113 117 113 21 SDM071 1 1 25 108 115 132 22 SDM071 1 1 50 105 96 94 23 SDM071 1 1 100 101 101 88 24 SDM071 1 1 200 114 106 89 32 SDM071 2 1 C 143 136 109 33 SDM071 2 1 25 126 147 110 34 SDM071 2 1 50 109 122 107 35 SDM071 2 1 100 114 118 89 36 SDM071 2 1 200 118 128 88 44 SDM071 3 1 C 103 111 116 45 SDM071 3 1 25 108 105 115 46 SDM071 3 1 50 118 99 88 47 SDM071 3 1 100 98 103 105 48 SDM071 3 1 200 112 105 96 56 SDM053 0 1 C 214 208 158 57 SDM053 0 1 25 159 214 178 58 SDM053 0 1 50 170 169 112 59 SDM053 0 1 100 149 158 124 60 SDM053 0 1 200 201 171 115 68 SDM053 1 1 C 149 166 120 69 SDM053 1 1 25 145 134 118 70 SDM053 1 1 50 159 169 130 71 SDM053 1 1 100 113 126 110 72 SDM053 1 1 200 118 112 120 these are just part of the frames.. i have to subtract the first five values of dataframe2 from one value from dataframe1 eg: subtract-DF2$Day_0_Read1-DF1$ ZeroMean if u notice the repair hours in both have to match...along with their id's. i have tried this zeroday_subtract1=DF1$Day_0_Read1 - DF2[DF1$RepairHours,]$ZeroMean but it dosent work please help me with this...i know its basic but i needhelp thx in advance -- View this message in context: http://r.789695.n4.nabble.com/how-to-compute-when-row-length-is-different-tp2538930p2538930.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list
[R] Multiple CPU HowTo in Linux?
Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin -- Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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] Sweave and Miktex (Sweave.sty not found)
Hi: Start here: http://docs.miktex.org/manual/localadditions.html#id573835 I have a LocalTeXfiles directory under my home directory on Windows 7, with nested folders for tex - latex - Sweave. All of my Sweave files (*.fd, *.cfg, *.sty) are in the Sweave directory. The manual linked above shows you how to register the directory with MiKTeX. HTH, Dennis On Tue, Sep 14, 2010 at 5:56 AM, Katie Surrence tibur...@gmail.com wrote: Hi all, I know from googling that this is a common problem; I've just tried what I understand to be the common solutions to know avail -- maybe I'm just confused. I installed Miktex 2.8 -- it seems to be working fine. I'm using this demo document: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? Thanks! [[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. [[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] Error: cannot allocate vector of size X.0 Mb
Hi, I am working with a file (900MB in size) that has around 10 million records (in particular FASTQ records). I am able to read in the file as an object of BStringSet. When I start to manipulate the data, after almost 4 hours, I get the error message as Error: cannot allocate vector of size X.0 Mb (where X was once 160MB and then 180MB). The R version used is 2.11.1. I am not sure how to check if this is 64-bit or not so that I can use 4GB of RAM. I typed 'version' at the R prompt and see this: platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu. Does this mean it is already a 64-bit version of R I use? Please advice. -- View this message in context: http://r.789695.n4.nabble.com/Error-cannot-allocate-vector-of-size-X-0-Mb-tp2539031p2539031.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] Multiple CPU HowTo in Linux?
?multicore perhaps On 09/14/2010 10:01 AM, Edwin Groot wrote: Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin __ 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] Error: cannot allocate vector of size X.0 Mb
On Sep 14, 2010, at 9:09 AM, John1983 wrote: Hi, I am working with a file (900MB in size) that has around 10 million records (in particular FASTQ records). I am able to read in the file as an object of BStringSet. When I start to manipulate the data, after almost 4 hours, I get the error message as Error: cannot allocate vector of size X.0 Mb (where X was once 160MB and then 180MB). The R version used is 2.11.1. I am not sure how to check if this is 64-bit or not so that I can use 4GB of RAM. I typed 'version' at the R prompt and see this: platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu. Does this mean it is already a 64-bit version of R I use? Please advice. In an R session, see what the result of: .Machine$sizeof.pointer gets you. If it returns 4, you are using 32 bit R and you will need to install 64 bit R. If it returns 8, you are using 64 bit R. The information above only tells us/you that you are running a 64 bit OS. HTH, Marc Schwartz __ 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] Sweave and Miktex (Sweave.sty not found)
Katie Surrence tiburona at gmail.com writes: ... I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? Thanks! I have had good luck copying sweave.sty into the same directory as the .tex file created by Sweave() before I run Mitex. Greg __ 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] Sweave and Miktex (Sweave.sty not found)
On 14/09/2010 8:56 AM, Katie Surrence wrote: Hi all, I know from googling that this is a common problem; I've just tried what I understand to be the common solutions to know avail -- maybe I'm just confused. I installed Miktex 2.8 -- it seems to be working fine. I'm using this demo document: http://www.stat.berkeley.edu/~houston/demo.Rnw I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? You don't mention your R version, but recent ones have the command Rcmd texify which will call MikTeX correctly. If you want fancier handling of the Sweave input -- preview workflow, take a look at my patchDVI package on R-forge. It allows reverse search from the previewer to find the right line in the Sweave input file, rather than in the intermediate .tex file. Duncan Murdoch __ 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] Sweave and Miktex (Sweave.sty not found)
On 14/09/2010 10:27 AM, Greg Johnson wrote: Katie Surrencetiburonaat gmail.com writes: ... I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? Thanks! I have had good luck copying sweave.sty into the same directory as the .tex file created by Sweave() before I run Mitex. Watch out for versioning problems if you do this. Old Sweave.sty files don't necessarily work with newer Sweave() output. Duncan Murdoch __ 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] Multiple CPU HowTo in Linux?
Hello Cedrick, Ah, yes, that looks like it would apply to my situation. I was previously reading on snow, which is tailored for clusters, rather than a single desktop computer. Anyone with experience adapting multicore to an R-script? I have to admit I know little about parallel processing, multiprocessing and cluster processing. Edwin On Tue, 14 Sep 2010 10:15:42 -0400 Johnson, Cedrick W. cedr...@cedrickjohnson.com wrote: ?multicore perhaps On 09/14/2010 10:01 AM, Edwin Groot wrote: Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin __ 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. Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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 compute when row length is different
You need to line up the rows before you do the arithmetic. Check out ?merge rasanpreet rasanpreet.k...@gmail.com wrote: hi guys..please help me with this i am working on two data frames one goes like this: DF1 Sample_id RepairHours Denatured Dose ZeroMean FourtyFiveMean NinetyMean 1 SDM071 0 1B 60.5 19.0 45.0 2 SDM071 1 1B 46.0 23.0 42.5 3 SDM071 2 1B 52.5 24.0 40.0 4 SDM071 3 1B 42.0 21.5 45.0 5 SDM053 0 1B 66.5 28.5 56.5 6 SDM053 1 1B 47.0 29.0 47.5 7 SDM053 2 1B 52.0 31.0 44.0 8 SDM053 3 1B 36.0 34.0 41.5 9 SDM059 0 1B 47.5 41.5 29.0 10SDM059 1 1B 47.0 36.0 35.0 11SDM059 2 1B 41.5 42.0 32.5 12SDM059 3 1B 46.5 41.5 32.0 and the other one: DF2 SampleId RepairHours Denatured Dose_uM Day_0_Read1 Day_0_Read2 Day_45_Read1 8SDM071 0 1 C 124 120 108 9SDM071 0 1 25 123 128 77 10 SDM071 0 1 50 132 138 79 11 SDM071 0 1 100 118 116 68 12 SDM071 0 1 200 125 146 73 20 SDM071 1 1 C 113 117 113 21 SDM071 1 1 25 108 115 132 22 SDM071 1 1 50 105 96 94 23 SDM071 1 1 100 101 101 88 24 SDM071 1 1 200 114 106 89 32 SDM071 2 1 C 143 136 109 33 SDM071 2 1 25 126 147 110 34 SDM071 2 1 50 109 122 107 35 SDM071 2 1 100 114 118 89 36 SDM071 2 1 200 118 128 88 44 SDM071 3 1 C 103 111 116 45 SDM071 3 1 25 108 105 115 46 SDM071 3 1 50 118 99 88 47 SDM071 3 1 100 98 103 105 48 SDM071 3 1 200 112 105 96 56 SDM053 0 1 C 214 208 158 57 SDM053 0 1 25 159 214 178 58 SDM053 0 1 50 170 169 112 59 SDM053 0 1 100 149 158 124 60 SDM053 0 1 200 201 171 115 68 SDM053 1 1 C 149 166 120 69 SDM053 1 1 25 145 134 118 70 SDM053 1 1 50 159 169 130 71 SDM053 1 1 100 113 126 110 72 SDM053 1 1 200 118 112 120 these are just part of the frames.. i have to subtract the first five values of dataframe2 from one value from dataframe1 eg: subtract-DF2$Day_0_Read1-DF1$ ZeroMean if u notice the repair hours in both have to match...along with their id's. i have tried this zeroday_subtract1=DF1$Day_0_Read1 - DF2[DF1$RepairHours,]$ZeroMean but it dosent work please help me with this...i know its basic but i needhelp thx in advance -- View this message in context: http://r.789695.n4.nabble.com/how-to-compute-when-row-length-is-different-tp2538930p2538930.html Sent from the R help mailing list archive at Nabble.com. [[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. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers)
Re: [R] Error: cannot allocate vector of size X.0 Mb
Yes I see. So I typed as you mentioned and I get an 8 (therefore this is a 64-bit R). Is there anything else I need to check to remove this error? -- View this message in context: http://r.789695.n4.nabble.com/Error-cannot-allocate-vector-of-size-X-0-Mb-tp2539031p2539078.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] ASA Stat. Computing Stat. Graphics Student Paper Competition 2011
Statistical Computing and Statistical Graphics Sections American Statistical Association Student Paper Competition 2011 The Statistical Computing and Statistical Graphics Sections of the ASA are co-sponsoring a student paper competition on the topics of Statistical Computing and Statistical Graphics. Students are encouraged to submit a paper in one of these areas, which might be original methodological research, some novel computing or graphical application in statistics, or any other suitable contribution (for example, a software-related project). The selected winners will present their papers in a topic-contributed session at the 2011 Joint Statistical Meetings. The Sections will pay registration fees for the winners as well as a substantial allowance for transportation to the meetings and lodging. Anyone who is a student (graduate or undergraduate) on or after September 1, 2010 is eligible to participate. An entry must include an abstract, a six page manuscript (including figures, tables and references), blinded versions of the abstract and manuscript (with no authors and no references that easily lead to identifying the authors), a C.V., and a letter from a faculty member familiar with the student's work. The applicant must be the first author of the paper. The faculty letter must include a verification of the applicant's student status and, in the case of joint authorship, should indicate what fraction of the contribution is attributable to the applicant. We prefer that electronic submissions of papers be in Postscript or PDF. All materials must be in English. All application materials MUST BE RECEIVED by 5:00 PM EST, Monday, December 13, 2010 at the address below. They will be reviewed by the Student Paper Competition Award committee of the Statistical Computing and Graphics Sections. The selection criteria used by the committee will include innovation and significance of the contribution as well as the professional quality of the manuscript. Award announcements will be made in late January, 2011. Additional important information on the competition can be accessed on the website of the Statistical Computing Section, www.statcomputing.org. A current pointer to the website is available from the ASA website at www.amstat.org. Inquiries and application materials should be emailed or mailed to: Student Paper Competition c/o Fei Chen Avaya Labs 233 Mt Airy Rd Basking Ridge, NJ 07920 f...@avaya.com [[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] Can I save my console contents automatically?
Dear All, I found a following solution from http://r.789695.n4.nabble.com/;. However this command can save only the result. Is there any good solution to save both commands themselves and the results. Thank you for your help. sink(Filename_here.log, type=c(output,message), split=TRUE) # Put commands here # However this method save only the results. sink() Nobu Message: 33 Date: Fri, 10 Sep 2010 07:07:37 -0700 From: Nobuaki Michihata gha10...@gmail.com To: r-help@r-project.org, r-help@r-project.org Subject: [R] Can I save my console contents automatically? Message-ID: aanlktimez-igqk6gzeyqerzatg7m+chjbgjmagmel...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Dear All, I'm using R for Mac OS X Cocoa GUI R version 2.11.1. I can save contents of my console window by using command + s, but I would like to do same thing using R commands. My question is can I save the contents automatically by using R editor with some R commands. Thank you. Nobu __ 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] Error: cannot allocate vector of size X.0 Mb
On 14.09.2010 16:47, John1983 wrote: Yes I see. So I typed as you mentioned and I get an 8 (therefore this is a 64-bit R). Is there anything else I need to check to remove this error? Yes: If the amount of RAM in your machine is sufficient Best, Uwe __ 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] Error: cannot allocate vector of size X.0 Mb
On Sep 14, 2010, at 9:47 AM, John1983 wrote: Yes I see. So I typed as you mentioned and I get an 8 (therefore this is a 64-bit R). Is there anything else I need to check to remove this error? 1. Add more RAM. 2. Depending upon what you are doing relative to data management/analysis, you might want to see if there are more efficient approaches. 3. Free up RAM that may be in use by other processes, etc. 4. Look at R packages such as biglm, ff/bit, biganalytics, etc. 5. Consider using a backend data base application (eg. MySQL, Postgres, etc.) to manage the data sets and use R only for analyses, as may be appropriate relative to splitting the tasks. You did not indicate just how much RAM you have on the machine in question, but if it is within your budget/capability, adding more RAM would be the most transparent approach. HTH, Marc Schwartz __ 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] Problem with cat() == A related question
Try the following: fn1 - function(n = 5){ mat - matrix(rnorm(5*5), 5, 5) cat(print(mat)) invisible(NULL)} On Tue, Sep 14, 2010 at 9:59 AM, Peng, C cpeng@gmail.com wrote: Code: fn1 - function(n = 5){ + mat - matrix(rnorm(5*5), 5, 5) + cat(print(mat)) + } fn1() [,1] [,2] [,3] [,4] [,5] [1,] -0.7101952 0.78992424 -0.8310871 2.49560703 -0.9543827 [2,] -0.1425682 -2.69186367 -0.5937949 0.03188572 -0.5512154 [3,] -0.3041728 0.05099222 -2.0905322 0.19254519 -0.1208534 [4,] 2.0812597 1.22048195 1.9347253 -1.25478253 1.2998755 [5,] 0.9256113 0.02686392 -0.1059670 -2.62715239 -0.4826737 -0.7101952 -0.1425682 -0.3041728 2.081260 0.9256113 0.7899242 -2.691864 0.05099222 1.220482 0.02686392 -0.8310871 -0.5937949 -2.090532 1.934725 -0.1059670 2.495607 0.03188572 0.1925452 -1.254783 -2.627152 -0.9543827 -0.5512154 -0.1208534 1.299876 -0.4826737 Question: Is there any control arguments can be used such that fn1() ONLY prints out the matrix part? -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-cat-tp2538811p2539017.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.
Re: [R] Multiple CPU HowTo in Linux?
Edwin, I'm not sure what you mean by adapting; other than installing multicore, there is nothing else to set up. How and whether you could then parallelise your code strongly depends on the specific problem you are facing. What have done in the past was to look at the source of the functions from whatever package I was using that produced the bottleneck. If what is taking the longest time is actually embarrassingly parallel, mclapply() from package multicore can help. In the simplest case you could simply replace lapply() in the with an appropriate mclapply(). Check out ?mclapply. But then again you might have to get a little more creative, depending on exactly what in the code is taking so long to run. If your problem is inherently sequential then even multicore won't help. Christian On 09/14/2010 09:35 AM, Edwin Groot wrote: Hello Cedrick, Ah, yes, that looks like it would apply to my situation. I was previously reading on snow, which is tailored for clusters, rather than a single desktop computer. Anyone with experience adapting multicore to an R-script? I have to admit I know little about parallel processing, multiprocessing and cluster processing. Edwin On Tue, 14 Sep 2010 10:15:42 -0400 Johnson, Cedrick W.cedr...@cedrickjohnson.com wrote: ?multicore perhaps On 09/14/2010 10:01 AM, Edwin Groot wrote: Hello all, I upgraded my R workstation, and to my dismay, only one core appears to be used during intensive computation of a bioconductor function. What I have now is two dual-core Xeon 5160 CPUs and 10 GB RAM. When I fully load it, top reports about 25% user, 75% idle and 0.98 short-term load. The archives gave nothing helpful besides mention of snow. I thought of posting to HPC, but this system is fairly modest WRT processing power. Any pointers of where to start? --- #Not running anything at the moment sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.11.1 --- $ uname -a Linux laux29 2.6.26-2-amd64 #1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64 GNU/Linux --- Thanks for your help, Edwin __ 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. Dr. Edwin Groot, postdoctoral associate AG Laux Institut fuer Biologie III Schaenzlestr. 1 79104 Freiburg, Deutschland +49 761-2032945 __ 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. -- Christian Raschke Department of Economics and ISDS Research Lab (HSRG) Louisiana State University Patrick Taylor Hall, Rm 2128 Baton Rouge, LA 70803 cras...@lsu.edu __ 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] R2WinBugs problem
If the exactly same code runs on one machine and not on another where R version, script, model file, inits, data etc. are all identical, then I suspect you have different versions of R2WinBUGS installed. Please check is really all files and all version numbers are the same. If you still have the problem afterwards, please send the relevant files that make the code below reproducible for us. Best wishes, Uwe Ligges On 09.09.2010 22:53, Mark Irwin wrote: I'm having difficulty running R2WinBugs on a setup that previously worked for me (Dell Laptop, Windows XP service pack 3, R 2.11.1, WinBugs 1.43) . When I issue the following command smds.sim - bugs (data, inits, parameters, SMDSbrandLoc2.bug, debug = T, n.thin = n.thin, n.chains = n.chains, n.burnin = n.burnin, n.iter = n.iter) I get the following error in R Error in while (.regexpr(\r, info) 0) { : argument is of length zero Also in WinBugs I get the following messages dic.set() command #Bugs:dic.set cannot be executed (is greyed out) update(5) coda(*,C:/DOCUME~1/irwin/LOCALS~1/Temp/RtmpOwZetY/coda) command #Bugs:coda cannot be executed (is greyed out) stats(*) command #Bugs:stats cannot be executed (is greyed out) dic.stats() DIC history(*,C:/DOCUME~1/irwin/LOCALS~1/Temp/RtmpOwZetY/history.odc) command #Bugs:history cannot be executed (is greyed out) I am able to run the analysis on a Mac under Parallel Desktop (XP Service Pack 3, R 2.11.1, WinBugs 1.43) and on an Amazon Cloud Machine (R 2.11.1, WinBugs 1.43, not sure which version of Windows). Does anybody have any idea what might be causing that error? An even better, an idea how to fix it? Mark __ 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] Model averaging with (and without) interaction terms
I’ve used logistic regression to create models to assess the effect of 3 variables on the presence or absence of a species, including the interaction terms between variables and model averaging using MuMI: model.avg The top models (delta4) include several models with interaction terms and some models without; model weights are quite low for all models (0.25). My problem is that the models with interactions have negative coefficients on the variables with a positive interaction term whereas the same model without an interaction has positive coefficients. MuMIn: model.avg averages all these models together, so the relationship is washed out (CI overlaps 0). Eg. mod1-glm(presence ~ x1*x2, family=”binomial”) coefficients: -0.661 x1, -0.043 x2, 0.02 x1:x2 mod2 - glm(presence ~ x1 + x2, family=”binomial”) coefficients: 0.245 x1, 0.021 x2 I’ve read that it is difficult to compare models with and without interaction terms, but nothing regarding how one might go about doing so. Should interaction models be averaged differently or separately than models without interaction terms? Is there another way to approach this? Thanks in advance, Leslie __ 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] Sweave and Miktex (Sweave.sty not found)
Thank you very much, Dennis. That worked. I had tried pointing the list of Roots to the R directory where the Sweave file was originally located, and had gotten an error, but I had not tried making my own directory. On Tue, Sep 14, 2010 at 9:08 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: Start here: http://docs.miktex.org/manual/localadditions.html#id573835 I have a LocalTeXfiles directory under my home directory on Windows 7, with nested folders for tex - latex - Sweave. All of my Sweave files (*.fd, *.cfg, *.sty) are in the Sweave directory. The manual linked above shows you how to register the directory with MiKTeX. HTH, Dennis On Tue, Sep 14, 2010 at 5:56 AM, Katie Surrence tibur...@gmail.comwrote: Hi all, I know from googling that this is a common problem; I've just tried what I understand to be the common solutions to know avail -- maybe I'm just confused. I installed Miktex 2.8 -- it seems to be working fine. I'm using this demo document: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? Thanks! [[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. [[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] ASA John M. Chambers Statistical Software Award - 2011
John M. Chambers Statistical Software Award - 2011 Statistical Computing Section American Statistical Association The Statistical Computing Section of the American Statistical Association announces the competition for the John M. Chambers Statistical Software Award. In 1998 the Association for Computing Machinery presented its Software System Award to John Chambers for the design and development of S. Dr. Chambers generously donated his award to the Statistical Computing Section to endow an annual prize for statistical software written by an undergraduate or graduate student. The prize carries with it a cash award of $1000, plus a substantial allowance for travel to the annual Joint Statistical Meetings where the award will be presented. Teams of up to 3 people can participate in the competition, with the cash award being split among team members. The travel allowance will be given to just one individual in the team, who will be presented the award at JSM. To be eligible, the team must have designed and implemented a piece of statistical software. The individual within the team indicated to receive the travel allowance must have begun the development while a student, and must either currently be a student, or have completed all requirements for her/his last degree after January 1, 2009. To apply for the award, teams must provide the following materials: Current CV's of all team members. A letter from a faculty mentor at the academic institution of the individual indicated to receive the travel award. The letter should confirm that the individual had substantial participation in the development of the software, certify her/his student status when the software began to be developed (and either the current student status or the date of degree completion), and briefly discuss the importance of the software to statistical practice. A brief, one to two page description of the software, summarizing what it does, how it does it, and why it is an important contribution. If the team member competing for the travel allowance has continued developing the software after finishing her/his studies, the description should indicate what was developed when the individual was a student and what has been added since. An installable software package with its source code for use by the award committee. It should be accompanied by enough information to allow the judges to effectively use and evaluate the software (including its design considerations.) This information can be provided in a variety of ways, including but not limited to a user manual (paper or electronic), a paper, a URL, and online help to the system. All materials must be in English. We prefer that electronic text be submitted in Postscript or PDF. The entries will be judged on a variety of dimensions, including the importance and relevance for statistical practice of the tasks performed by the software, ease of use, clarity of description, elegance and availability for use by the statistical community. Preference will be given to those entries that are grounded in software design rather than calculation. The decision of the award committee is final. All application materials must be received by 5:00pm EST, Monday, February 21, 2011 at the address below. The winner will be announced in May and the award will be given at the 2011 Joint Statistical Meetings. Information on the competition can also be accessed on the website of the Statistical Computing Section (www.statcomputing.org or see the ASA website, www.amstat.org for a pointer), including the names and contributions of previous winners. Inquiries and application materials should be emailed or mailed to: Chambers Software Award c/o Fei Chen Avaya Labs 233 Mt Airy Rd. Basking Ridge, NJ 07920 f...@avaya.com [[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] proportion
Learn to use functions like help.search, RSiteSearch, or the sos package, these tools will help you answer your own questions like this. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of LCOG1 Sent: Monday, September 13, 2010 4:53 PM To: r-help@r-project.org Subject: [R] proportion Hi , SO i have been on a role of asking simple questions lately. So much for feeling like im getting this R business. I wrote a script 2 weeks ago that utilized proportion to turn values in a table (from table) into proportions to then graph. I now get an error that proportion is not a function so im confused. I ran the script a few times and im thinking maybe i had another library loaded from a previous process and that it wasnt listed in my script and now isnt being loaded. So question is what library do i need to load or what other updates or changes have been made that now R cant find proportion? Probably useless with other code/data: textplot(paste(names(TrkSUV.Ag[[zp]]),proportion(TrkSUV.Ag[[zp]])), halign=center, valign=center,cex=1) -- View this message in context: http://r.789695.n4.nabble.com/proportion- tp2538185p2538185.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] TimeStamp
Thanks. Both methods definitely help. -Roberto 2010/9/14 Uwe Ligges lig...@statistik.tu-dortmund.de On 06.09.2010 03:51, Roberto Badilla Fuentes wrote: Hi, I have a dataset in .dbf format. It contains Coordinates and Time. The TIMESTAMP is as follows: 03/18/2006 13:30:37 I am not working with the TIMESTAMP column, but when I print out my manipulated dataset using *write.dbf* I get the value *390 *where the TIMESTAMP value should be. Can Anyone help me out why R does this and how I can correct it. Probably the timestamp was read in as a factor. Use as.character() followed by, e.g., strptime() to convert it to a time format. Best, Uwe Ligges Thanks -Roberto [[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. [[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] predict(backSpline(x)): losing my marbles?
I'm sure I'm doing something completely boneheaded here, but I've used this idiom (constructing an interpolation spline and using prediction from a backSpline to find an approximation profile confidence interval) many times before and haven't hit this particular problem: r2 - c(1.04409027570601, 1.09953936543359, 1.15498845516117, 1.21043754488875, 1.26588663461633, 1.32133572434391, 1.37678481407149, 1.43223390379907, 1.48768299352664, 1.54313208325422, 1.5985811729818, 1.65403026270938, 1.70947935243696, 1.76492844216454, 1.82037753189212, 1.87582662161970, 1.93127571134727, 1.98672480107485, 2.04217389080243, 2.09762298053001 ) d2 - c(6.1610616585333, 5.70079375491741, 5.2366151167289, 4.77263065800071, 4.31310259797181, 3.86232922249189, 3.42452047126494, 3.00367670365119, 2.6034766331926, 2.22717964214416, 1.87754657382891, 1.55678176465949, 1.26649764837839, 1.00770187223770, 0.780805622450771, 0.585650849661306, 0.421553364080296, 0.287358347766713, 0.18150469048976, 0.102094654969619 ) plot(d2,r2,type=b) require(splines) sp - interpSpline(r2,d2) psp - predict(sp) points(psp$y,psp$x,col=5) bsp - backSpline(sp) lines(predict(bsp,seq(0,6,length=101)),col=2) The prediction from the spline (cyan dots) looks perfectly reasonable. The prediction from the inverted spline matches the curve over part of the range but goes crazy elsewhere. I would have expected it to be reasonably close to this well-behaved curve over the whole range. I have looked at the docs for interpSpline, backSpline, predict.bSpline, ... and nothing jumps out at me. Please be gentle, if possible, in explaining to me what I'm missing ... thanks, Ben Bolker __ 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] xyplot axis line width
Thank you Deepayan. This is exactly what I needed. John - Original Message From: Deepayan Sarkar deepayan.sar...@gmail.com To: array chip arrayprof...@yahoo.com Cc: r-help@r-project.org Sent: Tue, September 14, 2010 4:52:29 AM Subject: Re: [R] xyplot axis line width On Tue, Sep 14, 2010 at 4:26 AM, array chip arrayprof...@yahoo.com wrote: Hi, another question: is there any argument that controls the line width of axis box of xyplot()? I tried lwd=2 or lwd.axis=2 in xyplot() or within scales=list() argument, without success. xyplot(1:10 ~ 1:10, par.settings = list(axis.line = list(lwd = 2))) If you do not want this to affect the tick marks as well, then you additionally need scales = list(lwd = 1) -Deepayan __ 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] Sweave and Miktex (Sweave.sty not found)
On 14/09/2010 11:51 AM, Katie Surrence wrote: Thanks Duncan -- I'm running R 2.11 and ??texify gets me no recognition. There is a command by that name in the tools package (not loaded by default, so that's why help didn't work), but I was talking about entering it at the command prompt, as you would latex or pdflatex. Duncan Murdoch At the moment I'm trying to get something that works -- I'm not nearly to the point of fancy. I solved my Sweave.sty problem although I'm still not managing to generate the graph in the demo file. But maybe I should make that a separate question. On Tue, Sep 14, 2010 at 9:33 AM, Duncan Murdochmurdoch.dun...@gmail.comwrote: On 14/09/2010 8:56 AM, Katie Surrence wrote: Hi all, I know from googling that this is a common problem; I've just tried what I understand to be the common solutions to know avail -- maybe I'm just confused. I installed Miktex 2.8 -- it seems to be working fine. I'm using this demo document: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? You don't mention your R version, but recent ones have the command Rcmd texify which will call MikTeX correctly. If you want fancier handling of the Sweave input -- preview workflow, take a look at my patchDVI package on R-forge. It allows reverse search from the previewer to find the right line in the Sweave input file, rather than in the intermediate .tex file. Duncan Murdoch __ 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 with pdf device using plot glht function on multcomp library.
Hi R users: I have de following data frame (called Sx) Descripcion Nitratos Cont85g72.40 Cont85g 100.50 Cont85g 138.30 Cont80g 178.33 Cont80g79.01 Cont80g74.16 Cont75g23.70 Cont75g15.80 Cont75g16.20 Patron80g88.93 Patron80g 113.01 Patron80g86.53 If I run this code without the pdf device it works fine on the screen, but when I use the pdf device it does not show in the plot1.pdf file what I got on the screen. What am I doing wrong? Thank you for your help. library(multcomp) Sx-data.frame(Descripcion= factor(c(Cont85g,Cont85g,Cont85g, Cont80g,Cont80g,Cont80g, Cont75g,Cont75g,Cont75g, Patron80g,Patron80g,Patron80g)), Nitratos=c(72.40,100.50, 138.30, 178.33,79.01,74.16, 23.70, 15.80,16.20, 88.93,113.01,86.53)) pdf(plot1.pdf) m1-aov(Nitratos~Descripcion-1,data=Sx) vect1-table(Sx$Descripcion) K-contrMat(vect1,base=4) dnk-glht(m1,linfct=K) summary(dnk) old.par-par(no.readonly = TRUE) par(mai=c(1,2,1.25,1),mgp=c(3,1,0)) print(plot(dnk,las=1,xlab=)) print(abline(v=0,lty=2)) par(old.par) dev.off() __ 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] nlme numeric data format
Dear R help folks I am trying to run nlme for the first time (currently without guidance of any textbooks), apologies if this is a bit simplistic. My model is 15 env predictors of diversity, grouped by 3 locations: mod1-nlme(shan~Alt+EC+Phos+pH+DOC+NO3NO2+H2O+Amino+NH4+Birds+Plants+Seals+Humans+Disttowest+Oceanicity,fixed=Alt+EC+Phos+pH+DOC+NO3NO2+H2O+Amino+NH4+Birds+Plants+Seals+Humans+Disttowest+Oceanicity~1,random=Alt+EC+Phos+pH+DOC+NO3NO2+H2O+Amino+NH4+Birds+Plants+Seals+Humans+Disttowest+Oceanicity~1|Group, data=gdata, start=selfStart) I have done the group data function which apeared to work and when I ask the data for the format it is currently telling me it is numeric: is.numeric(gdata) [1] TRUE But is still spewing out the following error message: Error in Alt + EC + Phos + pH + DOC + NO3NO2 + H2O + Amino + NH4 + Birds + : non-numeric argument to binary operator Any help appreciated, thanks -- View this message in context: http://r.789695.n4.nabble.com/nlme-numeric-data-format-tp2539249p2539249.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] Can I save my console contents automatically?
On Sep 14, 2010, at 10:33 AM, Nobuaki Michihata wrote: Dear All, I found a following solution from http://r.789695.n4.nabble.com/;. However this command can save only the result. Is there any good solution to save both commands themselves and the results. Thank you for your help. sink(Filename_here.log, type=c(output,message), split=TRUE) # Put commands here # However this method save only the results. sink() ?capture.output But it won't work for material that is already laid down... only works forward in time. -- David. Nobu Message: 33 Date: Fri, 10 Sep 2010 07:07:37 -0700 From: Nobuaki Michihata gha10...@gmail.com To: r-help@r-project.org, r-help@r-project.org Subject: [R] Can I save my console contents automatically? Message-ID: aanlktimez-igqk6gzeyqerzatg7m+chjbgjmagmel...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Dear All, I'm using R for Mac OS X Cocoa GUI R version 2.11.1. I can save contents of my console window by using command + s, but I would like to do same thing using R commands. My question is can I save the contents automatically by using R editor with some R commands. Thank you. Nobu __ 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. David Winsemius, MD West Hartford, CT __ 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 with pdf device using plot glht function on multcomp library.
Thank you Jorge Iván: Im working on a Linux platform, and with a recent pathed version of R. Does it work on windows? R version 2.11.1 Patched (2010-09-10 r52887) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=es_CO.UTF-8 LC_NUMERIC=C LC_TIME=es_CO.UTF-8 LC_COLLATE=es_CO.UTF-8 LC_MONETARY=es_CO.UTF-8 [6] LC_MESSAGES=es_CO.UTF-8 LC_PAPER=es_CO.UTF-8 LC_NAME=es_CO.UTF-8 LC_ADDRESS=es_CO.UTF-8 LC_TELEPHONE=es_CO.UTF-8 [11] LC_MEASUREMENT=es_CO.UTF-8LC_IDENTIFICATION=es_CO.UTF-8 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] multcomp_1.2-0 survival_2.35-8mvtnorm_0.9-92 RColorBrewer_1.0-2 lattice_0.19-11rkward_0.5.3 loaded via a namespace (and not attached): [1] grid_2.11.1 tools_2.11.1 El mar, 14-09-2010 a las 12:37 -0400, Jorge Ivan Velez escribió: Hola Kenneth, Acabo de correrlo en un Mac y funciona bien. Cual es tu sessionInfo()? Saludos, Jorge sessionInfo() R version 2.11.1 Patched (2010-05-31 r52180) x86_64-apple-darwin9.8.0 locale: [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] multcomp_1.2-0 survival_2.35-8 mvtnorm_0.9-92 seqinr_3.0-0 MuMIn_0.13.14 loaded via a namespace (and not attached): [1] tools_2.11.1 On Tue, Sep 14, 2010 at 12:34 PM, Kenneth Roy Cabrera Torres krcab...@une.net.co wrote: Hi R users: I have de following data frame (called Sx) Descripcion Nitratos Cont85g72.40 Cont85g 100.50 Cont85g 138.30 Cont80g 178.33 Cont80g79.01 Cont80g74.16 Cont75g23.70 Cont75g15.80 Cont75g16.20 Patron80g88.93 Patron80g 113.01 Patron80g86.53 If I run this code without the pdf device it works fine on the screen, but when I use the pdf device it does not show in the plot1.pdf file what I got on the screen. What am I doing wrong? Thank you for your help. library(multcomp) Sx-data.frame(Descripcion= factor(c(Cont85g,Cont85g,Cont85g, Cont80g,Cont80g,Cont80g, Cont75g,Cont75g,Cont75g, Patron80g,Patron80g,Patron80g)), Nitratos=c(72.40,100.50, 138.30, 178.33,79.01,74.16, 23.70, 15.80,16.20, 88.93,113.01,86.53)) pdf(plot1.pdf) m1-aov(Nitratos~Descripcion-1,data=Sx) vect1-table(Sx$Descripcion) K-contrMat(vect1,base=4) dnk-glht(m1,linfct=K) summary(dnk) old.par-par(no.readonly = TRUE) par(mai=c(1,2,1.25,1),mgp=c(3,1,0)) print(plot(dnk,las=1,xlab=)) print(abline(v=0,lty=2)) par(old.par) dev.off() __ 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] Good example ANCOVA in R
I could find a couple of useful examples of ANCOVA. However, any of them did not contain a good example of how to get the adjusted means in ANCOV using R. Is there anyone who knows or has a good example of it? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/Good-example-ANCOVA-in-R-tp2539189p2539189.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] Using McNemar's test to detect shifts in response from pre- to post-treatment
Hello Everyone, I've been asked to check if there is a significant difference in the following: Pre Post Group A 15/19 14/19 Group B 14/19 10/19 My sense is that I need to perform McNemar's test on these data because responses are correlated within patient from the pre-test to the post-test. The question is how to do this. I'm a SAS user who is learning R. I'm not sure how to do this in SAS and am even less certain about how to do it in R. The R books I have don't seem to cover this. At this point, I'm not even sure if the information I've been given is what I needed to perform the test. If anyone can help with this, it would be greatly appreciated. Thanks, Paul [[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] Sweave and Miktex (Sweave.sty not found)
Thanks Duncan -- I'm running R 2.11 and ??texify gets me no recognition. At the moment I'm trying to get something that works -- I'm not nearly to the point of fancy. I solved my Sweave.sty problem although I'm still not managing to generate the graph in the demo file. But maybe I should make that a separate question. On Tue, Sep 14, 2010 at 9:33 AM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 14/09/2010 8:56 AM, Katie Surrence wrote: Hi all, I know from googling that this is a common problem; I've just tried what I understand to be the common solutions to know avail -- maybe I'm just confused. I installed Miktex 2.8 -- it seems to be working fine. I'm using this demo document: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw I've copied the Sweave.sty file into at this point multiple places on the Miktex path, including folders where I can see that it is looking for, and successfully finding, sty files (e.g. Miktex 2.8/tex/latex/base). I also went to the Miktex settings application and clicked Refresh FNDB and Update formats. Still I get this error when I try to run pdfLaTeX on the demo.tex file: !LaTeX Error: File 'Sweave.sty' not found. Can anyone help? You don't mention your R version, but recent ones have the command Rcmd texify which will call MikTeX correctly. If you want fancier handling of the Sweave input -- preview workflow, take a look at my patchDVI package on R-forge. It allows reverse search from the previewer to find the right line in the Sweave input file, rather than in the intermediate .tex file. Duncan Murdoch [[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] Sweave and graphs
Hi all, Having solved my Sweave.sty question, I'd like to figure out why my pdf doesn't display the graph in my demo code. Here's the demo code I'm using: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw When I run Sweave within R (version 2.11) on the .Rnw it produces the histogram in the graphics device in R. When I then choose pdfLaTex in Miktex (version 2.8) on the file demo.tex, the resulting pdf correctly produces the table, but not the graph. Here's the code from the .tex file that isn't working to generate the graph: \begin{figure} \begin{center} \includegraphics{demo-FigureExample} \caption{This is my histogram for the the mean of 1000 samples of 10 N(0,1) random variables.} \label{fig:hist} \end{center} \end{figure} Any insight? I'd like to know if it's the original Rnw code that's at fault (so I know I shouldn't use it as an example, or whether something about my pipeline is broken). [[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] Good example ANCOVA in R
On Sep 14, 2010, at 11:58 AM, choisj70 wrote: I could find a couple of useful examples of ANCOVA. However, any of them did not contain a good example of how to get the adjusted means in ANCOV using R. Is there anyone who knows or has a good example of it? I'm assuming that whatever regression/modeling function you would be using would have a predict method for the model object. ?predict Thanks in advance. -- -- David Winsemius, MD West Hartford, CT __ 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] Sweave and graphs
On 14/09/2010 12:01 PM, Katie Surrence wrote: Hi all, Having solved my Sweave.sty question, I'd like to figure out why my pdf doesn't display the graph in my demo code. Here's the demo code I'm using: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw When I run Sweave within R (version 2.11) on the .Rnw it produces the histogram in the graphics device in R. When I then choose pdfLaTex in Miktex (version 2.8) on the file demo.tex, the resulting pdf correctly produces the table, but not the graph. Here's the code from the .tex file that isn't working to generate the graph: \begin{figure} \begin{center} \includegraphics{demo-FigureExample} \caption{This is my histogram for the the mean of 1000 samples of 10 N(0,1) random variables.} \label{fig:hist} \end{center} \end{figure} It works for me, so I'd guess it's something in your pipeline. How are you running Sweave? Duncan Murdoch __ 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] Multivariate Regression Trees: how to identify sample units?
On Tue, 2010-09-07 at 19:23 -0300, afso...@unisinos.br wrote: Dear friends, I am sudying the mvpart package, that implements Multivariate Regression Trees, aiming at applying it to a biogeographical dataset of tree speces in southern South America. My doubt is how to access plot identities after the tree is produced. For us it is rather important, but I could not find them with neither 'summary(fit)'[where fit is the object containing the mvpart(...) command] nor just 'fit'. This piece of information is likely to be somewhere in the package documentation (Package 'mvpart' or ?mvpart), but I did not succeed in finding it. [Apologies for the delayed reply to this, I was busy at the time and what was required was not very clear from the question.] I've answered, in longer form, a similar post on ECOLOG, but for the archive: with(fit, where) The numbers in 'where' pertain the to ID of the terminal node to which each sample has been assigned. See ?rpart.object for details of the objects returned by rpart (which mvpart is a wrapper to). HTH G Do anyone knows how to solve this? Thank you in advance and all the best, Alexandre Dr. Alexandre F. Souza Programa de Pós-Graduação em Biologia: Diversidade e Manejo da Vida Silvestre Universidade do Vale do Rio dos Sinos (UNISINOS) Av. UNISINOS 950 - C.P. 275, São Leopoldo 93022-000, RS - Brasil Telefone: (051)3590-8477 ramal 1263 Skype: alexfadigas afso...@unisinos.br http://www.unisinos.br/laboratorios/lecopop __ 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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] Sweave and graphs
I set my working directory to the location of the file (which I called Demo.Rnw) and I type Sweave(Demo.Rnw) at the R command line. Does that answer your question properly? On Tue, Sep 14, 2010 at 12:08 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 14/09/2010 12:01 PM, Katie Surrence wrote: Hi all, Having solved my Sweave.sty question, I'd like to figure out why my pdf doesn't display the graph in my demo code. Here's the demo code I'm using: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw http://www.stat.berkeley.edu/%7Ehouston/demo.Rnw When I run Sweave within R (version 2.11) on the .Rnw it produces the histogram in the graphics device in R. When I then choose pdfLaTex in Miktex (version 2.8) on the file demo.tex, the resulting pdf correctly produces the table, but not the graph. Here's the code from the .tex file that isn't working to generate the graph: \begin{figure} \begin{center} \includegraphics{demo-FigureExample} \caption{This is my histogram for the the mean of 1000 samples of 10 N(0,1) random variables.} \label{fig:hist} \end{center} \end{figure} It works for me, so I'd guess it's something in your pipeline. How are you running Sweave? Duncan Murdoch [[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] Homogeneity of regression slopes
If you are interested in exploring the homogeneity of variance assumption, I would suggest you model the variance explicitly. Doing so allows you to compare the homogeneous variance model to the heterogeneous variance model within a nested model framework. In that framework, you'll have likelihood ratio tests, etc. This is why I suggested the nlme package and the gls function. The gls function allows you to model the variance. -tgs P.S. WLS is a type of GLS. P.P.S It isn't clear to me how a variance stabilizing transformation would help in this case. On Tue, Sep 14, 2010 at 6:53 AM, Clifford Long gnolff...@gmail.com wrote: Hi Thomas, Thanks for the additional information. Just wondering, and hoping to learn ... would any lack of homogeneity of variance (which is what I believe you mean by different stddev estimates) be found when performing standard regression diagnostics, such as residual plots, Levene's test (or equivalent), etc.? If so, then would a WLS routine or some type of variance stabilizing transformation be useful? Again, hoping to learn. I'll check out the gls() routine in the nlme package, as you mentioned. Thanks. Cliff On Mon, Sep 13, 2010 at 10:02 PM, Thomas Stewart tgstew...@gmail.comwrote: Allow me to add to Michael's and Clifford's responses. If you fit the same regression model for each group, then you are also fitting a standard deviation parameter for each model. The solution proposed by Michael and Clifford is a good one, but the solution assumes that the standard deviation parameter is the same for all three models. You may want to consider the degree by which the standard deviation estimates differ for the three separate models. If they differ wildly, the method described by Michael and Clifford may not be the best. Rather, you may want to consider gls() in the nlme package to explicitly allow the variance parameters to vary. -tgs On Mon, Sep 13, 2010 at 4:52 PM, Doug Adams f...@gmx.com wrote: Hello, We've got a dataset with several variables, one of which we're using to split the data into 3 smaller subsets. (as the variable takes 1 of 3 possible values). There are several more variables too, many of which we're using to fit regression models using lm. So I have 3 models fitted (one for each subset of course), each having slope estimates for the predictor variables. What we want to find out, though, is whether or not the overall slopes for the 3 regression lines are significantly different from each other. Is there a way, in R, to calculate the overall slope of each line, and test whether there's homogeneity of regression slopes? (Am I using that phrase in the right context -- comparing the slopes of more than one regression line rather than the slopes of the predictors within the same fit.) I hope that makes sense. We really wanted to see if the predicted values at the ends of the 3 regression lines are significantly different... But I'm not sure how to do the Johnson-Neyman procedure in R, so I think testing for slope differences will suffice! Thanks to any who may be able to help! Doug Adams __ 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. [[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] Sweave and graphs
On 14/09/2010 1:18 PM, Katie Surrence wrote: I set my working directory to the location of the file (which I called Demo.Rnw) and I type Sweave(Demo.Rnw) at the R command line. Does that answer your question properly? Yes, that looks fine. So the problem is likely with pdflatex, or maybe you haven't really solved the Sweave.sty problem yet. Do you run pdflatex locally, or do you try to run it from a different directory? I doubt if that would work, because the path to the images would be wrong. Do you have a file called demo-FigureExample.pdf after running Sweave, and does pdflatex produce a demo.log file containing something like this: demo-FigureExample.pdf, id=1, 433.62pt x 433.62pt File: demo-FigureExample.pdf Graphic file (type pdf) use demo-FigureExample.pdf [1 {C:/Users/murdoch/AppData/Local/MiKTeX/2.8/pdftex/config/pdftex.map}] [2 C:/te mp/demo-FigureExample.pdf] or does it contain some errors? Duncan Murdoch On Tue, Sep 14, 2010 at 12:08 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 14/09/2010 12:01 PM, Katie Surrence wrote: Hi all, Having solved my Sweave.sty question, I'd like to figure out why my pdf doesn't display the graph in my demo code. Here's the demo code I'm using: http://www.stat.berkeley.edu/~houston/demo.Rnwhttp://www.stat.berkeley.edu/%7Ehouston/demo.Rnw http://www.stat.berkeley.edu/%7Ehouston/demo.Rnw When I run Sweave within R (version 2.11) on the .Rnw it produces the histogram in the graphics device in R. When I then choose pdfLaTex in Miktex (version 2.8) on the file demo.tex, the resulting pdf correctly produces the table, but not the graph. Here's the code from the .tex file that isn't working to generate the graph: \begin{figure} \begin{center} \includegraphics{demo-FigureExample} \caption{This is my histogram for the the mean of 1000 samples of 10 N(0,1) random variables.} \label{fig:hist} \end{center} \end{figure} It works for me, so I'd guess it's something in your pipeline. How are you running Sweave? Duncan Murdoch __ 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] If then else with command for
Hey listers, I am trying to do something simple... Check the program below... I would like to create a variable named COLOR according to the conditions that I stablished... But the problem is that it seems that my variable COLOR is checking just on sample, may be last in the loop... Certainly, I am missing something... Thanks in advance, Marcio x-c(288,139,196,159,536,134,623,517,96,467,277,155,386,241,422,6263,612,532,250,412,339,55,290,249,164,97,74,144,1277,240,163,63,488,111,128,230,720,179,37,24,65,37,89,187,60,939,1008,81,310,58,169,38,68,190,78,807,220,226,69,179129,119,73,59,92,127,104,75,505,183,49,41,76,113,90,79,408,140,200,284,103,58,654,118,431,192,233,102,97,56,69,73,86,53,105,81,77,472,129,194,299,81,122,113,186,91,145,133,114,78,78,72,70,3471,641,275,815,149,185,172,240,67,526,122,229,298,317,179,233,66,129,87,82,63,65,72,6720,381,240,118,396,66,35,43,166,216,53,82,90,62,77,207,68,52,277,396,220,751,146,95,37,35,39,46,59,44,105,87,66,62,175,252,128,330,57,83,208,74,63,109,37,105,38,82,76,63,86,603,209,100,121,191,130,63,128,90,79,50,1025,121,87,309,75,189,36,82,84,60,132,46,965,155,132,219,112,53,90,66,100,77,52,60,100,153,418,392,76,130,197,262,49,105,87,70,147,720,342,233,203,249,92,134,231,782,184,182,432,49,63,94,124,69,53,91,451,53,21,42,50,40,32,58,26,28,61,60,35,764,105,592,55,28,46,34,123,4! 1,54,207,64,562,295,226,63,233) R-142 color-rep(0,142) for(i in 1:R){ x-sample(x,142,replace=FALSE) if (!3471 %in% x !6263 %in% x !6720 %in% x){color[i]-1} else if (3471 %in% x !6263 %in% x !6720 %in% x){color[i]-2} else if (!3471 %in% x 6263 %in% x !6720 %in% x){color[i]-3} else if (!3471 %in% x !6263 %in% x 6720 %in% x){color[i]-4} else if (3471 %in% x 6263 %in% x !6720 %in% x){color[i]-5} else if (3471 %in% x !6263 %in% x 6720 %in% x){color[i]-6} else if (!3471 %in% x 6263 %in% x 6720 %in% x){color[i]-7} else if (3471 %in% x 6263 %in% x 6720 %in% x){color[i]-8} else{color[i]-0} } -- View this message in context: http://r.789695.n4.nabble.com/If-then-else-with-command-for-tp2539341p2539341.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] Problem (environment?) with R CMD CHECK
2010/9/14 Uwe Ligges lig...@statistik.tu-dortmund.de: I do not see any problem, we'd need to look at the package in order to help, I think. I re-checked again and somehow the package now passes all checks, so I must have mistyped something somewhere. Sorry for that. Peter __ 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 I save my console contents automatically?
Look at the txtStart function in the TeachingDemos package. It (and related functions) can be used as a glorified sink that will save both a copy of the command issued (possibly reformatted) and the results (assuming the command runs without error). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Nobuaki Michihata Sent: Tuesday, September 14, 2010 8:34 AM To: r-help@r-project.org Subject: Re: [R] Can I save my console contents automatically? Dear All, I found a following solution from http://r.789695.n4.nabble.com/;. However this command can save only the result. Is there any good solution to save both commands themselves and the results. Thank you for your help. sink(Filename_here.log, type=c(output,message), split=TRUE) # Put commands here # However this method save only the results. sink() Nobu Message: 33 Date: Fri, 10 Sep 2010 07:07:37 -0700 From: Nobuaki Michihata gha10...@gmail.com To: r-help@r-project.org, r-help@r-project.org Subject: [R] Can I save my console contents automatically? Message-ID: aanlktimez-igqk6gzeyqerzatg7m+chjbgjmagmel...@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1 Dear All, I'm using R for Mac OS X Cocoa GUI R version 2.11.1. I can save contents of my console window by using command + s, but I would like to do same thing using R commands. My question is can I save the contents automatically by using R editor with some R commands. Thank you. Nobu __ 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] stratified Wilcoxon's rank sum test with the locally best weights
Hello, I have been informed that there is no R package for the stratified Wilcoxon's rank sum test (Van Elteren's test) with the locally best weights. I need to use the alternative test to a clinical endpoint where the distribution approximate normal distribution, and compare to the regular ANOVA. I have been directed to use SAS with PROC FREQ with the SCORES=modridit option and CMH2 (SAS only has the locally best weight option??) I will never go back to SAS, and believe a code for the above test already exists?? Thanks in advance Ahmed __ 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.