Re: [R] convert RData to txt
thank you for your reply,, i tried your commands but its not working,,i have attached the RData file,,which i want to convert into txt.. Ilyas On Mon, Oct 5, 2009 at 9:27 PM, Henrique Dallazuanna www...@gmail.comwrote: You can try something about like this: lapply(ls(), function(obj)cat(\n, obj, -, paste(deparse(get(obj)), collapse = \n), file = 'RData.txt', append = TRUE)) source('RData.txt') On Mon, Oct 5, 2009 at 4:00 AM, mykh...@gmail.com wrote: hello all, will you plz tell me how can i convert RData files to txt,,, __ 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.htmlhttp://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 __ 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 on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/09, Robert Wilkins iwriteco...@gmail.com wrote: Will R have more glitches on one operating system as opposed to another, Probably not. or is it pretty much the same? Depending on the complexity of the code, it is pretty much the same. I recently had a (relatively simple) group project, with the three of us on different OSs: Win, Mac and Linux. We did not encounter one platform specific issue. 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] else if statement error
David Winsemius wrote: On Oct 5, 2009, at 5:38 AM, Martin Maechler wrote: DW == David Winsemius dwinsem...@comcast.net on Sat, 3 Oct 2009 12:56:51 -0400 writes: DW On Oct 3, 2009, at 11:54 AM, Chen Gu wrote: Hello, I am doing a simple if else statement in R. But it always comes out error such as 'unexpected error' There are two variables. ini and b. when ini=1, a=3; when ini1 and b 2, a=5; all other situations, a=6. I don't know where it is wrong. Here is my code ini=3 b=4 DW Your basic problem is that you are confusing if and else which are DW program control functions with ifelse which is designed for assignment DW purposes; David, not quite: in R, everything(*) is a function, and in the example we have here (and innumerous similar examples) ifelse(.) is not efficient to use: ini=3 b=4 a - ifelse( ini==1, 3, ifelse( ini1 b2 , 5, 6)) a [1] 5 More efficient -- and also nicer in my eyes --- is a - if(ini == 1) 3 else if(ini 1 b 2) 5 else 6 No argument that is a bit more readable than my version above. I guessed that: a - 6 - 3*(ini == 1) - (ini 1 b 2) ... might be even more efficient, ... but 10^6 instances took almost twice as long as the if(){}else{} construction. The if else construction took 2e-06 seconds, the ifelse(,,) took 4.2e-05 seconds and the Boolean math version 3.45e-06 seconds. As I say on many occasions: ifelse() is useful and nice, but it is used in many more places than it should {BTW, not only because of examples like the above}. On the r-help list I see many more examples where (I thought) ifelse should have been used. I would be interested in seeing the other examples that you have in mind where it should not be used. On the principle that there are no new questions on r-help anymore, perhaps a link to a discussion from the archives could be more efficient? (I did try searching and have found some interesting material, but not on this particular point. A search for: if else ifelse efficien* came up empty when restricted to R-help.) The first rule is easy: As long as you are using scalar valued (i.e. length 1 vectors in R) cond, you should prefer if(cond) cons.expr else alt.expr rather than ifelse(cond, yes, no) because the latter one evaluates both yes and no while the former one evaluates exactly one of both expressions. Moreover, if yes and no are not really trivial, the penalty of evaluating both of them should be considered. Best, Uwe Ligges Martin Maechler, ETH Zurich (*) almost -- David Winsemius, MD Heritage Laboratories 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. __ 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] Visualizing some data
Try also to look at lattice or ggplot2. Regards Petr r-help-boun...@r-project.org napsal dne 05.10.2009 23:45:48: See http://addictedtor.free.fr/graphiques/ for many examples with code. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of sverre Sent: Monday, October 05, 2009 1:13 PM To: r-help@r-project.org Subject: [R] Visualizing some data Hi all, I have an easy data set. It has three columns: Subject, Condition, dprime. A small excerpt follows, in order to illustrate: Subject Condition dprime HY s 3.725846 CM s 2.877658 EH s 5 HY st 2.783553 CM st 2.633955 EH st 5 I want to visualize this. What I thought of was having dprime on the y-axis (scale 0-5), Subject on the x-axis, and then two lines plotted to show the dprime value for condition s and condition st. I would like s to be plotted with a solid line and st plotted as a dashed line. I assume this is very easy. I just have no idea how to do it. I would greatly appreciate any help. Thanks. -- View this message in context: http://www.nabble.com/Visualizing-some-data-tp25756996p25756996.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. __ 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] Date-Time-Stamp input method for user-specific formats
Thank you all who replied, I will try out these ideas later today. David Esp -- View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25763935.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] 'persp' query
Hi All I'm creating some 3-D plots using the function 'persp', and have a query regarding the ability to make changes to the label of the z-axis. There are two things I would like to do. First, the default setting places the label a little close to the axis for my liking. Is there any way of moving the label? I've tried adjustments with 'mgp' in 'par', but without success. The second is to change the direction of the label. Currently it reads top to bottom, whereas I would like it to read bottom to top, as per a y-axis on a standard plot. Is there anyway of doing so? Would greatly appreciate any advice! Much thanks Geoff __ 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 NLTM package
Dear R users, I have a question concerning the nltm package. Before posting to the R list I first contacted the author of the package twice but no succes. May be I've got the wrong email! My question is about the object surv given in the package nltm. As explained, the object surv represents the MLE estimates of the baseline survival function evaluated at the estimated profile likelihood parameters. When I extracted this baseline survival function using surv I was surprised by the fact that almost all its values are close to 1. I thought maybe because It is a simulated example. So I used the same example provided in the package using the PH family in nltm.model and then I compared the estimated baseline survival with the one provided by the usual coxph package. As a result, the parameters theta are similar as expected BUT the estimated baseline survivals are completely different. Am missing something here? I would be really very grateful if anyone can let me know where I am! wrong. The examples are as follows: # fit a Cox PH Model using nltm package data(melanoma) fit.nltm - nltm(Surv(time,status) ~ size + age, data=melanoma, nlt.model=PH) surv.nltm - fit.nltm$surv # fit a Cox PH model using coxph package data(melanoma) fit.coxph - coxph(Surv(time,status) ~ size + age, data=melanoma) surv.coxph - summary(survfit(fit.coxph))[[1]] The finite-dimension parameters theta in fit.nltm and fit.coxph are similar but as you can see surv.nltm and surv.coxph are completey different. Furthermore, fit.nltm have all values close to 1. All the bests Abderrahim [[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] previous.best in metaMDS
Dear R-community, dear Jari Oksanen! I use metaMDS (package vegan) to calculate NMDS. In a lot of papers I read that it is recommended to use previous best solutions as a new starting configuration to get better results and to avoid local minima. On the help page I found that a previous.best-command is already implemented in metaMDS: metaMDS(comm, distance = bray, ...,plot = FALSE, previous.best,...) But unfortunately I did not manage to use it properly. When I run metaMDS without command previous.best I certainly get a result. I run it again with command previous.best and I get this message: Fehler in metaMDS(data... : object previous.best not found My question: How can I save the best solution and use it in the next NMDS. I also tried to type in the command: previous.best = TRUE Then I get the message: Starting from a previous solution Fehler in s0$stress : $ operator is invalid for atomic vectors Could you please help me? Thank you very much, Kim -- für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02 __ 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] Interpolation
Hi R community I need to interpolate precipitation data for a natural park. I have precipitation data from some climate stationts. (I know the table is not complete but I only need to show you X,Y, Altitude and PrepJul) X Y Altitude PrepJan PrepFeb PrepMar PrepAp PrepMay PrepJun PrepJul 597706 4093438 41 0 9 77,8 63,1 17,5 0 2,6 597535 4088967 202 0 11,3 67,9 70,8 12,1 0 0,6 572307 4064892 41 1 9,5 22 40,5 2,5 0 0 571059 4074743 50 2,4 13,9 31,3 63,3 8,1 0 1,4 570795 4091537 356 0 15 79 86 19,5 1 0 554563 4077703 20 5,2 15,6 43,4 64,5 15 0,2 0 575091 4089921 183 1,2 13,2 64,6 70,6 16,2 0,2 3,4 The area where this data must be interpolated in the natural park with an irregular shape inside of a grid of 2190 lines and 2282 columns with utm coordinates. I have tried Krig from fields package. A created a matrix with independant data (a) and a vector with dependant data (b). a-matrix(c(clima$X,clima$Y,clima$Altitud),,3) b-clima$PrepJul Interpolation-Krig(a,b) mapa-predict.surface(interpolacion, nx=2190, ny=2282) str(mapa) num [1:2190] 554563 554583 554602 554622 554642 ... $ y: num [1:2282] 4064892 4064905 4064917 4064930 4064942 ... $ z: num [1:2190, 1:2282] NA NA NA NA NA NA NA NA NA NA ... NA values are due to the fact that outside of the natural park there isn't precipitation registred. NA values are not a problem. I write the result to ENVI with write.ENVI from Catools package. And the result is an image but data interpolated don't follow the natural park limits, the image of interpolated data don't macht the area of the natural park. And I don't know how to solve this. If anyone know any possible reason or any suggestion to do an interpolation, I would be really grateful. Lucas _ [[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] Extracting year from a date object
Hi all, this one left me a bit puzzled, as I don't seem to find a function to perform this easily. I must have overlooked the obvious, so sorry in advance. I have a list of dates in numerical format (i.e. 34576), defined as the number of days that passed since january 1st 1900. So I apply the function : MyDate -as.Date(34576,origin=1900-01-01) MyDate [1] 1994-09-01 But then I want to do something like : MyYear - a.year.function(MyDate) MyYear should have the numerical value 1994. Alas, I don't find any function like that. I know I can take a substring of MyDate and convert to numeric, or even use the function seq() : length ( seq ( as.Date(1900-01-01), MyDate, years ) ) + 1900 - 1 [1] 1994 but that seems quite a way around. Can somebody tell me where the appropriate function is hiding? Thank you in advance. Joris __ 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] Odp: Extracting year from a date object
r-help-boun...@r-project.org napsal dne 06.10.2009 11:39:51: Hi all, this one left me a bit puzzled, as I don't seem to find a function to perform this easily. I must have overlooked the obvious, so sorry in advance. I have a list of dates in numerical format (i.e. 34576), defined as the number of days that passed since january 1st 1900. So I apply the function : MyDate -as.Date(34576,origin=1900-01-01) MyDate [1] 1994-09-01 But then I want to do something like : MyYear - a.year.function(MyDate) MyYear should have the numerical value 1994. Alas, I don't find any function like that. I know I can take a substring of MyDate and convert to numeric, or even use the function seq() : E.g. as.numeric(format(MyDate, %Y)) [1] 1994 Regards Petr length ( seq ( as.Date(1900-01-01), MyDate, years ) ) + 1900 - 1 [1] 1994 but that seems quite a way around. Can somebody tell me where the appropriate function is hiding? Thank you in advance. Joris __ 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] Kernlab: multidimensional targets in rvm(), ksvm(), gausspr()
Hi there, I'm trying to do a regression experiment on a multidimensional dataset where both x and y in the model are multidimensional vectors. I'm using R version 2.9.2, updated packages, on a Linux box. I've tried gausspr(), ksvm() and rvm(), and the models are computed fine, but I'm always getting the same error message when I try to use predict(): Error in .local(object, ...) : test vector does not match model ! I realize that maybe kernlab does not support the kind of operation I'm trying to do, but I still haven't found any explicit statement saying that multidimensional targets are not supported... Do you have any suggestions? Is there a way to avoid the error in kernlab? Any alternative approaches (other that drastically reducing dimensionality...)? Thanks a lot for your support! E.G. Here's a toy example that produces the error message: # build x and y matrices x - sample(seq(-20,20,0.1), 100) y - sin(x)/x + rnorm(100,sd=0.05) x - matrix(x, nrow=25, ncol=4) y - matrix(y, nrow=25, ncol=4) # build the model: seems successful foo - rvm(x, y) # same with ksvm(), gausspr(), ecc. Using automatic sigma estimation (sigest) for RBF or laplace kernel foo Relevance Vector Machine object of class rvm Problem type: regression Gaussian Radial Basis kernel function. Hyperparameter : sigma = 0.00179432103430767 Number of Relevance Vectors : 7 Variance : 0.05937295 Training error : 0.049660537 # but predict fails... predict(foo, x) Error in .local(object, ...) : test vector does not match model ! ** Emiliano R. Guevara Institutt for lingvistiske og nordiske studier -- Universitetet i Oslo PO Box 1102, Blindern, 0317 Oslo, Norway __ 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] italics help in plot
Part of my script reads: speciesName - names(data)[i] plot(year,depth, xlab=Year, ylab=Depth(m),main=expression(italic(paste(speciesName))) ) Unfortunately, this just plots *speciesName *on my graph, not the name of the species in italics. Any suggestions on how to resolve this? Thank you Jacob [[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 load 'doBy' package
Hi all, I am trying to load the doBy package, and I am getting the following error: library(doBy) Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : there is no package called 'Hmisc' Error: package/namespace load failed for 'doBy' I tried updating R to the current version (2.9.2) and installing the most recent version of the doBy package (4.0.2), and the error remained the same. I also tried loading the package by going to my Package Manager window and clicking the box to load 'doBy', but that didn't work either. My other packages (e.g., lattice, chron, etc.) are loading normally with no problems. If you have any suggestions for how I can get doBy to load, please let me know. Thanks very much, Lauren [[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] R on Linux, and R on Windows , any difference in maturity+stability?
I had a large job time ago that ran fine under MacOS X. I'd expect the same to be true under Linux. It would run under Windows XP only if XP had been freshly rebooted. John Maindonald email: john.maindon...@anu.edu.au phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. On 06/10/2009, at 9:00 PM, r-help-requ...@r-project.org wrote: From: Liviu Andronic landronim...@gmail.com Date: 6 October 2009 6:46:33 PM AEDT To: Robert Wilkins iwriteco...@gmail.com Cc: r-help@r-project.org Subject: Re: [R] R on Linux, and R on Windows , any difference in maturity+stability? On 10/6/09, Robert Wilkins iwriteco...@gmail.com wrote: Will R have more glitches on one operating system as opposed to another, Probably not. or is it pretty much the same? Depending on the complexity of the code, it is pretty much the same. I recently had a (relatively simple) group project, with the three of us on different OSs: Win, Mac and Linux. We did not encounter one platform specific issue. Liviu [[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] italics help in plot
Hi, Try this, x= my title plot(1,1, main = bquote(italic(.(x HTH, baptiste 2009/10/6 Jacob Kasper jacobkas...@gmail.com: Part of my script reads: speciesName - names(data)[i] plot(year,depth, xlab=Year, ylab=Depth(m),main=expression(italic(paste(speciesName))) ) Unfortunately, this just plots *speciesName *on my graph, not the name of the species in italics. Any suggestions on how to resolve this? Thank you Jacob [[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] R on Linux, and R on Windows , any difference in maturity+stability?
On 06/10/2009 6:36 AM, John Maindonald wrote: I had a large job time ago that ran fine under MacOS X. I'd expect the same to be true under Linux. It would run under Windows XP only if XP had been freshly rebooted. That sounds like you were running out of memory, or it was a bug. Did you report it? Duncan Murdoch John Maindonald email: john.maindon...@anu.edu.au phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. On 06/10/2009, at 9:00 PM, r-help-requ...@r-project.org wrote: From: Liviu Andronic landronim...@gmail.com Date: 6 October 2009 6:46:33 PM AEDT To: Robert Wilkins iwriteco...@gmail.com Cc: r-help@r-project.org Subject: Re: [R] R on Linux, and R on Windows , any difference in maturity+stability? On 10/6/09, Robert Wilkins iwriteco...@gmail.com wrote: Will R have more glitches on one operating system as opposed to another, Probably not. or is it pretty much the same? Depending on the complexity of the code, it is pretty much the same. I recently had a (relatively simple) group project, with the three of us on different OSs: Win, Mac and Linux. We did not encounter one platform specific issue. Liviu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Spatial Autocorrelation
Hello, I have a matrix with the distances among sites. And I have another matrix with the presence and absence of each species in each site. I would like to test the spatial autocorrelation among sites. I have tried to use the function gearymoran of the ade4 package, but error messages keep popping up. Do you know any function for me to test the spatial autocorrelation of my data? Thanks, Paulo Branco -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25767010.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] Extracting year from a date object
See ?weekdays, which says Note: Other components such as the day of the month or the year are very easy to compute: just use 'as.POSIXlt' and extract the relevant component. so as.POSIXlt(MyDate)$year+1900 [1] 1994 is how you are expected to do it. On Tue, 6 Oct 2009, joris meys wrote: Hi all, this one left me a bit puzzled, as I don't seem to find a function to perform this easily. I must have overlooked the obvious, so sorry in advance. I have a list of dates in numerical format (i.e. 34576), defined as the number of days that passed since january 1st 1900. So I apply the function : MyDate -as.Date(34576,origin=1900-01-01) MyDate [1] 1994-09-01 But then I want to do something like : MyYear - a.year.function(MyDate) MyYear should have the numerical value 1994. Alas, I don't find any function like that. I know I can take a substring of MyDate and convert to numeric, or even use the function seq() : length ( seq ( as.Date(1900-01-01), MyDate, years ) ) + 1900 - 1 [1] 1994 but that seems quite a way around. Can somebody tell me where the appropriate function is hiding? Thank you in advance. Joris __ 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Unable to load 'doBy' package
Hi Lauren, from the error message it looks like you have a problem with the package Hmisc. doBy is dependent on that one. Can you check whether Hmisc is installed in your R version? For me, doBy loads without problems. On Tue, Oct 6, 2009 at 12:18 PM, Lauren Szathmary lszathm...@gmail.com wrote: Hi all, I am trying to load the doBy package, and I am getting the following error: library(doBy) Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : there is no package called 'Hmisc' Error: package/namespace load failed for 'doBy' I tried updating R to the current version (2.9.2) and installing the most recent version of the doBy package (4.0.2), and the error remained the same. I also tried loading the package by going to my Package Manager window and clicking the box to load 'doBy', but that didn't work either. My other packages (e.g., lattice, chron, etc.) are loading normally with no problems. If you have any suggestions for how I can get doBy to load, please let me know. Thanks very much, Lauren [[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] Date-Time-Stamp input method for user-specific formats
See below. On Mon, Oct 5, 2009 at 6:50 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this. First we read a line at a time into L except for the header. Then we use strapply to match on the given pattern. It passes the backreferences (the portions within parentheses in the pattern) to the function (defined via a formula) whose implicit arguments are x, y and z. That function returns two columns which are in the required form so that in the next statement we convert one to chron and the other to numeric. See R News 4/1 for more about dates and times. library(gsubfn) # strapply library(chron) # as.chron Lines - DATETIME FREQ 01/09/2009 59.036 01/09/2009 00:00:01 58.035 01/09/2009 00:00:02 53.035 01/09/2009 00:00:03 47.033 01/09/2009 00:00:04 52.03 01/09/2009 00:00:05 55.025 L - readLines(Lines)[-1] This line should be L - readLines(textConnection(Lines))[-1] pat - (../../) (..:..:..){0,1} *([0-9.]+) s - strapply(L, pat, ~ c(paste(x, y, 00:00:00), z), simplify = rbind) fmt - %m/%d/%Y %H:%M:%S DF - data.frame(Time = as.chron(s[,1], fmt), Freq = as.numeric(s[,2])) DF The final output looks like this: DF Time Freq 1 (01/09/09 00:00:00) 59.036 2 (01/09/09 00:00:01) 58.035 3 (01/09/09 00:00:02) 53.035 4 (01/09/09 00:00:03) 47.033 5 (01/09/09 00:00:04) 52.030 6 (01/09/09 00:00:05) 55.025 If the times are unique you could consider making a zoo object out of it by replacing the DF- statement with: library(zoo) z - zoo(as.numeric(s[,2]), as.chron(s[,1], fmt)) See the three vignettes in the zoo package. On Mon, Oct 5, 2009 at 5:14 PM, esp davidgary...@gmail.com wrote: Date-Time-Stamp input method to correctly interpret user-specific formats:coding is 90% there - based on exmple at http://tolstoy.newcastle.edu.au/R/help/05/02/12003.html ...anyone got the last 10% please? CONTEXT: Data is received where one of the columns is a datetimestamp. At midnight, the value represented as text in this column consists of just the date part, e.g. 01/09/2009. At other times, the value in the column contains both date and time e.g. 01/09/2009 00:00:01. The goal is to read it into R as an appropriate data type, where for example date arithmetic can be performed. As far as I can tell, the most appropriate such data type is POSIXct. The trick then is to read in the datetimestamps in the data as this type. PROBLEM: POSIXct defaults to a text representation almost but not quite like my received data. The main difference is that the POSIXct date part is in reverse order, e.g. 2009-09-01. It is possible to define a different format where date and time parts look like my data but when encountering datetimestamps where only the the date part is present (as in the case of my midnight data) then this is interpreted as NA i.e. undefined. SOLUTION (ALMOST): There is a workaround (based on example at http://tolstoy.newcastle.edu.au/R/help/05/02/12003.html). It is possible to define a class then read the data in as this class. For such a class it is possible to define a class method, in terms of a function, for translating a text (character string) representation into a value. In that function, one can use a conditional expression to treat midnight datetimestamps differently from those at other times of day. The example below does that. In order to apply this function over all of the datetimestamp values in the column, it is necessary to use something like R's 'sapply' function. SNAG: The function below implements this approach. A datetimestamp with only the date part, including leading zeroes, is always length 10 (characters). It correctly interprets the datetimestamp values, but unfortunately translates them into what appear to be numeric type. I am actually uncertain precisely what is happening, as I am very new to R and have most certainly stretched myself in writing this code. I think perhaps it returns a list and something associated with this aspect makes it forget the data type is POSIXct or at least how such a type should be displayed as text or what to do about it. PLEA: Please, can anyone give any help whatsoever, however tenuous? CODE, DATA RESULTS: Function to Read required data, intended to make the datetime column of the data (example given further below) into POSIXct values: spot_frequency_readin - function(file,nrows=-1) { # create temp class setClass(t_class2_, representation(character)) setAs(character, t_class2_, function(from) {sapply(from, function(x) { if (nchar(x)==10) { as.POSIXct(strptime(x,format=%d/%m/%Y)) } else { as.POSIXct(strptime(x,format=%d/%m/%Y %H:%M:%S)) } } ) } ) #(for format symbols, see R Reference Card) # read the file (TSV) file - read.delim(file, header=TRUE, comment.char = , nrows=nrows, as.is=FALSE, col.names=c(DATETIME, FREQ), colClasses=c(t_class2_, numeric) ) # remove it now that
[R] Linear mixed effects model ?
I am looking for some advice on an appropriate statistical analysis in R *Experimental question* : We are interested in how communities from different streams may vary in their response to experimental temperature. Specifically we are interested to test for differences in the slope and intercept of the relationship between temperature and oxygen consumption between the different stream communities. *Outline of experiment* There were four streams and from each we took samples which had a characteristic community of organisms. These four different communities are labelled “S1,.. S4. Each ‘Stream’ was incubated together in the same water bath at six temperatures in succession, giving covariates (~ 5,10,15,20,25,and 30°C) to the factor “Temp”. However this also meant six repeated measures were made on the same ‘Stream’ over time. As time between incubations varied ‘Time’ is given a categorical label a,f. This procedure was repeated four times using different samples from the same streams, thus giving ‘Replicates’ labelled 1,...4. Each ‘Replicate’ had different temperature values but always six values in total. The response variable measured in all 96 incubations, was the rate at which the communities consumed oxygen over a given time in incubation: ‘Rate’ Some incubation’s were excluded (5 from 96) *Models* Ideally we would do an ANCOVA to test for differences in slope or intercepts for the different streams. However as there were repeated measures and unequal n and unbalanced design, I have used a linear mixed effect model (from nlme package in R) in the form: model - lme (Rate ~ Temp* Stream, random = ~ Time|Replicate) *Question* : Do these models appropriately account for the temporal / spatial pseudoreplication in the experimental design ? Many thanks in advance Daniel __ 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] Letter-based representation of pairwise comparisons
hello, i try to use the multcomp letters, but i have problems with my results : here is my pvalue matrix (from a pairwise.t.test) : pair=pairwise.t.test(...) pair$p.value 0 BBxS B0.01727- - BxS 0.000130.00226 - S0.875550.02610 0.00027 i was thiking to have something like that : 0 B S BxS a b a c but function return : multcompLetters(pair$p.value) B BxS S a b a first question : why the 0 traitement doesn't appears in result ? second : why the results differs than what i expected ? many thanks. -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25767357.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] Unable to load 'doBy' package
Hi all, I am trying to load the doBy package, and I am getting the following error: library(doBy) Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : there is no package called 'Hmisc' Error: package/namespace load failed for 'doBy' I tried updating R to the current version (2.9.2) and installing the most recent version of the doBy package (4.0.2), and the error remained the same. I also tried loading the package by going to my Package Manager window and clicking the box to load 'doBy', but that didn't work either. My other packages (e.g., lattice, chron, etc.) are loading normally with no problems. If you have any suggestions for how I can get doBy to load, please let me know. Thanks very much, Lauren [[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] Viewing specific data from a dataframe
Dear R users, Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is 0.8? This is the code I'm using to date cor(data, method=spearman) Kind regards Krys _ Save time by using Hotmail to access your other email accounts. [[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] Spatial Autocorrelation
Hi Paulo, you may want to take a look at http://cran.r-project.org/web/views/Spatial.html there, you can find all spatial packages that can be useful for your question. There is also a a mailing list R-sig-geo that where you can ask all those kind of question. Hope that this helps. Cheers Anna Anna Freni Sterrantino Ph.D Student Department of Statistics University of Bologna, Italy via Belle Arti 41, 40124 BO. Da: P.Branco pjlbra...@yahoo.com A: r-help@r-project.org Inviato: Martedì 6 ottobre 2009, 13:28:36 Oggetto: [R] Spatial Autocorrelation Hello, I have a matrix with the distances among sites. And I have another matrix with the presence and absence of each species in each site. I would like to test the spatial autocorrelation among sites. I have tried to use the function gearymoran of the ade4 package, but error messages keep popping up. Do you know any function for me to test the spatial autocorrelation of my data? Thanks, Paulo Branco -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25767010.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. __ spazio gratuito per i tuoi file e i messaggi [[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] convert RData to txt
The file don't load in my computer, this give me a fatal error message. On Tue, Oct 6, 2009 at 1:09 AM, Ilyas . mykh...@gmail.com wrote: thank you for your reply,, i tried your commands but its not working,,i have attached the RData file,,which i want to convert into txt.. Ilyas On Mon, Oct 5, 2009 at 9:27 PM, Henrique Dallazuanna www...@gmail.com wrote: You can try something about like this: lapply(ls(), function(obj)cat(\n, obj, -, paste(deparse(get(obj)), collapse = \n), file = 'RData.txt', append = TRUE)) source('RData.txt') On Mon, Oct 5, 2009 at 4:00 AM, mykh...@gmail.com wrote: hello all, will you plz tell me how can i convert RData files to txt,,, __ 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 -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] 'persp' query
Geoff, One way (the only way without modifying source code?) to satisfy your first wish is to insert a newline before your label as in zlab = \nMy z-text. I don't know of an answer for your second wish other than using the single letter Z as your label :) -Peter Ehlers Geoffrey William Heard wrote: Hi All I'm creating some 3-D plots using the function 'persp', and have a query regarding the ability to make changes to the label of the z-axis. There are two things I would like to do. First, the default setting places the label a little close to the axis for my liking. Is there any way of moving the label? I've tried adjustments with 'mgp' in 'par', but without success. The second is to change the direction of the label. Currently it reads top to bottom, whereas I would like it to read bottom to top, as per a y-axis on a standard plot. Is there anyway of doing so? Would greatly appreciate any advice! Much thanks Geoff __ 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] Viewing specific data from a dataframe
Hi, I'm not sure I understand what you want. This would have been easier if you had provided a reproducible example. See the following code: bla = matrix(runif(1), 10, 10) cor_bla = cor(bla, method = spearman) Now what do you want to select. All the variables that have a correlation higher than 0.8 with any of the other variables, excluding themselves? Or a correlation higher than 0.8 in contrast to one of the variables, e.g. the third variable? cheers, Paul Krystyna Golabek wrote: Dear R users, Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is 0.8? This is the code I'm using to date cor(data, method=spearman) Kind regards Krys _ Save time by using Hotmail to access your other email accounts. [[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. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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] save wmf with a batch file
Hi R users, I'm working on a autoreporting with the batch mode of R: I would like to save the graphs produced in wmf or emf. the problem is, it's working well with the R gui because we print on the screen the graph devices but not with the batch. I have used the function dev.print after encounter problem with win.metafile. Thanks Guillaume [[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] 'persp' query
On Oct 6, 2009, at 4:46 AM, Geoffrey William Heard wrote: Hi All I'm creating some 3-D plots using the function 'persp', and have a query regarding the ability to make changes to the label of the z- axis. There are two things I would like to do. First, the default setting places the label a little close to the axis for my liking. Is there any way of moving the label? I've tried adjustments with 'mgp' in 'par', but without success. The second is to change the direction of the label. Currently it reads top to bottom, whereas I would like it to read bottom to top, as per a y-axis on a standard plot. Is there anyway of doing so? ?mtext # and use the adj argument -- David Winsemius, MD Heritage Laboratories 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] save wmf with a batch file
On 10/6/2009 9:05 AM, guillaume Le Ray wrote: Hi R users, I'm working on a autoreporting with the batch mode of R: I would like to save the graphs produced in wmf or emf. the problem is, it's working well with the R gui because we print on the screen the graph devices but not with the batch. I have used the function dev.print after encounter problem with win.metafile. You should be using win.metafile. What problems did you have? 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] Viewing specific data from a dataframe
Hi Krys, Please also cc all you responses to the list, keeping the conversation in the archives. The following code might be of help to you: set.seed(1) bla = matrix(runif(1), 10, 10) colnames(bla) = LETTERS[1:ncol(bla)] cor_bla = cor(bla, method = spearman) # Assign NA to all values below 0.7 or equal to 1 cor_bla[cor_bla 0.7 | cor_bla == 1] = NA # Are there any variables that have a correlation with another variable # that is not NA, those are the ones you want apply(cor_bla, 2, function(x) any(!is.na(x))) # Show the names of the columns that fit the conditions rownames(cor_bla)[apply(cor_bla, 2, function(x) any(!is.na(x)))] cheers, Paul Paul Hiemstra wrote: Hi, I'm not sure I understand what you want. This would have been easier if you had provided a reproducible example. See the following code: bla = matrix(runif(1), 10, 10) cor_bla = cor(bla, method = spearman) Now what do you want to select. All the variables that have a correlation higher than 0.8 with any of the other variables, excluding themselves? Or a correlation higher than 0.8 in contrast to one of the variables, e.g. the third variable? cheers, Paul Krystyna Golabek wrote: Dear R users, Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is 0.8? This is the code I'm using to date cor(data, method=spearman) Kind regards Krys _ Save time by using Hotmail to access your other email accounts. [[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. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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 fit time varying coefficient regression model?
Dear rh, You may take a look at package dlm. A vignette is included in the documentation. Giovanni Date: Mon, 05 Oct 2009 22:30:05 -0400 From: R_help Help rhelp...@gmail.com Sender: r-help-boun...@r-project.org Precedence: list DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; Hi - I read through dse package manual a bit. I'm not quite certain how I can use it to estimate a time varying coefficient regression model? I might pick up an inappropriate package. Any suggestion would be greatly appreciated. Thank you. rh __ 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. -- Giovanni Petris gpet...@uark.edu Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/ __ 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] Spatial Autocorrelation
Hi Paulo, if your data are distance matrices, you might consider doing a Mantel test, look at the mantel() function in package vegan. While this is not technically measuring spatial autocorrelation, it will test for correlation between the attribute distances and the geographic distances. Also, if you can coax your data back into a point shapefile (for example), you can use the tools in the spdep package which will measure actual spatial autocorrelation (such as Moran's I and Geary's C). Best, Corey silcha wrote: Hi Paulo, you may want to take a look at http://cran.r-project.org/web/views/Spatial.html there, you can find all spatial packages that can be useful for your question. There is also a a mailing list R-sig-geo that where you can ask all those kind of question. Hope that this helps. Cheers Anna Anna Freni Sterrantino Ph.D Student Department of Statistics University of Bologna, Italy via Belle Arti 41, 40124 BO. Da: P.Branco pjlbra...@yahoo.com A: r-help@r-project.org Inviato: Martedì 6 ottobre 2009, 13:28:36 Oggetto: [R] Spatial Autocorrelation Hello, I have a matrix with the distances among sites. And I have another matrix with the presence and absence of each species in each site. I would like to test the spatial autocorrelation among sites. I have tried to use the function gearymoran of the ade4 package, but error messages keep popping up. Do you know any function for me to test the spatial autocorrelation of my data? Thanks, Paulo Branco -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25767010.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. __ spazio gratuito per i tuoi file e i messaggi [[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. -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25768890.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] save wmf with a batch file
On 10/6/2009 9:45 AM, guillaume Le Ray wrote: I have a window with unable to create metafile I think it is because I'm using the function layout() in some of my graphs I doubt if that's the cause. More likely it's a permissions problem, or some other problem. For example, this works fine: win.metafile(c:/temp/test.wmf) layout(matrix(1:4, 2,2)) plot(1) plot(2) dev.off() null device 1 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] else if statement error
2009/10/6 Uwe Ligges lig...@statistik.tu-dortmund.de: The first rule is easy: As long as you are using scalar valued (i.e. length 1 vectors in R) cond, you should prefer if(cond) cons.expr else alt.expr rather than ifelse(cond, yes, no) because the latter one evaluates both yes and no while the former one evaluates exactly one of both expressions. I don't think that that is true. The false leg was not evaluated here: ifelse(TRUE, { cat(a); 1}, {cat(b); 2}) a[1] 1 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Letter-based representation of pairwise comparisons
On Oct 6, 2009, at 8:41 AM, goz wrote: hello, i try to use the multcomp letters, but i have problems with my results : here is my pvalue matrix (from a pairwise.t.test) : pair=pairwise.t.test(...) pair$p.value 0 BBxS B0.01727- - BxS 0.000130.00226 - S0.875550.02610 0.00027 i was thiking to have something like that : 0 B S BxS a b a c but function return : multcompLetters(pair$p.value) B BxS S a b a first question : why the 0 traitement doesn't appears in result ? But there is a 0 column. ??? second : why the results differs than what i expected ? Because your understanding of what it means to have pairwise comparisons differs from that of the author's. many thanks. -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25767357.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. David Winsemius, MD Heritage Laboratories 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.
[R] Plot
Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! [[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] ggplot cumsum refined question (?)
OK, so maybe last night was a little too much at one throw, so I have reduced the data to two stations- one that has precipitation and one that does not. This is going to be in the context of a larger data set. I would like to be able to issue a ggplot command and have cum sum just act on the facets (factors) to apply this. library(chron) library(ggplot2) DF - structure(list(date_time = structure(c(14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522.677083, 14522.6875, 14522.697917, 14522.708333, 14522.71875, 14522.729167, 14522.739583, 14522.75, 14522.760417, 14522.770833, 14522.78125, 14522.791667, 14522.802083, 14522.8125, 14522.822917, 14522.83, 14522.84375, 14522.854167, 14522.864583, 14522.875, 14522.885417, 14522.895833, 14522.90625, 14522.916667, 14522.927083, 14522.9375, 14522.947917, 14522.958333, 14522.96875, 14522.979167, 14522.989583, 14523, 14523.010417, 14523.020833, 14523.03125, 14523.041667, 14523.052083, 14523.0625, 14523.072917, 14523.08, 14523.09375, 14523.104167, 14523.114583, 14523.125, 14523.135417, 14523.145833, 14523.15625, 14523.17, 14523.177083, 14523.1875, 14523.197917, 14523.208333, 14523.21875, 14523.229167, 14523.239583, 14523.25, 14523.260417, 14523.270833, 14523.28125, 14523.291667, 14523.302083, 14523.3125, 14523.322917, 14523.33, 14523.34375, 14523.354167, 14523.364583, 14523.375, 14523.385417, 14523.395833, 14523.40625, 14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522.677083, 14522.6875, 14522.697917, 14522.708333, 14522.71875, 14522.729167, 14522.739583, 14522.75, 14522.760417, 14522.770833, 14522.78125, 14522.791667, 14522.802083, 14522.8125, 14522.822917, 14522.83, 14522.84375, 14522.854167, 14522.864583, 14522.875, 14522.885417, 14522.895833, 14522.90625, 14522.916667, 14522.927083, 14522.9375, 14522.947917, 14522.958333, 14522.96875, 14522.979167, 14522.989583, 14523, 14523.010417, 14523.020833, 14523.03125, 14523.041667, 14523.052083, 14523.0625, 14523.072917, 14523.08, 14523.09375, 14523.104167, 14523.114583, 14523.125, 14523.135417, 14523.145833, 14523.15625, 14523.17, 14523.177083, 14523.1875, 14523.197917, 14523.208333, 14523.21875, 14523.229167, 14523.239583, 14523.25, 14523.260417, 14523.270833, 14523.28125, 14523.291667, 14523.302083, 14523.3125, 14523.322917, 14523.33, 14523.34375), format = structure(c(m/d/y, h:m:s), .Names = c(dates, times)), origin = structure(c(1, 1, 1970), .Names = c(month, day, year)), class = c(chron, dates, times)), gauge = c(2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L, 2102908L,
[R] Fwd: Long for Loop- calling C from R - Parallel Computing
-- Forwarded message -- From: Antonio Paredes antonioparede...@gmail.com Date: Tue, Oct 6, 2009 at 9:41 AM Subject: Re: [R] Long for Loop- calling C from R - Parallel Computing To: Karl Ove Hufthammer k...@huftis.org Hello again, I'm hoping to get a response from some of the R gurus in this list. Is my assumption that R is not designed or build to deal with high levels (a lots of simulated data) simulation correct. For example, how to minimize system time; do one have to call a lower level language like C or Fortran; or just, like many of you have done, do a lots of programing in R and eventually the tricks will be learned. Thanks On Mon, Oct 5, 2009 at 8:35 AM, Antonio Paredes antonioparede...@gmail.comwrote: In my case it does, because I need to preserved a high level of independence (lack of correlation) among the different groups of 60. Also, when I say final result I mean computation of standard errors and that source of stuff; sorry about the lack clarity in my statement. On Mon, Oct 5, 2009 at 9:48 AM, Karl Ove Hufthammer k...@huftis.orgwrote: In article 6f6f0fd60910050629p28c99209jcd7836353fd2d754 @mail.gmail.com, antonioparede...@gmail.com says... I'm running the following for loop to generate random variables in chunks of 60 at a time (l), here h is of order in millions (could be 5 to 6 millions), note that generating all the variables at once could have an impact on the final results No, it will not. See this example code for an illustration: set.seed(1) rnorm(3) rnorm(3) set.seed(1) rnorm(6) So if you generate the six numbers three at a time or all at once gives exactly the same result. So my suggestion is to generate all the numbers at once. That takes next to no time. Or, if it takes too much memory, generate for example a million at once, and repeat a few times. -- Karl Ove Hufthammer __ 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. -- -Tony -- -Tony -- -Tony [[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] else if statement error
Gabor Grothendieck wrote: 2009/10/6 Uwe Ligges lig...@statistik.tu-dortmund.de: The first rule is easy: As long as you are using scalar valued (i.e. length 1 vectors in R) cond, you should prefer if(cond) cons.expr else alt.expr rather than ifelse(cond, yes, no) because the latter one evaluates both yes and no while the former one evaluates exactly one of both expressions. I don't think that that is true. The false leg was not evaluated here: ifelse(TRUE, { cat(a); 1}, {cat(b); 2}) a[1] 1 Ah, indeed that changed at some point and I forgot that the code checks for the length of cond nowadays. Thanks for pointing it out. Best wishes, 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] Plot
Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote: Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot cumsum refined question (?)
Dear Stephen, It is much easier to do you data preparation before plotting. Cummul - ddply(subset(DF, precipitation!=NA), gauge_name, function(x){ x$Cummul - cumsum(x$precipitation) x }) ggplot(Cummul, aes(x = date_time, y = Cummul)) + geom_line() + facet_wrap(~gauge_name, scales=free_y) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens stephen sefick Verzonden: dinsdag 6 oktober 2009 16:07 Aan: r-help@r-project.org Onderwerp: [R] ggplot cumsum refined question (?) OK, so maybe last night was a little too much at one throw, so I have reduced the data to two stations- one that has precipitation and one that does not. This is going to be in the context of a larger data set. I would like to be able to issue a ggplot command and have cum sum just act on the facets (factors) to apply this. library(chron) library(ggplot2) DF - structure(list(date_time = structure(c(14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67, 14522.677083, 14522.6875, 14522.697917, 14522.708333, 14522.71875, 14522.729167, 14522.739583, 14522.75, 14522.760417, 14522.770833, 14522.78125, 14522.791667, 14522.802083, 14522.8125, 14522.822917, 14522.83, 14522.84375, 14522.854167, 14522.864583, 14522.875, 14522.885417, 14522.895833, 14522.90625, 14522.916667, 14522.927083, 14522.9375, 14522.947917, 14522.958333, 14522.96875, 14522.979167, 14522.989583, 14523, 14523.010417, 14523.020833, 14523.03125, 14523.041667, 14523.052083, 14523.0625, 14523.072917, 14523.08, 14523.09375, 14523.104167, 14523.114583, 14523.125, 14523.135417, 14523.145833, 14523.15625, 14523.17, 14523.177083, 14523.1875, 14523.197917, 14523.208333, 14523.21875, 14523.229167, 14523.239583, 14523.25, 14523.260417, 14523.270833, 14523.28125, 14523.291667, 14523.302083, 14523.3125, 14523.322917, 14523.33, 14523.34375, 14523.354167, 14523.364583, 14523.375, 14523.385417, 14523.395833, 14523.40625, 14522, 14522.010417, 14522.020833, 14522.03125, 14522.041667, 14522.052083, 14522.0625, 14522.072917, 14522.08, 14522.09375, 14522.104167, 14522.114583, 14522.125, 14522.135417, 14522.145833, 14522.15625, 14522.17, 14522.177083, 14522.1875, 14522.197917, 14522.208333, 14522.21875, 14522.229167, 14522.239583, 14522.25, 14522.260417, 14522.270833, 14522.28125, 14522.291667, 14522.302083, 14522.3125, 14522.322917, 14522.33, 14522.34375, 14522.354167, 14522.364583, 14522.375, 14522.385417, 14522.395833, 14522.40625, 14522.416667, 14522.427083, 14522.4375, 14522.447917, 14522.458333, 14522.46875, 14522.479167, 14522.489583, 14522.5, 14522.510417, 14522.520833, 14522.53125, 14522.541667, 14522.552083, 14522.5625, 14522.572917, 14522.58, 14522.59375, 14522.604167, 14522.614583, 14522.625, 14522.635417, 14522.645833, 14522.65625, 14522.67,
Re: [R] Viewing specific data from a dataframe
If I understand correctly, you can use which( ,arr.ind=TRUE): Assuming that you start with a data frame, dat - as.data.frame(matrix(runif(30), ncol=5)) nm - names(dat) cormat - cor(dat) cormat[lower.tri(cormat, diag=TRUE)] - NA idx - which(cormat 0.4, arr.ind=TRUE) idx cbind(nm[idx[, row]], nm[idx[, col]]) will give you the pairs. -Peter Ehlers Krystyna Golabek wrote: Dear R users, Simple question. Can anyone help with the code that would allow me to view only the variables who's correlation output is 0.8? This is the code I'm using to date cor(data, method=spearman) Kind regards Krys _ Save time by using Hotmail to access your other email accounts. [[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] ggplot cumsum refined question (?)
It is much easier to do you data preparation before plotting. Cummul - ddply(subset(DF, precipitation!=NA), gauge_name, function(x){ x$Cummul - cumsum(x$precipitation) x }) With a little less typing: Cummul - ddply(subset(DF, precipitation!=NA), gauge_name, transform, Cummul = cumsum(precipitation)) Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R on Linux, and R on Windows , any difference in maturity+stability?
Robert Wilkins iwritecode2 at gmail.com writes: Will R have more glitches on one operating system as opposed to another, or is it pretty much the same? robert One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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] Letter-based representation of pairwise comparisons
Please provide a reproducible example. I've had problems with multcompLetters in the past, because I was giving it slightly incorrect input. Hadley On Tue, Oct 6, 2009 at 7:41 AM, goz garbage.collec...@hotmail.fr wrote: hello, i try to use the multcomp letters, but i have problems with my results : here is my pvalue matrix (from a pairwise.t.test) : pair=pairwise.t.test(...) pair$p.value 0 B BxS B 0.01727 - - BxS 0.00013 0.00226 - S 0.87555 0.02610 0.00027 i was thiking to have something like that : 0 B S BxS a b a c but function return : multcompLetters(pair$p.value) B BxS S a b a first question : why the 0 traitement doesn't appears in result ? second : why the results differs than what i expected ? many thanks. -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25767357.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. -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot
Thanks Sara, Yes I did try. I could not get the Days on the X-axis blow is theerror message plot(Temp,Days) Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee sarah.gos...@gmail.comwrote: Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote: Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! -- Sarah Goslee http://www.functionaldiversity.org [[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] Plot
Actually, it's a bit more complex than just plot(). First you have to make Days an ordered factor, otherwise you get indeed that error. days - c(Mon, Tue, Wed, Thu, Fri, Sat,Sun) Days - factor(days,levels=days,ordered=T) Then you want to make a plot with 2 axes, you should check : http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:2yaxes and reconsider... Kind regards On Tue, Oct 6, 2009 at 4:19 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote: Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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] Is there a recent book on Q-Q plot and data visualization in general?
Hi, I want to look for some detailed explanation on the properties of Q-Q plot and how the properties are derived. In R, there is the following reference. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth Brooks/Cole. Somebody also mentioned the following book chapter to me. Chambers et al., Graphical methods for Data Analysis, Ch.6. But both books are old. I'm wondering if there is any more recent (therefore, maybe better) books for Q-Q plot, and data visualization in general. Regards, Peng __ 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] 'persp' query
David Winsemius wrote: On Oct 6, 2009, at 4:46 AM, Geoffrey William Heard wrote: Hi All I'm creating some 3-D plots using the function 'persp', and have a query regarding the ability to make changes to the label of the z-axis. There are two things I would like to do. First, the default setting places the label a little close to the axis for my liking. Is there any way of moving the label? I've tried adjustments with 'mgp' in 'par', but without success. The second is to change the direction of the label. Currently it reads top to bottom, whereas I would like it to read bottom to top, as per a y-axis on a standard plot. Is there anyway of doing so? ?mtext # and use the adj argument Good idea. This works well if your z-axis is fairly vertical on you plot. -Peter Ehlers __ 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] Is there a recent book on Q-Q plot and data visualization in general?
Hi Peng Yu, Chapter 13 of the following book provides a good description of the assumption done when using regression and other techniques. It also discusses the QQplot. @BOOK{Christensen1996, title = {Plane Answers to Complex Questions: The Theory of Linear Models}, publisher = {Springer, New York}, year = {1996}, author = {Ronald Christensen}, edition = {Second}, note = {496p}, } cheers, Paul Peng Yu wrote: Hi, I want to look for some detailed explanation on the properties of Q-Q plot and how the properties are derived. In R, there is the following reference. Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth Brooks/Cole. Somebody also mentioned the following book chapter to me. Chambers et al., Graphical methods for Data Analysis, Ch.6. But both books are old. I'm wondering if there is any more recent (therefore, maybe better) books for Q-Q plot, and data visualization in general. Regards, Peng __ 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. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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] RES: Plot
This may work for you. Then you can custom your graphics with ?par. Data-as.data.frame(matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat,Sun,56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,list(pa ste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F)) plot(Data$Days,Data$Temp) -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Ashta Enviada em: terça-feira, 6 de outubro de 2009 11:36 Para: Sarah Goslee Cc: R help Assunto: Re: [R] Plot Thanks Sara, Yes I did try. I could not get the Days on the X-axis blow is theerror message plot(Temp,Days) Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee sarah.gos...@gmail.comwrote: Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote: Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! -- Sarah Goslee http://www.functionaldiversity.org [[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] GLM quasipoisson error
atorso wrote: Hello, I'm having an error when trying to fit the next GLM: model-glm(response ~ CLONE_M + CLONE_F + HATCHING +(CLONE_M*CLONE_F) + (CLONE_M*HATCHING) + (CLONE_F*HATCHING) + (CLONE_M*CLONE_F*HATCHING), family=quasipoisson) anova(model, test=Chi) I guess that those variables are factors, and that you have empty combinations? Make a coplot, and see whether you have data for all combinations of the levels of your factors. Formulated differently..does it make sense, or is it possible to fit the 3-way interaction for your data? Also..you may want to use the str command to see whether response is indeed coded correctly. Alain Error in if (dispersion == 1) Inf else object$df.residual : missing value where TRUE/FALSE needed If I fit the same model by using the Poisson distribution, it works. I have not a clue about where the problem could be. Do you have any idea or suggestion I could try? Thank you in advance, Ana __ 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. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Email: highs...@highstat.com URL: www.highstat.com -- View this message in context: http://www.nabble.com/GLM-quasipoisson-error-tp25754404p25770491.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] Plot
Hi beside other options if you do not want to learn how to order factor levels Days - c(Monday, Tuesday, Wed, Thu, Fri, Sat,Sun) Hum -c(56,57,60,75,62,67,70) Temp-c(76,77,81,95,82,77,83) limits-range(c(Hum, Temp)) limits [1] 56 95 plot(1:7, Hum, ylim=limits) points(1:7, Temp, col=2) plot(1:7, Hum, ylim=limits, axes=F) points(1:7, Temp, col=2) axis(1, at=1:7, Days) axis(2) box() this may work for you if you get rid of unnecessary matrix call. Regards Petr r-help-boun...@r-project.org napsal dne 06.10.2009 16:35:44: Thanks Sara, Yes I did try. I could not get the Days on the X-axis blow is theerror message plot(Temp,Days) Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee sarah.gos...@gmail.comwrote: Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote: Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! -- Sarah Goslee http://www.functionaldiversity.org [[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] how to fit time varying coefficient regression model?
R_help Help wrote: Hi - I read through dse package manual a bit. I'm not quite certain how I can use it to estimate a time varying coefficient regression model? I might pick up an inappropriate package. Any suggestion would be greatly appreciated. Thank you. Just rewrite the linear regression model into state-space equations, and apply Kalman filtering. See Chapter 16 or 17 in our Analysing Ecological Data book. There will be packages in R that can do kalman filtering and smoothing Alain rh __ 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. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Email: highs...@highstat.com URL: www.highstat.com -- View this message in context: http://www.nabble.com/how-to-fit-time-varying-coefficient-regression-model--tp25762040p25770615.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] Letter-based representation of pairwise comparisons
Ok, thanks for all your responses, i was thinking, after reading the firsts messages that use only the $p.value was good. By using a symetric matrix results are ok. It's also good with a pvalue vector (just like exemples in the help ...). many thanks for your help -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25770624.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] ggplot cumsum refined question (?)
The date time stamp is not the same? data.frame(as.chron(Cumul[,date_time]), DF[,date_time]) On Tue, Oct 6, 2009 at 9:31 AM, hadley wickham h.wick...@gmail.com wrote: It is much easier to do you data preparation before plotting. Cummul - ddply(subset(DF, precipitation!=NA), gauge_name, function(x){ x$Cummul - cumsum(x$precipitation) x }) With a little less typing: Cummul - ddply(subset(DF, precipitation!=NA), gauge_name, transform, Cummul = cumsum(precipitation)) Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Stephen Sefick 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 __ 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] RES: RES: Plot
Oh yeah, I forgot that, just correct this by: Data-as.data.frame(matrix(c(Monday, Tuesday, Wed, Thu, Fri,Sat,Sun,56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,l ist(paste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F)) Data$Hum-as.numeric(Data$Hum) Data$Temp-as.numeric(Data$Temp) Then you can plot it. -Mensagem original- De: joris meys [mailto:jorism...@gmail.com] Enviada em: terça-feira, 6 de outubro de 2009 12:08 Para: Rodrigo Aluizio Assunto: Re: [R] RES: Plot On Tue, Oct 6, 2009 at 4:56 PM, Rodrigo Aluizio r.alui...@gmail.com wrote: This may work for you. Then you can custom your graphics with ?par. Data-as.data.frame(matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat,Sun,56,57,60,75,62,67,70,76,77,81,95,82,77,83),ncol=3,nrow=7,list(pa ste('Row',1:7,sep=''),c('Days','Hum','Temp')),byrow=F)) This won't work, as it puts also Temp en Hum as factors. A matrix can only have 1 mode, and the matrix call you do converts everything to factor before you put it in the dataframe. plot(Data$Days,Data$Temp) -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Ashta Enviada em: terça-feira, 6 de outubro de 2009 11:36 Para: Sarah Goslee Cc: R help Assunto: Re: [R] Plot Thanks Sara, Yes I did try. I could not get the Days on the X-axis blow is theerror message plot(Temp,Days) Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion 2: In min(x) : no non-missing arguments to min; returning Inf 3: In max(x) : no non-missing arguments to max; returning -Inf On Tue, Oct 6, 2009 at 10:19 AM, Sarah Goslee sarah.gos...@gmail.comwrote: Did you try it? With, perhaps, plot() ? And lines() ? You might do better with Days as a factor with the day names in order. (And why are two full and five abbreviated?) I don't understand why Hum and Temp are matrices rather than vectors, and why then you didn't specify dimensions, and for that matter why you are missing a closing paren but do have a comma in its place. Generally this list is happy to help, but we like some evidence that the querent has *tried* before inquiring. Sarah On Tue, Oct 6, 2009 at 10:05 AM, Ashta sewa...@gmail.com wrote: Hi All, Days - matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat, Sun),7,1) Hum -matrix(c(56,57,60,75,62,67,70), Temp-matrix(c(76,77,81,95,82,77,83), Using the above information I want plot humidity and temperature on Y-axis and days on X-axis Any help is appreciated! -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] linear model with coefficient constraints
Rnewb wrote: I would like to perform a regression like the one below: lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data) However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and c1+c2+c3 = C, where A, B, Ravi Varadhan has an example how this could be done with optim http://markmail.org/message/3dd5c4rppt2bjzwj Dieter -- View this message in context: http://www.nabble.com/linear-model-with-coefficient-constraints-tp25769021p25770788.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] R on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/2009 10:34 AM, Jose Quesada wrote: Robert Wilkins iwritecode2 at gmail.com writes: Will R have more glitches on one operating system as opposed to another, or is it pretty much the same? robert One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). By default, 32 bit Windows only gives 2 Gb for all the user processes to share, and saves the rest of memory for itself. You can change this (see the Windows FAQ), but the most you'll ever get is 3 Gb in 32 bit Windows, and a bit under 4 Gb in 64 bit Windows. Duncan Murdoch While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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] else if statement error
2009/10/6 Uwe Ligges lig...@statistik.tu-dortmund.de: Gabor Grothendieck wrote: 2009/10/6 Uwe Ligges lig...@statistik.tu-dortmund.de: The first rule is easy: As long as you are using scalar valued (i.e. length 1 vectors in R) cond, you should prefer if(cond) cons.expr else alt.expr rather than ifelse(cond, yes, no) because the latter one evaluates both yes and no while the former one evaluates exactly one of both expressions. I don't think that that is true. The false leg was not evaluated here: ifelse(TRUE, { cat(a); 1}, {cat(b); 2}) a[1] 1 Ah, indeed that changed at some point and I forgot that the code checks for the length of cond nowadays. Thanks for pointing it out. Modulo NAs, I think it checks whether cond is all TRUEs or all FALSEs and in either of those cases it only evaluates one or the other. Of course if cond is length 1 then it necessary is all TRUE or all FALSE. If its a mixture of TRUE and FALSE then it evaluates both. ifelse(c(TRUE, TRUE), { cat(a); 1}, {cat(b); 2}) a[1] 1 1 ifelse(c(FALSE, FALSE), { cat(a); 1}, {cat(b); 2}) b[1] 2 2 ifelse(c(TRUE, FALSE), { cat(a); 1}, {cat(b); 2}) ab[1] 1 2 __ 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] Linear mixed effects model ?
Daniel Perkins wrote: Ideally we would do an ANCOVA to test for differences in slope or intercepts for the different streams. However as there were repeated measures and unequal n and unbalanced design, I have used a linear mixed effect model (from nlme package in R) in the form: model - lme (Rate ~ Temp* Stream, random = ~ Time|Replicate) This should rather be model - lme (Rate ~ Temp* Stream, random = ~ 1|Time/Replicate) Always start your model with the more parsimonious equal slopes assumption denoted by 1|. When you place the Time variable as you did, it estimates separate slopes for Time, which could be ill conditioned. Dieter -- View this message in context: http://www.nabble.com/Linear-mixed-effects-model---tp25767907p25770925.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] tkProgressBar usage
I have a frame and I want to fix the progress bar onto it.I do not want progress bar to display as another GUI.how do i embed progress bar onto a frame ? -- Dipti [[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] IRLS or other iteratively re weighted optimization algorithms with constraints in R
Dear list, is there an iterative re weighted least square based algorithm or any or other iteratively re weighted optimisation algorithms for non linear (and possibly non parametric) optimisation problems with constraints available in R? Regards -- Corrado __ 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] ggplot2: mapping categorical variable to color aesthetic with faceting
Hello Again... I¹m making a faceted plot of a response on two categorical variables using ggplot2 and having troubles with the coloring. Here is a sample that produces the desired plot: compareCats - function(data, res, fac1, fac2, colors) { require(ggplot2) p - ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit, color = colors) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) Now, if I get away from idealized data where there are the same number of data points per group (25 in this case), I run into problems. So, if you do: rem - runif(5, 1, 100) # randomly remove a few points here and there test - test[-rem,] compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) R throws an error due to mismatch between the recycling of colors and the actual number of data points: Error in `[-.data.frame`(`*tmp*`, gp, value = list(colour = c(red, : replacement element 1 has 2 rows, need 47 I'm new to ggplot2, but have been through the book and the web site enough to know that my problem is mapping the varible to the aesthetic; I also know I can either map or set the colors. The question, finally: is there an simple/elegant way to map a list of two colors corresponding to A and B onto any random sample size of A and B with faceting? If not, and I must set the colors: Do I compute the length of all possible combos of A, B with lrg, sm, and then create one long vector of colors for the entire plot? I tried something like this, and was not successful, but perhaps could be with more work. All advice appreciated, Bryan (session info below) * Bryan Hanson Professor of Chemistry Biochemistry DePauw University, Greencastle IN USA sessionInfo() R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid datasets tools utils stats graphics grDevices methods [9] base other attached packages: [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8mvbutils_2.2.0 [5] ChemoSpec_1.1 lattice_0.17-25mvoutlier_1.4 plyr_0.1.8 [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 robustbase_0.4-5 [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 [17] nnet_7.2-48mclust_3.2 MASS_7.2-48lars_0.9-7 [21] e1071_1.5-19 class_7.2-48 __ 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] IRLS or other iteratively re weighted optimization algorithms with constraints in R
On Oct 6, 2009, at 12:14 PM, Corrado wrote: Dear list, is there an iterative re weighted least square based algorithm or any or other iteratively re weighted optimisation algorithms for non linear (and possibly non parametric) optimisation problems with constraints available in R? Have you looked in the suggestively named Task View yet? http://cran.r-project.org/web/views/ http://cran.r-project.org/web/views/Optimization.html -- David Winsemius, MD Heritage Laboratories 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] Date-Time-Stamp input method for user-specific formats
esp wrote: For the function as defined above using 'sapply' spot[,1] 01/09/2009 01/09/2009 00:00:01 01/09/2009 00:00:02 01/09/2009 00:00:03 1251759600 1251759601 1251759602 1251759603 This was unexpected - it seems to have displayed the datetimestamp values both as per my defined character-string representation and as numeric values. One mystery solved (now I appreciate the existence and utility of the 'str' and 'ls.str' functions), the apparent dual dateformat and numeric results from my initial algorithm were in fact the associated characterstring and numeric parts of a Named num object. Hence for example: str(spot$DATETIME) Named num [1:4] 1.25e+09 1.25e+09 1.25e+09 1.25e+09 - attr(*, names)= chr [1:4] 01/09/2009 01/09/2009 00:00:01 01/09/2009 00:00:02 01/09/2009 00:00:03 names(spot$DATETIME) [1] 01/09/2009 01/09/2009 00:00:01 01/09/2009 00:00:02 01/09/2009 00:00:03 -- View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25770184.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] Text editors for Sweave (rnw) files
Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Thanks in advance, Greg __ Make your browsing faster, safer, and easier with the new Internet Explorer[[elided Yahoo spam]] com/ca/internetexplorer/ [[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] Text editors for Sweave (rnw) files
Emacs with ESS would be one way to go. When editing a RNW file in ESS, you can use a key combination to go from RNW directly to PS or PDF, which is nice. Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gregory Gentlemen Sent: Tuesday, October 06, 2009 11:31 AM To: r-help@r-project.org Subject: [R] Text editors for Sweave (rnw) files Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Thanks in advance, Greg __ Make your browsing faster, safer, and easier with the new Internet Explorer[[elided Yahoo spam]] com/ca/internetexplorer/ [[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] Text editors for Sweave (rnw) files
vim/gvim does syntax highlighting of R, Sweave and latex. On Tue, Oct 6, 2009 at 12:30 PM, Gregory Gentlemen gregory_gentle...@yahoo.ca wrote: Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Thanks in advance, Greg __ Make your browsing faster, safer, and easier with the new Internet Explorer[[elided Yahoo spam]] com/ca/internetexplorer/ [[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] ggplot2: mapping categorical variable to color aesthetic with faceting
Hi, I may be missing an important design decision, but could you not have only a single data.frame as an argument of your function? From your example, it seems that the colour can be mapped to the fac1 variable of data, compareCats - function(data) { require(ggplot2) p - ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit) + scale_colour_manual(values=c(red, blue)) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test) rem - runif(5, 1, 100) # randomly remove a few points here and there last_plot() %+% test[-rem,] # replot with new dataset HTH, baptiste 2009/10/6 Bryan Hanson han...@depauw.edu: Hello Again... I¹m making a faceted plot of a response on two categorical variables using ggplot2 and having troubles with the coloring. Here is a sample that produces the desired plot: compareCats - function(data, res, fac1, fac2, colors) { require(ggplot2) p - ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit, color = colors) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) Now, if I get away from idealized data where there are the same number of data points per group (25 in this case), I run into problems. So, if you do: rem - runif(5, 1, 100) # randomly remove a few points here and there test - test[-rem,] compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) R throws an error due to mismatch between the recycling of colors and the actual number of data points: Error in `[-.data.frame`(`*tmp*`, gp, value = list(colour = c(red, : replacement element 1 has 2 rows, need 47 I'm new to ggplot2, but have been through the book and the web site enough to know that my problem is mapping the varible to the aesthetic; I also know I can either map or set the colors. The question, finally: is there an simple/elegant way to map a list of two colors corresponding to A and B onto any random sample size of A and B with faceting? If not, and I must set the colors: Do I compute the length of all possible combos of A, B with lrg, sm, and then create one long vector of colors for the entire plot? I tried something like this, and was not successful, but perhaps could be with more work. All advice appreciated, Bryan (session info below) * Bryan Hanson Professor of Chemistry Biochemistry DePauw University, Greencastle IN USA sessionInfo() R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid datasets tools utils stats graphics grDevices methods [9] base other attached packages: [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8 mvbutils_2.2.0 [5] ChemoSpec_1.1 lattice_0.17-25 mvoutlier_1.4 plyr_0.1.8 [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 robustbase_0.4-5 [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 [17] nnet_7.2-48 mclust_3.2 MASS_7.2-48 lars_0.9-7 [21] e1071_1.5-19 class_7.2-48 __ 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] Way of handling empty value when reading in CSV
I believe I may be overlooking something simple in order address this, but I have searched RSeek.org and using ?, but cannot seem to find anything discussing this one. I am using read.csv to read in a csv file. Evidently in places there is nothing between the commas, so that when the data is read in the data.frame produced has values that are empty. Is there a way to fix this when reading the data via read.csv? I looked at all the options mentioned in ?read.csv, but did not see anything to address this case, e.g. home,sqr_footage,cost 1,1500,15 2,2000,20 3,,30 4,3500,35 5,4000,45 I would like for the empty cells to have a value of NA when they are read in. Thank you for any feedback and insights. __ 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] mle from stats4
I am using mle as a wrapper from optim( ). How would I extract the convergence code, to know that optim( ) converged properly? Thanks, Stephen Collins, MPP | Analyst Global Strategy | Aon Benfield [[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] Date-Time-Stamp input method for user-specific formats
Another solution, as a fix to my original algorithm, was found by a colleague (Matthew Roberts). While he claims not too much for its elegance, it does seem to work. This fix is based on the use of the 'pmax' function. This function is a variant of the 'max' (maximum) function to return a vector of results corresponding to vectors of inputs. Example: max(1:3,4:8) == 8 but pmax(1:3,4:6) == 4 5 6. Thanks to this, it provides appropriate results for all rows of the data. In the code, there are two possible datetimestamp interpretations, midnight and non midnight, each implemented by a 'strptime' call. When a midnight datetimestamp is encountered, only the midnight conversion will return a proper (non NA) value. Thanks to the na.rm=TRUE option, the NA result is removed so 'pmax' returns just the proper value. For a non midnight datetimestamp, both midnight and non midnight conversions return proper values, but only the non midnight conversion will give a result greater than midnight, and it is this that is returned by the 'pmax'. The code is as follows: spot_frequency_readin - function(file,nrows=-1) { # create temp class setClass(t_class2_, representation(character)) setAs(character, t_class2_, function(from) { as.POSIXct(pmax(strptime(from, format=%d/%m/%Y), strptime(from, format=%d/%m/%Y %H:%M:%S), na.rm=TRUE), tz=GMT) } ) #(for format symbols, see R Reference Card) # read the file (TSV) file - read.delim(file, header=TRUE, comment.char = , nrows=nrows, as.is=FALSE, col.names=c(DATETIME, FREQ), colClasses=c(t_class2_, numeric) ) # remove it now that we are done with it removeClass(t_class2_) return(file) } The result: spot DATETIME FREQ 1 2009-09-01 00:00:00 50.036 2 2009-09-01 00:00:01 50.035 3 2009-09-01 00:00:02 50.035 4 2009-09-01 00:00:03 50.033 Confirm the nature of the result: str(spot) 'data.frame': 4 obs. of 2 variables: $ DATETIME: POSIXct, format: 2009-09-01 00:00:00 2009-09-01 00:00:01 2009-09-01 00:00:02 2009-09-01 00:00:03 $ FREQ: num 50 50 50 50 (Note: 'str' means Compactly display the internal structure of an R object. I can claim from experience that his and 'ls.str' are things that the novice R user can benefit hugely from knowing about) -- View this message in context: http://www.nabble.com/Date-Time-Stamp-input-method-for-user-specific-formats-tp25757018p25770983.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] Text editors for Sweave (rnw) files
On 10/6/09, Gregory Gentlemen gregory_gentle...@yahoo.ca wrote: Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. Slightly off-topic reply. You can compose Sweave documents using LyX, in which case you would not need syntax highlighting. 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.
[R] linear model with coefficient constraints
I would like to perform a regression like the one below: lm(x ~ 0 + a1 + a2 + a3 + b1 + b2 + b3 + c1 + c2 + c3, data=data) However, the data has the property that a1+a2+a3 = A, b1+b2+b3 = B, and c1+c2+c3 = C, where A, B, and C are positive constants. So there are two extra degrees of freedom, and R handles this by producing NA for two of the coefficients. Instead, I would prefer to remove the degrees of freedom by forcing constraints on the coefficients produced by the model. Specifically, I want coeff(b1) + coeff(b2) + coeff(b3) = coeff(c1) + coeff(c2) + coeff(c3) = 0. I could accomplish this by writing code to suitably shift the coefficients after performing the basic regression above, but I'm hoping there's a better way. Is there? thanks, Rnewb -- View this message in context: http://www.nabble.com/linear-model-with-coefficient-constraints-tp25769020p25769020.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] Letter-based representation of pairwise comparisons
Hello: That's because the required input should be a symmetric matrix with all the comparisons, e.g., it should have the self-comparisons diagonal. In an hypotetical case with two treatments, the pairwise-comparison test output is something like that: A B B 0.80- but multcompView requires an input like that one: A B A 1 - B 0.80 1 That means you should add a new row and column for your missing treatments and, then, a diagonal of 1s meaning that each treatment compared with itself will result in a p-value of 1 (maximal identity). Then, the new matrix could be piped succesfully. Regards, Retama goz wrote: hello, i try to use the multcomp letters, but i have problems with my results : here is my pvalue matrix (from a pairwise.t.test) : pair=pairwise.t.test(...) pair$p.value 0 BBxS B0.01727- - BxS 0.000130.00226 - S0.875550.02610 0.00027 i was thiking to have something like that : 0 B S BxS a b a c but function return : multcompLetters(pair$p.value) B BxS S a b a first question : why the 0 traitement doesn't appears in result ? second : why the results differs than what i expected ? many thanks. -- View this message in context: http://www.nabble.com/Letter-based-representation-of-pairwise-comparisons-tp21350364p25769894.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] Way of handling empty value when reading in CSV
I saved your data as test.csv, and read.csv(~/test.csv, header = TRUE) home sqr_footage cost 111500 15 222000 20 33 NA 30 443500 35 554000 45 I am using R 2.8.1, old I know... but maybe something else is going on? Do you really get a blank when you read in your sample data? Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Rupert Sent: Tuesday, October 06, 2009 11:39 AM To: R-help@r-project.org Subject: [R] Way of handling empty value when reading in CSV I believe I may be overlooking something simple in order address this, but I have searched RSeek.org and using ?, but cannot seem to find anything discussing this one. I am using read.csv to read in a csv file. Evidently in places there is nothing between the commas, so that when the data is read in the data.frame produced has values that are empty. Is there a way to fix this when reading the data via read.csv? I looked at all the options mentioned in ?read.csv, but did not see anything to address this case, e.g. home,sqr_footage,cost 1,1500,15 2,2000,20 3,,30 4,3500,35 5,4000,45 I would like for the empty cells to have a value of NA when they are read in. Thank you for any feedback and insights. __ 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] Fwd: Long for Loop- calling C from R - Parallel Computing
It would help to understand the problem you are trying to solve and the constraints that you have to live under. I routinely process files with millions of rows of data, do a lot of processing and create graphics/reports from them in what I think is reasonable time (a couple of minutes at most for the complex stuff) all within R without having to write C/FORTRAN. I am not sure what assumptions you are currently operating under, but it would be good to state them so that we know how to reply to the question that you are asking. There are performance tips that can be provided if we knew what you were trying to do. On Tue, Oct 6, 2009 at 10:10 AM, Antonio Paredes antonioparede...@gmail.com wrote: -- Forwarded message -- From: Antonio Paredes antonioparede...@gmail.com Date: Tue, Oct 6, 2009 at 9:41 AM Subject: Re: [R] Long for Loop- calling C from R - Parallel Computing To: Karl Ove Hufthammer k...@huftis.org Hello again, I'm hoping to get a response from some of the R gurus in this list. Is my assumption that R is not designed or build to deal with high levels (a lots of simulated data) simulation correct. For example, how to minimize system time; do one have to call a lower level language like C or Fortran; or just, like many of you have done, do a lots of programing in R and eventually the tricks will be learned. Thanks On Mon, Oct 5, 2009 at 8:35 AM, Antonio Paredes antonioparede...@gmail.comwrote: In my case it does, because I need to preserved a high level of independence (lack of correlation) among the different groups of 60. Also, when I say final result I mean computation of standard errors and that source of stuff; sorry about the lack clarity in my statement. On Mon, Oct 5, 2009 at 9:48 AM, Karl Ove Hufthammer k...@huftis.orgwrote: In article 6f6f0fd60910050629p28c99209jcd7836353fd2d754 @mail.gmail.com, antonioparede...@gmail.com says... I'm running the following for loop to generate random variables in chunks of 60 at a time (l), here h is of order in millions (could be 5 to 6 millions), note that generating all the variables at once could have an impact on the final results No, it will not. See this example code for an illustration: set.seed(1) rnorm(3) rnorm(3) set.seed(1) rnorm(6) So if you generate the six numbers three at a time or all at once gives exactly the same result. So my suggestion is to generate all the numbers at once. That takes next to no time. Or, if it takes too much memory, generate for example a million at once, and repeat a few times. -- Karl Ove Hufthammer __ 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. -- -Tony -- -Tony -- -Tony [[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] Text editors for Sweave (rnw) files
Hi, On Oct 6, 2009, at 12:30 PM, Gregory Gentlemen wrote: Hi fellow R-users, Are there any text editors that recognize sweave (.rnw) files? I am running Windows Vista and in the past I used Tinn-R for R files but it (surprisingly) doesn't recognize rnw files and does not do any syntax highlighting for them. I don't run windows, but rumor has it that the e-texteditor is supposed to support TextMate bundles. So, since TextMate has bundles to support *.R, *.Rnw, *.Rd files, I would imagine the e editor could work, too: Editor: http://www.e-texteditor.com/ Getting more bundles: http://e-texteditor.com/wiki/index.php/Bundles#How_To_Get_More_Bundles You'll see several R bundles here (for TextMate, which should theoretically work for you) http://svn.textmate.org/trunk/Bundles/ I suspect this would be the one you want: http://svn.textmate.org/trunk/Bundles/R.tmbundle/ Hope that helps, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ 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] mle from stats4
Stephen Collins wrote: I am using mle as a wrapper from optim( ). How would I extract the convergence code, to know that optim( ) converged properly? The return value from optim is contained in the details slot, so f...@details$convergence [1] 0 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 __ 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] mle from stats4
Stephen Collins-6 wrote: I am using mle as a wrapper from optim( ). How would I extract the convergence code, to know that optim( ) converged properly? library(stats4) example(mle) slotNames(fit1) f...@details f...@details$convergence -- View this message in context: http://www.nabble.com/mle-from-stats4-tp25772337p25772668.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] ggplot2: mapping categorical variable to color aesthetic with faceting
Further to my previous reply, it occurred to me that ggplot2 would only ever use data and colors in your calls to compareCats(): res = res, fac1 = fac1, fac2 = fac2 have no effect whatsoever. If you want the user to be able to specify the variables used in the ggplot2 call, you probably want to look at ?aes_string, as shown below, compareCats - function(data, fac1=fac1, fac2=fac2, res=res, colors=c(red, blue)) { require(ggplot2) p - ggplot(data, aes_string(x=fac1, y=res, color=fac1)) + facet_grid(paste(. ~ , fac2)) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit) + scale_colour_manual(values=colors) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test) rem - sample(10, 1:ncol(test)) # randomly remove a few points here and there last_plot() %+% test[-rem, ] # replot with new dataset HTH, baptiste 2009/10/6 baptiste auguie baptiste.aug...@googlemail.com: Hi, I may be missing an important design decision, but could you not have only a single data.frame as an argument of your function? From your example, it seems that the colour can be mapped to the fac1 variable of data, compareCats - function(data) { require(ggplot2) p - ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit) + scale_colour_manual(values=c(red, blue)) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test) rem - runif(5, 1, 100) # randomly remove a few points here and there last_plot() %+% test[-rem,] # replot with new dataset HTH, baptiste 2009/10/6 Bryan Hanson han...@depauw.edu: Hello Again... I¹m making a faceted plot of a response on two categorical variables using ggplot2 and having troubles with the coloring. Here is a sample that produces the desired plot: compareCats - function(data, res, fac1, fac2, colors) { require(ggplot2) p - ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit, color = colors) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) Now, if I get away from idealized data where there are the same number of data points per group (25 in this case), I run into problems. So, if you do: rem - runif(5, 1, 100) # randomly remove a few points here and there test - test[-rem,] compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) R throws an error due to mismatch between the recycling of colors and the actual number of data points: Error in `[-.data.frame`(`*tmp*`, gp, value = list(colour = c(red, : replacement element 1 has 2 rows, need 47 I'm new to ggplot2, but have been through the book and the web site enough to know that my problem is mapping the varible to the aesthetic; I also know I can either map or set the colors. The question, finally: is there an simple/elegant way to map a list of two colors corresponding to A and B onto any random sample size of A and B with faceting? If not, and I must set the colors: Do I compute the length of all possible combos of A, B with lrg, sm, and then create one long vector of colors for the entire plot? I tried something like this, and was not successful, but perhaps could be with more work. All advice appreciated, Bryan (session info below) * Bryan Hanson Professor of Chemistry Biochemistry DePauw University, Greencastle IN USA sessionInfo() R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid datasets tools utils stats graphics grDevices methods [9] base other attached packages: [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8 mvbutils_2.2.0 [5] ChemoSpec_1.1 lattice_0.17-25 mvoutlier_1.4 plyr_0.1.8 [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 robustbase_0.4-5 [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 [17] nnet_7.2-48 mclust_3.2 MASS_7.2-48 lars_0.9-7 [21] e1071_1.5-19 class_7.2-48 __ 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
Re: [R] Spatial Autocorrelation
In addition to the taskview (below), you might consider using the sos package, something like the following: sa - ???'spatial autocorrelation' # 58 matches sc - ???'spatial correlation' # 181 matches s. - sa|sc # union of the to 'findFn' objects summary(s.) # 224 links in 57 packages installPackages(s.) # install packages with at least 5 = sqrt(max(count)) matches writeFindFn2xls(s.) # write an Excel file with 3 sheets: PackageSum2, findFn, call This tells you that 22 help pages in spdep matched the search term, plus 18 pages in each of nlme, ncf, and spatstat, as well as 17 in ramps and 15 in geoR. The PackageSum2 sheet also provides other information to help you decide which package to consider first. Beyond this, you may like to uses these functions with other search terms; see vignette('sos') for more information. Hope this helps. Spencer Disclaimer: I'm the lead author of sos. Corey Sparks wrote: Hi Paulo, if your data are distance matrices, you might consider doing a Mantel test, look at the mantel() function in package vegan. While this is not technically measuring spatial autocorrelation, it will test for correlation between the attribute distances and the geographic distances. Also, if you can coax your data back into a point shapefile (for example), you can use the tools in the spdep package which will measure actual spatial autocorrelation (such as Moran's I and Geary's C). Best, Corey silcha wrote: Hi Paulo, you may want to take a look at http://cran.r-project.org/web/views/Spatial.html there, you can find all spatial packages that can be useful for your question. There is also a a mailing list R-sig-geo that where you can ask all those kind of question. Hope that this helps. Cheers Anna Anna Freni Sterrantino Ph.D Student Department of Statistics University of Bologna, Italy via Belle Arti 41, 40124 BO. Da: P.Branco pjlbra...@yahoo.com A: r-help@r-project.org Inviato: Martedì 6 ottobre 2009, 13:28:36 Oggetto: [R] Spatial Autocorrelation Hello, I have a matrix with the distances among sites. And I have another matrix with the presence and absence of each species in each site. I would like to test the spatial autocorrelation among sites. I have tried to use the function gearymoran of the ade4 package, but error messages keep popping up. Do you know any function for me to test the spatial autocorrelation of my data? Thanks, Paulo Branco -- View this message in context: http://www.nabble.com/Spatial-Autocorrelation-tp25767010p25767010.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. __ spazio gratuito per i tuoi file e i messaggi [[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. -- Spencer Graves, PE, PhD President and Chief Operating Officer Structure Inspection and Monitoring, Inc. 751 Emerson Ct. San José, CA 95126 ph: 408-655-4567 __ 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] Way of handling empty value when reading in CSV
Well, I guess I posted a poor example. This example is a little closer: home,sqr_footage,cost,color,exterior 1,1500,15,,Siding 2,2000,20,Red,Brick 3,,30,Grey,Brick 4,3500,35,Blue, 5,4000,45,Red,Brick This one actually shows the presence of the null fields that are loaded. Sorry again for the poor 1st example. Thank you again for your time and insight. --- On Tue, 10/6/09, Erik Iverson eiver...@nmdp.org wrote: From: Erik Iverson eiver...@nmdp.org Subject: RE: [R] Way of handling empty value when reading in CSV To: Jason Rupert jasonkrup...@yahoo.com, R-help@r-project.org R-help@r-project.org Date: Tuesday, October 6, 2009, 11:42 AM I saved your data as test.csv, and read.csv(~/test.csv, header = TRUE) home sqr_footage cost 1 1 1500 15 2 2 2000 20 3 3 NA 30 4 4 3500 35 5 5 4000 45 I am using R 2.8.1, old I know... but maybe something else is going on? Do you really get a blank when you read in your sample data? Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Rupert Sent: Tuesday, October 06, 2009 11:39 AM To: R-help@r-project.org Subject: [R] Way of handling empty value when reading in CSV I believe I may be overlooking something simple in order address this, but I have searched RSeek.org and using ?, but cannot seem to find anything discussing this one. I am using read.csv to read in a csv file. Evidently in places there is nothing between the commas, so that when the data is read in the data.frame produced has values that are empty. Is there a way to fix this when reading the data via read.csv? I looked at all the options mentioned in ?read.csv, but did not see anything to address this case, e.g. home,sqr_footage,cost 1,1500,15 2,2000,20 3,,30 4,3500,35 5,4000,45 I would like for the empty cells to have a value of NA when they are read in. Thank you for any feedback and insights. __ 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 on Linux, and R on Windows , any difference in maturity+stability?
On Tue, Oct 6, 2009 at 11:23 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 10/6/2009 10:34 AM, Jose Quesada wrote: Robert Wilkins iwritecode2 at gmail.com writes: Will R have more glitches on one operating system as opposed to another, or is it pretty much the same? robert One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). By default, 32 bit Windows only gives 2 Gb for all the user processes to share, and saves the rest of memory for itself. You can change this (see the Windows FAQ), but the most you'll ever get is 3 Gb in 32 bit Windows, _and a bit under 4 Gb in 64 bit Windows. That sounds incredible. ¿Why so? Kjetil Duncan Murdoch While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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] ggplot2: mapping categorical variable to color aesthetic with faceting
Hi Baptiste: Thanks for the suggestion. It will work perfectly. I would have never considered assigning a color to a variable that contained no colors at all! I guess this is part of the aesthetic concept, which I haven't had time to reflect on much. Then later, specify a manual color scale which then maps back onto the aesthetic. Clever. As I stated, I'm just learning ggplot2, and I'm finding the language and concepts a bit different (I'm not familiar with the grammar of graphics, nor am I a computer scientist). But, I have to say the code I am working up replaces a much much longer code in base graphics, so I am really liking the thought put into ggplot2 and the leanness of it - Thanks Hadley! Thanks again, Bryan On 10/6/09 12:36 PM, baptiste auguie baptiste.aug...@googlemail.com wrote: Hi, I may be missing an important design decision, but could you not have only a single data.frame as an argument of your function? From your example, it seems that the colour can be mapped to the fac1 variable of data, compareCats - function(data) { require(ggplot2) p - ggplot(data, aes(fac1, res, color=fac1)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit) + scale_colour_manual(values=c(red, blue)) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test) rem - runif(5, 1, 100) # randomly remove a few points here and there last_plot() %+% test[-rem,] # replot with new dataset HTH, baptiste 2009/10/6 Bryan Hanson han...@depauw.edu: Hello Again... I¹m making a faceted plot of a response on two categorical variables using ggplot2 and having troubles with the coloring. Here is a sample that produces the desired plot: compareCats - function(data, res, fac1, fac2, colors) { require(ggplot2) p - ggplot(data, aes(fac1, res)) + facet_grid(. ~ fac2) jit - position_jitter(width = 0.1) p - p + layer(geom = jitter, position = jit, color = colors) print(p) } test - data.frame(res = rnorm(100), fac1 = as.factor(rep(c(A, B), 50)), fac2 = as.factor(rep(c(lrg, lrg, sm, sm), 25))) compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) Now, if I get away from idealized data where there are the same number of data points per group (25 in this case), I run into problems. So, if you do: rem - runif(5, 1, 100) # randomly remove a few points here and there test - test[-rem,] compareCats(data = test, res = res, fac1 = fac1, fac2 = fac2, colors = c(red, blue)) R throws an error due to mismatch between the recycling of colors and the actual number of data points: Error in `[-.data.frame`(`*tmp*`, gp, value = list(colour = c(red, : replacement element 1 has 2 rows, need 47 I'm new to ggplot2, but have been through the book and the web site enough to know that my problem is mapping the varible to the aesthetic; I also know I can either map or set the colors. The question, finally: is there an simple/elegant way to map a list of two colors corresponding to A and B onto any random sample size of A and B with faceting? If not, and I must set the colors: Do I compute the length of all possible combos of A, B with lrg, sm, and then create one long vector of colors for the entire plot? I tried something like this, and was not successful, but perhaps could be with more work. All advice appreciated, Bryan (session info below) * Bryan Hanson Professor of Chemistry Biochemistry DePauw University, Greencastle IN USA sessionInfo() R version 2.9.2 (2009-08-24) i386-apple-darwin8.11.1 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid datasets tools utils stats graphics grDevices methods [9] base other attached packages: [1] ggplot2_0.8.3 reshape_0.8.3 proto_0.3-8 mvbutils_22.0 [5] ChemoSpec_1.1 lattice_0.17-25 mvoutlier_1.4 plyr_0.1.8 [9] RColorBrewer_1.0-2 chemometrics_0.4 som_0.3-4 robustbase_0.4-5 [13] rpart_3.1-45 pls_2.1-0 pcaPP_1.7 mvtnorm_0.9-7 [17] nnet_7.2-48 mclust_3.2 MASS_7.2-48 lars_0.9-7 [21] e1071_1.5-19 class_7.2-48 __ 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] Way of handling empty value when reading in CSV
Does this do what you want: ) x - read.csv(textConnection(home,sqr_footage,cost,color,exterior + 1,1500,15,,Siding + 2,2000,20,Red,Brick + 3,,30,Grey,Brick + 4,3500,35,Blue, + 5,4000,45,Red,Brick), na.strings='') closeAllConnections() x home sqr_footage cost color exterior 111500 15 NA Siding 222000 20 RedBrick 33 NA 30 GreyBrick 443500 35 Blue NA 554000 45 RedBrick On Tue, Oct 6, 2009 at 1:12 PM, Jason Rupert jasonkrup...@yahoo.com wrote: Well, I guess I posted a poor example. This example is a little closer: home,sqr_footage,cost,color,exterior 1,1500,15,,Siding 2,2000,20,Red,Brick 3,,30,Grey,Brick 4,3500,35,Blue, 5,4000,45,Red,Brick This one actually shows the presence of the null fields that are loaded. Sorry again for the poor 1st example. Thank you again for your time and insight. --- On Tue, 10/6/09, Erik Iverson eiver...@nmdp.org wrote: From: Erik Iverson eiver...@nmdp.org Subject: RE: [R] Way of handling empty value when reading in CSV To: Jason Rupert jasonkrup...@yahoo.com, R-help@r-project.org R-help@r-project.org Date: Tuesday, October 6, 2009, 11:42 AM I saved your data as test.csv, and read.csv(~/test.csv, header = TRUE) home sqr_footage cost 1 1 1500 15 2 2 2000 20 3 3 NA 30 4 4 3500 35 5 5 4000 45 I am using R 2.8.1, old I know... but maybe something else is going on? Do you really get a blank when you read in your sample data? Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Rupert Sent: Tuesday, October 06, 2009 11:39 AM To: R-help@r-project.org Subject: [R] Way of handling empty value when reading in CSV I believe I may be overlooking something simple in order address this, but I have searched RSeek.org and using ?, but cannot seem to find anything discussing this one. I am using read.csv to read in a csv file. Evidently in places there is nothing between the commas, so that when the data is read in the data.frame produced has values that are empty. Is there a way to fix this when reading the data via read.csv? I looked at all the options mentioned in ?read.csv, but did not see anything to address this case, e.g. home,sqr_footage,cost 1,1500,15 2,2000,20 3,,30 4,3500,35 5,4000,45 I would like for the empty cells to have a value of NA when they are read in. Thank you for any feedback and insights. __ 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. -- 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] R on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/2009 1:17 PM, Kjetil Halvorsen wrote: On Tue, Oct 6, 2009 at 11:23 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 10/6/2009 10:34 AM, Jose Quesada wrote: Robert Wilkins iwritecode2 at gmail.com writes: Will R have more glitches on one operating system as opposed to another, or is it pretty much the same? robert One important difference is that, if you are unsing large datasets and need memory, then windows is by far the worst. CRAN R is 32 bit and can only address 1.5 Gb of memory (or something similar; I don't really understand why). By default, 32 bit Windows only gives 2 Gb for all the user processes to share, and saves the rest of memory for itself. You can change this (see the Windows FAQ), but the most you'll ever get is 3 Gb in 32 bit Windows, _and a bit under 4 Gb in 64 bit Windows. That sounds incredible. ¿Why so? When running a 32 bit program, 64 bit Windows hides most of itself outside the address space visible to the program, so almost all of the 4 Gb address space is available to the user. But no more: no matter how much RAM you install, it's not possible to address it using a 32 bit address. Duncan Murdoch Kjetil Duncan Murdoch While there's a 64-bit version of R for windows (revolution-computing.com) I would advise against using it, for several reasons. While revolution has provided very nice packages to the community (e.g., foreach), the win-64 port as of today is certainly the worst platform to do work on. Reasons: (1) it's R 2.7.2 (2) Many important packages will never be ported (3) Some packages (particularly those depending on Rjava) would not work properly (4) There's a proprietary repository, where most packages are outrageously outdated. (5) Most help you find on R-help will not apply. Instead, you have 'paid' support. Said support is slow, and close to useless in most cases. (6) Packages that rely on external tools (e.g., mysql) will take a lot of work to get going. And of course, one have to pay for a yearly license, to have the privilege to work under the above conditions. If you need 64-bit right now, my advice is to switch to basically any other platform. Note: this may change any time, since they are working on a continuous build that will keep the releases in sync with mainstream R. Jose Quesada, PhD. Max Planck Institute, Human Development, Berlin http://www.josequesada.name/ __ 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] R on Linux, and R on Windows , any difference in maturity+stability?
On Tue, Oct 6, 2009 at 10:30 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: When running a 32 bit program, 64 bit Windows hides most of itself outside the address space visible to the program, so almost all of the 4 Gb address space is available to the user. But no more: no matter how much RAM you install, it's not possible to address it using a 32 bit address. That's true when running a 32-bit version of R under 64-bit Windows. But on the 64-bit version of REvolution R Enterprise for Windows, you can create objects much larger than 4Gb, for example: memory.limit(2e+9) v-double(1e+9) # 8GB vector sum(v) [1] 0 The same is true of 64-bit versions of R on other platforms, too. # David Smith -- David M Smith da...@revolution-computing.com Director of Community, REvolution Computing www.revolution-computing.com Tel: +1 (206) 577-4778 x3203 (San Francisco, USA) Check out our upcoming events schedule at www.revolution-computing.com/events __ 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] Robust ANOVA with variance heterogeneity
Hola! see below. On Sat, Oct 3, 2009 at 2:45 PM, David Winsemius dwinsem...@comcast.net wrote: Do you have a citation for that statement? I cannot convince myself that it should be true. OK. that took some time, since I have no nonparametrics book with me, but it is a fairly standard assumption the friedman.test shares with wilcox.test and others. One online reference giving this is: http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/friedman.htmlhttp://www.google.cl/search?q=assumptions+of+friedman+testie=utf-8oe=utf-8aq=trls=com.ubuntu:en-US:unofficialclient=firefox-a specifically: Friedman's test makes the following assumptions about the data in X: * All data come from populations having the same continuous distribution, apart from possibly different locations due to column and row effects. * All observations are mutually independent. This is also easy to investigate by simulation in R: I did: A[, 1] - rnorm(100, 0, 1) A[, 2] - rnorm(100, 0, 5) A[, 3] - rnorm(100, 0, 500) friedman.test(A) Friedman rank sum test data: A Friedman chi-squared = 2.96, df = 2, p-value = 0.2276 which surprised me! This test seems to be somewhat robust against variance heterogeneity ???, but that case is not included in the usual theory. Kjetil After looking at the CRAN Task View, I would suggest the OP look at rlm(MASS) or lmrob(robustbase). -- David On Oct 2, 2009, at 11:05 AM, Kjetil Halvorsen wrote: On Fri, Oct 2, 2009 at 8:45 AM, David Winsemius dwinsem...@comcast.net wrote: There are multiple routes to robust statistics, but the quick answer to this question is probably friedman.test I don't think friedman.test is robust to variance heterogeneity. It is only robust to non-normality. Kjetil I seem to remember a CRAN Task View on the area of Robust Statistics. -- David Winsemius On Oct 2, 2009, at 3:05 AM, Maike Luhmann wrote: Dear list members, I am looking for an alternative function for a two-way ANOVA in the case of variance heterogeneity. For one-way ANOVA, I found oneway.test(), but I didn't find anything alike for two-way ANOVA. Does anyone have a suggestion? Thank you! Maike Luhmann Freie Universität Berlin __ 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 Heritage Laboratories 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.
[R] how to output profile plots for groups using lattice package
Dear R users, I am trying to have an xyplot of a data set which has the following variables: case (n=10,20,30) parameter (parm=a,b) group (grp=g1,g2) y (y values) x (x=2,4,8) My plot should be parameter by case such that I have 2 rows (each row= each parameter) and 3 columns (each column=each case). My R-code is as follows but I am not able to get what I want to: tp1.sim - xyplot(y~ x | case + parm , group=group, data = data, lty = 1:4 , pch = 1:4) print(tp1.sim) How can I have two lines (for g1 and g2) in each plot (each box)? How do I label the x-axis with only values 2, 4, 8? How do I label each column with the corresponding case number? My hypothetical data set is as follows: parm x case y group a 2 10 0.03 g1 b 2 10 0.02 g1 a 4 10 0.03 g1 b 4 10 0.02 g1 a 8 10 0.03 g1 b 8 10 0.02 g1 a 2 20 0.03 g1 b 2 20 0.02 g1 a 4 20 0.03 g1 b 4 20 0.02 g1 a 8 20 0.03 g1 b 8 20 0.02 g1 a 2 30 0.03 g1 b 2 30 0.02 g1 a 4 30 0.03 g1 b 4 30 0.02 g1 a 8 30 0.03 g1 b 8 30 0.02 g1 a 2 10 0.13 g2 b 2 10 0.12 g2 a 4 10 0.13 g2 b 4 10 0.12 g2 a 8 10 0.13 g2 b 8 10 0.12 g2 a 2 20 0.13 g2 b 2 20 0.12 g2 a 4 20 0.13 g2 b 4 20 0.12 g2 a 8 20 0.13 g2 b 8 20 0.12 g2 a 2 30 0.13 g2 b 2 30 0.12 g2 a 4 30 0.13 g2 b 4 30 0.12 g2 a 8 30 0.13 g2 b 8 30 0.12 g2 Many thanks in advance for your response. George [[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 extract names from a vector
Hi All, I have a character vector of length=700. The vector contains names and I want to extract the names that contain the number 101. The number 101 could be anywhere within the name. what is the best way to do this? -- View this message in context: http://www.nabble.com/How-to-extract-names-from-a-vector-tp25773482p25773482.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 extract names from a vector
See ?grep On Tue, Oct 6, 2009 at 2:48 PM, kayj kjaj...@yahoo.com wrote: Hi All, I have a character vector of length=700. The vector contains names and I want to extract the names that contain the number 101. The number 101 could be anywhere within the name. what is the best way to do this? -- View this message in context: http://www.nabble.com/How-to-extract-names-from-a-vector-tp25773482p25773482.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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] Robust ANOVA with variance heterogeneity
On Oct 6, 2009, at 1:51 PM, Kjetil Halvorsen wrote: On Sat, Oct 3, 2009 at 2:45 PM, David Winsemius dwinsem...@comcast.net wrote: Do you have a citation for that statement? I cannot convince myself that it should be true. OK. that took some time, since I have no nonparametrics book with me, but it is a fairly standard assumption the friedman.test shares with wilcox.test and others. One online reference giving this is: http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/friedman.htmlhttp://www.google.cl/search ?q=assumptions+of+friedman +testie=utf-8oe=utf-8aq=trls=com.ubuntu:en- US:unofficialclient=firefox-a specifically: Friedman's test makes the following assumptions about the data in X: * All data come from populations having the same continuous distribution, apart from possibly different locations due to column and row effects. * All observations are mutually independent. This is also easy to investigate by simulation in R: I did: A[, 1] - rnorm(100, 0, 1) A[, 2] - rnorm(100, 0, 5) A[, 3] - rnorm(100, 0, 500) friedman.test(A) Friedman rank sum test data: A Friedman chi-squared = 2.96, df = 2, p-value = 0.2276 which surprised me! This test seems to be somewhat robust against variance heterogeneity ???, but that case is not included in the usual theory. I do not see that your citation implied that there would be a material impact (especially toward false positive results which I take to be the meaning of not robust) from a violation of the equi-variance assumption, ... only that equivariance was the basis of the derivation of the statistical theory. The test might even be conservative for all we know until the question has been subjected to simulation studies. And then your simulation suggested not much of a problem, which does not seem surprising to me given that a rank transformation has been applied to the data. So I remain unconvinced. -- Regards; David. Kjetil After looking at the CRAN Task View, I would suggest the OP look at rlm(MASS) or lmrob(robustbase). -- David On Oct 2, 2009, at 11:05 AM, Kjetil Halvorsen wrote: On Fri, Oct 2, 2009 at 8:45 AM, David Winsemius dwinsem...@comcast.net wrote: There are multiple routes to robust statistics, but the quick answer to this question is probably friedman.test I don't think friedman.test is robust to variance heterogeneity. It is only robust to non-normality. Kjetil I seem to remember a CRAN Task View on the area of Robust Statistics. -- David Winsemius On Oct 2, 2009, at 3:05 AM, Maike Luhmann wrote: Dear list members, I am looking for an alternative function for a two-way ANOVA in the case of variance heterogeneity. For one-way ANOVA, I found oneway.test(), but I didn't find anything alike for two-way ANOVA. Does anyone have a suggestion? Thank you! Maike Luhmann Freie Universität Berlin , David Winsemius, MD Heritage Laboratories 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] R on Linux, and R on Windows , any difference in maturity+stability?
On 10/6/2009 1:43 PM, David M Smith wrote: On Tue, Oct 6, 2009 at 10:30 AM, Duncan Murdoch murd...@stats.uwo.ca wrote: When running a 32 bit program, 64 bit Windows hides most of itself outside the address space visible to the program, so almost all of the 4 Gb address space is available to the user. But no more: no matter how much RAM you install, it's not possible to address it using a 32 bit address. That's true when running a 32-bit version of R under 64-bit Windows. But on the 64-bit version of REvolution R Enterprise for Windows, you can create objects much larger than 4Gb, for example: memory.limit(2e+9) v-double(1e+9) # 8GB vector sum(v) [1] 0 The same is true of 64-bit versions of R on other platforms, too. Yes, I was only talking about running 32 bit R. 64 bit R has another advantage on all platforms: since we're still using such a small fraction of the whole 64 bit address space, fragmentation isn't such a problem as it is with 32 bits. For those unfamiliar with the term: fragmentation happens when you allocate things at particular addresses, limiting the size of future allocations to the space available above or below or between those allocations. For the allocation David did, R needs a full 8Gb of memory at contiguous addresses. The hardware can remap physical or virtual memory to any 64 bit address it likes (within some fairly relaxed limits), so that's not a problem in 64 bit R. In 32 bit R, it means that a few small objects could easily cut your maximum allocation substantially. Pictorially, ---X--X--X--X--X-- those 5 X objects have limited future allocations to at most 6 dashes in size. 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] How to extract names from a vector
vec - 1:700 names(vec) - 700:1 names(vec)[grep(101, names(vec))] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of kayj Sent: Tuesday, October 06, 2009 12:49 PM To: r-help@r-project.org Subject: [R] How to extract names from a vector Hi All, I have a character vector of length=700. The vector contains names and I want to extract the names that contain the number 101. The number 101 could be anywhere within the name. what is the best way to do this? -- View this message in context: http://www.nabble.com/How-to-extract-names- from-a-vector-tp25773482p25773482.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.
[R] Export to Excel
I spotted quite nice blog post by learning r blog http://learnr.wordpress.com/2009/10/06/export-data-frames-to-multi-worksheet-excel-file/ very good summary how to export data from R to multiple Excel sheets. - Johannes __ 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.