[R] R2PPT - Insert data.frame
Hi all, When using the package R2PPT I am able to create a presentation, add slides, add title, add text. But when it comes to insert data.frame with the function PPT.AddDataFrame the result is everything but nice. I may need to define the data.frame in some way that power point interprets it better, but not even the example works for me: ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) my.df-data.frame(weight=weight,group=group) myPres-PPT.Init(visible=TRUE) myPres-PPT.AddBlankSlide(myPres) myPres-PPT.AddDataFrame(myPres, df = my.df,row.names=FALSE,size=c(30,100,100,300)) myPres-PPT.Present(myPres) It adds the table but doesn't even recognize the columns. I would appreciate any tip, tutorial or example. I am using Office 2010, R 2.12.2, Widows7 Thanks in advance. [[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] Rcommander
Dear Sirs, i just downloaded the R programm on my Macbook, but I can´t open Rcmdr, although I installed the needed Rcmdr-packages. I would be very happy, if you could help me. Telephone: +49 151 10868600 (Germany) or e-mail Yous sincerely, Selda Korkmaz s...@seldakorkmaz.com www.seldakorkmaz.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] tricky (for me) merging of data...more clarity
Question, How do you know that the following two rows should have NAs ? 1 16/02/87 NA NA 1 17/02/87 NA NA Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Tue, Mar 1, 2011 at 11:06 AM, Grant Gillis grant.j.gil...@gmail.comwrote: 1 16/02/87 NA NA 1 17/02/87 NA NA [[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] pb with Date format using filled.contour
Hi R-help community, Can anyone tell me why, while using : x - seq(as.Date(2001-01-01),as.Date(2001-01-01) + nrow(volcano)-1,1) y - seq(1, ncol(volcano),1) when I plot the volcano matrix with that command : filled.contour(x,y,volcano) the graph has a Date format on X-axis, ok ... ... but when adding a contour plot to the filled contour, using this command: filled.contour(x,y,volcano, plot.axes={axis(1);axis(2);contour(x,y,volcano, add = TRUE)}) the Date format doesn't appear anymore ... ?? Thanks in advance for any help, Xavier -- View this message in context: http://r.789695.n4.nabble.com/pb-with-Date-format-using-filled-contour-tp3331207p3331207.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] what does the S.D. returned by {Hmisc} rcorr.cens measure?
Thanks for your reply Prof Harrell!! Could you kindly list some references of the fomula for calculating the SD of Somer's D in this kind of application? Because I couldnt find any.. -- View this message in context: http://r.789695.n4.nabble.com/what-does-the-S-D-returned-by-Hmisc-rcorr-cens-measure-tp3329609p3331186.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] problem with glm(family=binomial) when some levels have only 0 proportion values
Hello everybody I want to compare the proportions of germinated seeds (seed batches of size 10) of three plant types (1,2,3) with a glm with binomial data (following the method in Crawley: Statistics,an introduction using R, p.247). The problem seems to be that in two plant types (2,3) all plants have proportions = 0. I give you my data and the model I'm running: success failure type [1,] 0 103 [2,] 0 102 [3,] 0 102 [4,] 0 102 [5,] 0 102 [6,] 0 102 [7,] 0 102 [8,] 461 [9,] 461 [10,] 371 [11,] 551 [12,] 731 [13,] 461 [14,] 0 103 [15,] 0 103 [16,] 0 103 [17,] 0 103 [18,] 0 103 [19,] 0 103 [20,] 0 102 [21,] 0 102 [22,] 0 102 [23,] 911 [24,] 641 [25,] 461 [26,] 0 103 [27,] 0 103 y- cbind(success, failure) Call: glm(formula = y ~ type, family = binomial) Deviance Residuals: Min 1Q Median 3Q -1.3521849 -0.427 -0.427 -0.427 Max 2.6477556 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept)0.044450.21087 0.2110.833 typeFxC -23.16283 6696.13233 -0.0030.997 typeFxD -23.16283 6696.13233 -0.0030.997 (Dispersion parameter for binomial family taken to be 1) Null deviance: 134.395 on 26 degrees of freedom Residual deviance: 12.622 on 24 degrees of freedom AIC: 42.437 Number of Fisher Scoring iterations: 20 Huge standard errors are calculated and there is no difference between plant type 1 and 2 or between plant type 1 and 3. If I add 1 to all successes, so that all the 0 values disappear, the standard error becomes lower and I find highly significant differences between the plant types. suc- success + 1 fail- 11 - suc Y- cbind(suc,fail) Call: glm(formula = Y ~ type, family = binomial) Deviance Residuals: Min 1Q Median 3Q -1.279e+00 -4.712e-08 -4.712e-08 0.000e+00 Max 2.584e+00 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.2231 0.2023 1.103 0.27 typeFxC -2.5257 0.4039 -6.253 4.02e-10 *** typeFxD -2.5257 0.4039 -6.253 4.02e-10 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 86.391 on 26 degrees of freedom Residual deviance: 11.793 on 24 degrees of freedom AIC: 76.77 Number of Fisher Scoring iterations: 4 So I think the 0 values of all plants of group 2 and 3 are the problem, do you agree? I don't know why this is a problem, or how I can explain to a reviewer why a data transformation (+ 1) is necessary with such a dataset. I would greatly appreciate any comments. Juerg __ Jürg Schulze Department of Environmental Sciences Section of Conservation Biology University of Basel St. Johanns-Vorstadt 10 4056 Basel, Switzerland Tel.: ++41/61/267 08 47 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Difference in numeric Dates between Excel and R
A detailed description of the Excel problem as seen through the eyes of MS can be found at http://support.microsoft.com/kb/214326 On 3/2/2011 8:15 AM, Prof Brian Ripley wrote: ## Excel is said to use 1900-01-01 as day 1 (Windows default) or ## 1904-01-01 as day 0 (Mac default), but this is complicated by Excel ## thinking 1900 was a leap year. ## So for recent dates from Windows Excel as.Date(35981, origin=1899-12-30) # 1998-07-05 ## and Mac Excel as.Date(34519, origin=1904-01-01) # 1998-07-05 So the origin you used is off by 2 days: one for the origin being day 1 and one for Windows Excel's ignorance of the calendar. Note too that these are *default*: they can be changed in Excel. Thank you Felipe Parra [[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. PLEASE do try to do your own homework (and not send HTML), as we requested there. It is galling that you ask here about bugs in Excel, bugs that are even documented in R's help. In future, please use the Microsoft help you paid for with Excel if it disagrees with R. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] pb with Date format using filled.contour
On Wed, 2 Mar 2011, Xavier Bodin wrote: Hi R-help community, Can anyone tell me why, while using : x - seq(as.Date(2001-01-01),as.Date(2001-01-01) + nrow(volcano)-1,1) y - seq(1, ncol(volcano),1) when I plot the volcano matrix with that command : filled.contour(x,y,volcano) the graph has a Date format on X-axis, ok ... ... but when adding a contour plot to the filled contour, using this command: filled.contour(x,y,volcano, plot.axes={axis(1);axis(2);contour(x,y,volcano, add = TRUE)}) the Date format doesn't appear anymore ... ?? You should not use using axis(1). Look at the code for filled.contour: if (missing(plot.axes)) { if (axes) { title(main = , xlab = , ylab = ) Axis(x, side = 1) Axis(y, side = 2) } } and then at the help for Axis and axis. Thanks in advance for any help, Xavier -- 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.
[R] R and Android
Hi List, Is anybody aware of any R console available for Android mobile? I know that there is one for Iphone. thanks, Alireza [[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] Difference in numeric Dates between Excel and R
On Wed, 2 Mar 2011, Erich Neuwirth wrote: A detailed description of the Excel problem as seen through the eyes of MS can be found at http://support.microsoft.com/kb/214326 No, that's only half the problem. The description at http://support.microsoft.com/kb/214330 (as cited in the as.Date.Rd file for the MS-approved numeric values) is wrong, because one of those systems starts at day 1 and one at day 0. Which description is wrong depends how you interpret 'the number of elapsed days since', but you can't have two meanings in one article. They say, correctly, that the two systems are 1462 different, but there were only 1460 (real world) or 1461 (MS world) days from 1900-01-01 to 1904-01-01. On 3/2/2011 8:15 AM, Prof Brian Ripley wrote: ## Excel is said to use 1900-01-01 as day 1 (Windows default) or ## 1904-01-01 as day 0 (Mac default), but this is complicated by Excel ## thinking 1900 was a leap year. ## So for recent dates from Windows Excel as.Date(35981, origin=1899-12-30) # 1998-07-05 ## and Mac Excel as.Date(34519, origin=1904-01-01) # 1998-07-05 So the origin you used is off by 2 days: one for the origin being day 1 and one for Windows Excel's ignorance of the calendar. Note too that these are *default*: they can be changed in Excel. -- 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] a question on sqldf's handling of missing value and factor
On Tue, Mar 1, 2011 at 11:52 PM, xin wei xin...@stat.psu.edu wrote: Dear subscribers: I am using the following code to read a large number of big text files: library(sqldf) tempd - file() tempdx - sqldf(select * from tempd, dbname = tempfile(), file.format = list(header = T, sep=\t, row.names = F)) The problem is: all my numberical variable become factor (maybe because these columns all contain missing value). It would be quite cubersome to convert them to numeric variable using as.numeric one by one. Does anyone know how to re-set SQLDF so that it would automatically read the numeric column with missing row as real numeric instead of factor? If you can provide a minimal ***reproducible*** example it would help. Maybe sqldf(..., method = raw) will give you what you want but I can't say for sure without the example. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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] Rcommander
Dear Selda, Most likely you haven't installed Tcl/Tk for X-windows. If you haven't already done so, please see the Rcmdr installation instructions for Mac users at http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html. I hope this helps, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Selda Korkmaz Sent: March-02-11 3:41 AM To: r-help@r-project.org Subject: [R] Rcommander Dear Sirs, i just downloaded the R programm on my Macbook, but I can4t open Rcmdr, although I installed the needed Rcmdr-packages. I would be very happy, if you could help me. Telephone: +49 151 10868600 (Germany) or e-mail Yous sincerely, Selda Korkmaz s...@seldakorkmaz.com www.seldakorkmaz.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and Android
Is there really one for the iphone? As far as I was aware, apple had beef about their policy agreements and the fact such software is open source/free as in freedom. I actually expected the situation would be the other way round: console for android but none for iphone? Ben W. On 02/03/2011 11:44, Dr. Alireza Zolfaghari wrote: Hi List, Is anybody aware of any R console available for Android mobile? I know that there is one for Iphone. thanks, Alireza [[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] what does the S.D. returned by {Hmisc} rcorr.cens measure?
Dxy is a U-statistic. In the U-statistic literature there is a combinatoric approach to estimating variances, requiring one to examine all possible pairs of observations. The general formula I use is a bit messy. You can look at the Fortran code that comes with the Hmisc package to see the algorithm. Frank vikkiyft wrote: Thanks for your reply Prof Harrell!! Could you kindly list some references of the fomula for calculating the SD of Somer's D in this kind of application? Because I couldnt find any.. - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/what-does-the-S-D-returned-by-Hmisc-rcorr-cens-measure-tp3329609p3331566.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] Refine ARMA model
Dear users, I tried to fit an AR(2) model to data. This the result: arima(vw,c(3,0,0)) Call: arima(x = vw, order = c(3, 0, 0)) Coefficients: ar1 ar2 ar3 intercept 0.1052 -0.0102 -0.1203 0.0099 s.e. 0.0337 0.0339 0.0338 0.0018 sigma^2 estimated as 0.002934: log likelihood = 1293.16, aic = -2576.33 Now, ar2 is not significantly different from zero. I would like to refine the model considering ar1 and ar3 only so I fit a model x[t]=c+m*x[t-1] + n*x[t-3]. Anyone could help me and tell me how to do it? Thank you very much. Chuse __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] bootstrap resampling question
Good point. I'll take my suggestion back... Giovanni On Tue, 2011-03-01 at 13:18 -0500, Jonathan P Daily wrote: I'm not sure that is equivalent to sampling with replacement, since if the first draw is 1, then the probability that the next draw will be one is 4/100 instead of the 1/20 it would be in sampling with replacement. I think the way to do this would be what Greg suggested - something like: bigsamp - sample(1:20, 100, T) idx - sort(unlist(sapply(1:20, function(x) which(bigsamp == x)[1:5])))[1:20] samp - bigsamp[idx] -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 03/01/2011 09:37:31 AM: [image removed] Re: [R] bootstrap resampling question Giovanni Petris to: Bodnar Laszlo EB_HU 03/01/2011 11:58 AM Sent by: r-help-boun...@r-project.org Cc: 'r-help@r-project.org' A simple way of sampling with replacement from 1:20, with the additional constraint that each number can be selected at most five times is sample(rep(1:20, 5), 20) HTH, Giovanni On Tue, 2011-03-01 at 11:30 +0100, Bodnar Laszlo EB_HU wrote: Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4, 5, ... 18, 19, 20). I would like to resample this database many times for the bootstrap process with the following two conditions. The resampled databases should also have 20 observations and you can select each of the previously mentioned 20 numbers with replacement. I guess it is obvious so far. Now the more difficult second condition is that one number can be selected only maximum 5 times. In order to make this clear I try to show you an example. So there can be resampled databases like the following ones: (1st database) 1,2,1,2,1,2,1,2,1,2,3,3,3,3,3,4,4,4,4,4 (4 different numbers are chosen, each selected 5 times) (2nd database) 1,8,8,6,8,8,8,2,3,4,5,6,6,6,6,7,19,1,1,1 (Two numbers - 8 and 6 - selected 5 times, number 1 selected four times, the others selected less than 4 times) My very first guess that came to my mind whilst thinking about the problem was the sample function where there are settings like replace=TRUE and prob=... where you can create a probability vector i.e. how much should be the probability of selecting a number. So I tried to calculate probabilities first. I thought the problem can basically described as a k-combination with repetitions. Unfortunately the only thing I could calculate so far is the total number of all possible selections which amounts to 137 846 527 049. Anybody knows how to implement my second tricky condition into one of the R functions? Are 'boot' and 'bootstrap' packages capable of managing this? I guess they are, I just couldn't figure it out yet... Thanks very much! Best regards, Laszlo Bodnar Ez az e-mail és az összes hozzá tartozó csatolt melléklet titkos és/vagy jogilag, szakmailag vagy más módon védett információt tartalmazhat. Amennyiben nem Ön a levél címzettje akkor a levél tartalmának közlése, reprodukálása, másolása, vagy egyéb más úton történő terjesztése, felhasználása szigorúan tilos. Amennyiben tévedésből kapta meg ezt az üzenetet kérjük azonnal értesítse az üzenet küldőjét. Az Erste Bank Hungary Zrt. (EBH) nem vállal felelősséget az információ teljes és pontos - címzett(ek)hez történő - eljuttatásáért, valamint semmilyen késésért, kapcsolat megszakadásból eredő hibáért, vagy az információ felhasználásából vagy annak megbízhatatlanságából eredő kárért. Az üzenetek EBH-n kívüli küldője vagy címzettje tudomásul veszi és hozzájárul, hogy az üzenetekhez más banki alkalmazott is hozzáférhet az EBH folytonos munkamenetének biztosítása érdekében. This e-mail and any attached files are confidential and/...{{dropped:19}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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
[R] Find downstream values in a network
Dear list, I have a data.frame with segments between river junctions and dimensionless predictions of runoff (runoff/area) at some of these junctions. As I want to plot my values on a continuous river network (this data.frame is part of a SpatialLinesDataFrame), I would like to change NA values to the closest non-NA value downstream. Here is a simple example: examp = data.frame(FROMJCT = c(1,2,3,4,5,7,8,9,10,11,12,13,14),TOJCT = c(2,3,4,5,6,4,7,8,8,10,8,12,9)) examp$pred = NA examp$pred[c(2,4,5,7,13)] = c(1,2,3,4,5) examp FROMJCT TOJCT pred 11 2 NA 22 31 33 4 NA 44 52 55 63 67 4 NA 78 74 89 8 NA 9 10 8 NA 10 1110 NA 11 12 8 NA 12 1312 NA 13 14 95 FROMJCT describes the upstream and TOJCT the downstream junction. examp$pred[7] above should hence get the value 3, as its TOJCT junction is the same as the FROMJCT junction of examp$pred[6]. examp$pred[8] should get the same value, as it is linked to examp$pred[6] through examp$pred[7]. I can do this iteratively by propagating values upwards in the river network by combining a while and a for-loop: ichange = 1 while (ichange 0) { ichange = 0 for (i in 1:dim(examp)[1]) { if (!is.na(examp$pred[i])) { toid = which(examp$TOJCT == examp$FROMJCT[i]) if (length(toid) 0 is.na(examp$pred[toid])) { examp$pred[toid] = examp$pred[i] ichange = ichange + 1 } } } print(ichange) } But this looks messy and is rather slow when the river network is described through a large number of segments. I am quite sure that I have missed a better way of propagating the values. This is a preprocessing step before plotting a result in a documentation example, so I am looking for a short, intuitive and nice solution... Any hints? Thanks, Jon __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Rioja package, creating transfer function, WA, Error in FUN
On Thu, 2011-02-10 at 09:40 -0800, mdc wrote: Hi, I am a new R user and am trying to construct a palaeoenvironmental transfer function (weighted averaging method) using the package rioja. I've managed to insert the two matrices (the species abundance and the environmental data) and have assigned them to the y and x values respectively. When I try and enter the 'WA' function though, I get an 'Error in FUN' message (see below for full values). Alas, I do not know what this means and have struggled to find similar problems to this online. Is there a step I've missed out between assigning the matrices and the WA function? SWED=odbcConnectExcel(file.choose()) (SWED is the environmental data file) sqlTables(SWED) Env=sqlFetch(SWED, Sheet1) odbcClose(SWED) Env SampleId WTD Moisture pH EC 1 N1_1 20 91.72700 3.496674 85.02688 2 N1_22 93.88913 3.550794 85.69465 3 N1_3 26 90.30269 3.948559 113.19206 4 N1_45 94.14427 3.697213 48.56375 5 N1_5 30 90.04269 3.745020 108.57278 90 GAL_15 70 94.07849 3.777932 66.77673 That's your problem, the odbc stuff has read the data in as characters. CSV would be a lot simpler, just save your excel sheets as CSV files and read them in with: Env - read.csv(my_excel_sheet.csv, row.names = 1) etc... where my_excel_sheet.csv is the name of your saved csv file or just use: Env - read.csv(file.choose(), row.names = 1) if finding files via the GUI is helpful to you. It is odd that the species data set has been read in OK though - I say OK, but you still need to get the F1 column out of the species data and set it as the row names of your data. Sorry I'm coming to this late; I've been away and not really following the list for a few weeks. If you can't get things working, contact me off list and send the Excel files and I'll send back a script that will load the files and do the WA for you to look at. HTH G STEST=odbcConnectExcel(file.choose()) sqlTables(STEST) (STEST is the species abundance file) Spe=sqlFetch(STEST, Sheet8) odbcClose(STEST) Spe (The species data contains the abundance of 32 species over 90 sites, set out like this) F1AmpFlavAmpWri ArcCat ArcDis 1N1_1 22.2929936 0.000 0.000 0.000 2N1_2 30.9677419 0.000 0.000 3.2258065 library(rioja) y -as.matrix(Spe) x -as.matrix(Env) WA(y, x, tolDW = FALSE, use.N2=TRUE, check.data=TRUE, lean=FALSE)(the command from the WA section of the rioja booklet) Error in FUN(newX[, i], ...) : invalid 'type' (character) of argument Any help would be most appreciated, Best wishes, Matthew -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Refine ARMA model
Hint: the 'fixed' argument can be used to set a parameter to a fixed value such as zero. With the reproducible example we asked you for, we might have shown you how to use it On Wed, 2 Mar 2011, Chuse chuse wrote: Dear users, I tried to fit an AR(2) model to data. This the result: arima(vw,c(3,0,0)) Call: arima(x = vw, order = c(3, 0, 0)) Coefficients: ar1 ar2 ar3 intercept 0.1052 -0.0102 -0.1203 0.0099 s.e. 0.0337 0.0339 0.0338 0.0018 sigma^2 estimated as 0.002934: log likelihood = 1293.16, aic = -2576.33 Now, ar2 is not significantly different from zero. I would like to refine the model considering ar1 and ar3 only so I fit a model x[t]=c+m*x[t-1] + n*x[t-3]. Anyone could help me and tell me how to do it? Thank you very much. Chuse -- 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] RWinEdt difficulties
On 01.03.2011 11:01, John Seers wrote: Hello Everyone I have just upgraded my PC to Windows 7 (64 bit) and I have installed R 2.12.2. R seems to be working fine. I am having problems getting RWinEdt working with it though. I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the same error using R as 64 bit or 32 bit. I install the package using Administrator rights. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt 6\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt 6\R.ini' execution failed with error code 1 One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Does it matter if you are using 64 bit R and the 32 bit WinEdt? (I have tried 32 bit R). Does RWinEdt work with WinEdt 6.0? No, not yet, unfortunately. But some free time is scheduled for this in April. Uwe Ligges Can anybody suggest a solution? Thanks for any help. Regards John Seers ** ** [[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] RWinEdt difficulties
try RStudio instead :o) http://www.rstudio.org/ Robert Kinley Uwe Ligges lig...@statistik.tu-dortmund.de Sent by: r-help-boun...@r-project.org 02/03/2011 15:00 To John Seers john.se...@googlemail.com cc r-help@r-project.org Subject Re: [R] RWinEdt difficulties On 01.03.2011 11:01, John Seers wrote: Hello Everyone I have just upgraded my PC to Windows 7 (64 bit) and I have installed R 2.12.2. R seems to be working fine. I am having problems getting RWinEdt working with it though. I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the same error using R as 64 bit or 32 bit. I install the package using Administrator rights. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt 6\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt 6\R.ini' execution failed with error code 1 One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Does it matter if you are using 64 bit R and the 32 bit WinEdt? (I have tried 32 bit R). Does RWinEdt work with WinEdt 6.0? No, not yet, unfortunately. But some free time is scheduled for this in April. Uwe Ligges Can anybody suggest a solution? Thanks for any help. Regards John Seers ** ** [[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. [[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] problem with glm(family=binomial) when some levels have only 0 proportion values
The algorithm is not converging. Your iterations are at the maximum. It won't do any good to add a fractional number to all data, as the result will depend on the number added (try 1.0, 0.5 and 0.1 to see this). The root problem is that your data are degenerate. Firstly, your types '2' and '3' are indistinguishable in your data. Secondly, consider the case without 'type'. If you have all zero data for 10 trials, you cannot discriminate among mu = 0, 0.1, 0.0001, 0.001 or 0.01. This leads to numerical instability. Thirdly, the variance estimate in the IRLS will start at 0.0, which gives a singularity. Fundamentally, the algorithm is failing because you are at the boundary of possibilities for a parameter, so special techniques are needed to do maximum likelihood estimation. The simple solution is to deal with the data for your types separately. Another is to do more batches for '2' and '3' to get an observed failure. At 05:01 AM 3/2/2011, Jürg Schulze wrote: Hello everybody I want to compare the proportions of germinated seeds (seed batches of size 10) of three plant types (1,2,3) with a glm with binomial data (following the method in Crawley: Statistics,an introduction using R, p.247). The problem seems to be that in two plant types (2,3) all plants have proportions = 0. I give you my data and the model I'm running: success failure type [1,] 0 103 [2,] 0 102 [3,] 0 102 [4,] 0 102 [5,] 0 102 [6,] 0 102 [7,] 0 102 [8,] 461 [9,] 461 [10,] 371 [11,] 551 [12,] 731 [13,] 461 [14,] 0 103 [15,] 0 103 [16,] 0 103 [17,] 0 103 [18,] 0 103 [19,] 0 103 [20,] 0 102 [21,] 0 102 [22,] 0 102 [23,] 911 [24,] 641 [25,] 461 [26,] 0 103 [27,] 0 103 y- cbind(success, failure) Call: glm(formula = y ~ type, family = binomial) Deviance Residuals: Min 1Q Median 3Q -1.3521849 -0.427 -0.427 -0.427 Max 2.6477556 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept)0.044450.21087 0.2110.833 typeFxC -23.16283 6696.13233 -0.0030.997 typeFxD -23.16283 6696.13233 -0.0030.997 (Dispersion parameter for binomial family taken to be 1) Null deviance: 134.395 on 26 degrees of freedom Residual deviance: 12.622 on 24 degrees of freedom AIC: 42.437 Number of Fisher Scoring iterations: 20 Huge standard errors are calculated and there is no difference between plant type 1 and 2 or between plant type 1 and 3. If I add 1 to all successes, so that all the 0 values disappear, the standard error becomes lower and I find highly significant differences between the plant types. suc- success + 1 fail- 11 - suc Y- cbind(suc,fail) Call: glm(formula = Y ~ type, family = binomial) Deviance Residuals: Min 1Q Median 3Q -1.279e+00 -4.712e-08 -4.712e-08 0.000e+00 Max 2.584e+00 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.2231 0.2023 1.103 0.27 typeFxC -2.5257 0.4039 -6.253 4.02e-10 *** typeFxD -2.5257 0.4039 -6.253 4.02e-10 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 86.391 on 26 degrees of freedom Residual deviance: 11.793 on 24 degrees of freedom AIC: 76.77 Number of Fisher Scoring iterations: 4 So I think the 0 values of all plants of group 2 and 3 are the problem, do you agree? I don't know why this is a problem, or how I can explain to a reviewer why a data transformation (+ 1) is necessary with such a dataset. I would greatly appreciate any comments. Juerg __ Jürg Schulze Department of Environmental Sciences Section of Conservation Biology University of Basel St. Johanns-Vorstadt 10 4056 Basel, Switzerland Tel.: ++41/61/267 08 47 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: r...@lcfltd.com Least Cost Formulations, Ltd.URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239Fax: 757-467-2947 Vere scire est per causas scire __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and
[R] how to simplify a data.frame and add the counts of duplicate rows as a new column
Hello List, I would like to simplify a data.frame like this columnA columnB user10 proj12 user10 proj19 user10 proj12 into something like: columnA columnB columnC user10 proj12 2 user10 proj19 1 I know unique() can simplify the data.frame, but how to count and store the duplicates? thanks in advance for any help. best regards, Simone __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 simplify a data.frame and add the counts of duplicate rows as a new column
see package plyr, especially the function ddply(), eg.., in your case: ddply(dataframe, .(columnA, columnB), summarise, columnC = length(columnB) ) Scott On Wednesday, March 2, 2011 at 9:10 AM, Simone Gabbriellini wrote: Hello List, I would like to simplify a data.frame like this columnA columnB user10 proj12 user10 proj19 user10 proj12 into something like: columnA columnB columnC user10 proj12 2 user10 proj19 1 I know unique() can simplify the data.frame, but how to count and store the duplicates? thanks in advance for any help. best regards, Simone __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to simplify a data.frame and add the counts of duplicate rows as a new column
many thanks, this is really a great solution! best, Simone Il giorno 02/mar/2011, alle ore 16.22, Scott Chamberlain ha scritto: see package plyr, especially the function ddply(), eg.., in your case: ddply(dataframe, .(columnA, columnB), summarise, columnC = length(columnB) ) Scott On Wednesday, March 2, 2011 at 9:10 AM, Simone Gabbriellini wrote: Hello List, I would like to simplify a data.frame like this columnA columnB user10proj12 user10proj19 user10proj12 into something like: columnA columnB columnC user10proj12 2 user10proj19 1 I know unique() can simplify the data.frame, but how to count and store the duplicates? thanks in advance for any help. best regards, Simone __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] How to extrapolate a model
I am using a multiple additive model (in the quantreg package) and I would like to 'extract' the fitted model formulae ie- for a straight line the formula would be y= 'a+b*c' for my multiple model I would expect somthing more complex because the model is not linear (its a bit like a GAM) but given I can plot the model using # f-fitted(model) #lines(f) there must be a formula that I can extract Thank you for your time Kitty [[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] message: please select CRAN mirror
chooseCRANmirror() Error in m[, 1L] : incorrect number of dimensions Can someone explain me why I can't choose the cran mirror, but get again and again this error message. Have searched for this on several engines but can't find explanation. Thanks a lot in advance! -- View this message in context: http://r.789695.n4.nabble.com/message-please-select-CRAN-mirror-tp3331711p3331711.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] *** caught segfault *** when using impute.knn (impute package)
hi, i am getting an error when calling the impute.knn function (see the screenshot below). what is the problem here and how can it be solved? screenshot: ## *** caught segfault *** address 0x513c7b84, cause 'memory not mapped' Traceback: 1: .Fortran(knnimp, x, ximp = x, p, n, imiss = imiss, irmiss, as.integer(k), double(p), double(n), integer(p), integer(n), PACKAGE = impute) 2: knnimp.internal(x, k, imiss, irmiss, p, n, maxp = maxp) 3: knnimp(x, k, maxmiss = rowmax, maxp = maxp) 4: impute.knn(dummy0, k) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace ## thanks for your help in advance! tina -- Bettina Kulle Andreassen University of Oslo Department of Biostatistics and Institute for Epi-Gen (Faculty Division Ahus) tel: +47 22851193 +47 67963923 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 with same font like in LaTeX
Hi, i want to make my plots look uniform in LaTeX documents. - usage of the same font on axes and in legend like LaTeX uses (for example Computer Modern) - put real LaTeX formulas on the axes Have you any hints how i can achieve that? I had no luck two years ago, but i want to try it again now. kind regards, -- Jonas Stein n...@jonasstein.de __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] The other Question of Censored Quantile Regression for Longitudinal Data
How to solve the panel data of cqr by writing the R code or using the quantreg ? Thank you! -- View this message in context: http://r.789695.n4.nabble.com/Question-of-Quantile-Regression-for-Longitudinal-Data-tp883458p3331318.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] Rcommander
install.packages(Rcmdr, dependencies=TRUE) library(Rcmdr) Scott On Wednesday, March 2, 2011 at 2:41 AM, Selda Korkmaz wrote: Dear Sirs, i just downloaded the R programm on my Macbook, but I can´t open Rcmdr, although I installed the needed Rcmdr-packages. I would be very happy, if you could help me. Telephone: +49 151 10868600 (Germany) or e-mail Yous sincerely, Selda Korkmaz s...@seldakorkmaz.com www.seldakorkmaz.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 and Android
Date: Wed, 2 Mar 2011 11:44:41 + From: ali.zolfagh...@gmail.com To: r-help@r-project.org Subject: [R] R and Android Hi List, Is anybody aware of any R console available for Android mobile? I know that there is one for Iphone. I was just looking at PHP libraries for use with Rserve and I guess I'd ask if you or others using R on a phone could comment on how that would compare to, say, just using a web app and running R on a remote machine through a browser? What exactly do you use R for on a small device like that? Thanks. thanks, Alireza __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] finding model order components for arima()
Hi, I am trying to model a time series using arima(). For getting the model order components(p, d, q and P,D,Q) I am using procedure discussed in [1] in section 3.2 . It is most likely hit and trial method based on lower AIC value. I want to know what is the correct way to find model order components or the method described in [1] is the appropriate one. thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] transform table to matrix
I have a text file that I have imported into R. It contains 3 columns and 316940 rows. The first column is vegetation plot ID, the second species names and the third is a cover value (numeric). I imported using the read.table function. My problem is this. I need to reformat the information as a matrix, with the first column becoming the row labels and the second the column labels and the cover values as the matrix cell data. However, since the read.tablefunction imported the data as an indexed data frame, I can't use the columns as vectors. Is there a way around this, to convert the data frame as 3 separate vectors? I have been looking all over for a function, and my programming skills are not great. -- Sk Maidul Haque Scientific Officer-C Applied Spectroscopy Division Bhabha Atomic Research Centre, Vizag Mo: 09666429050/09093458503 [[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] problem with glm(family=binomial) when some levels have only 0 proportion values
Em 2/3/2011 08:01, Jürg Schulze escreveu: Hello everybody This is not a R related problem, but rather more theoretic one, anyway: I want to compare the proportions of germinated seeds (seed batches of size 10) of three plant types (1,2,3) with a glm with binomial data (following the method in Crawley: Statistics,an introduction using R, p.247). The problem seems to be that in two plant types (2,3) all plants have proportions = 0. I give you my data and the model I'm running: success failure type [1,] 0 10 3 [snipped] [26,] 0 10 3 [27,] 0 10 3 y- cbind(success, failure) Call: glm(formula = y ~ type, family = binomial) Deviance Residuals: Min 1Q Median 3Q -1.3521849 -0.427 -0.427 -0.427 Max 2.6477556 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.04445 0.21087 0.211 0.833 typeFxC -23.16283 6696.13233 -0.003 0.997 typeFxD -23.16283 6696.13233 -0.003 0.997 (Dispersion parameter for binomial family taken to be 1) Null deviance: 134.395 on 26 degrees of freedom Residual deviance: 12.622 on 24 degrees of freedom AIC: 42.437 Number of Fisher Scoring iterations: 20 Huge standard errors are calculated and there is no difference between plant type 1 and 2 or between plant type 1 and 3. If I add 1 to all successes, so that all the 0 values disappear, the standard error becomes lower and I find highly significant differences between the plant types. suc- success + 1 fail- 11 - suc Y- cbind(suc,fail) Call: glm(formula = Y ~ type, family = binomial) Deviance Residuals: Min 1Q Median 3Q -1.279e+00 -4.712e-08 -4.712e-08 0.000e+00 Max 2.584e+00 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.2231 0.2023 1.103 0.27 typeFxC -2.5257 0.4039 -6.253 4.02e-10 *** typeFxD -2.5257 0.4039 -6.253 4.02e-10 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 86.391 on 26 degrees of freedom Residual deviance: 11.793 on 24 degrees of freedom AIC: 76.77 Number of Fisher Scoring iterations: 4 So I think the 0 values of all plants of group 2 and 3 are the problem, do you agree? It depends on the definition of problem here, if the result of your experiment, maybe, for the difference in the two regressions, not. I don't know why this is a problem, or how I can explain to a reviewer why a data transformation (+ 1) is necessary with such a dataset. You need to ascertain the modeling of your statistic test against the epistemological analysis you're performing. Caveat: I'm not an expert in agriculture, so this is just a comment. If the success rates of your dataframe are the germinations of three types of plants in a certain period of time, then perhaps it could make sense to add one to all the values in the success column (and subtract ones from the failure?) because that would cope with the possibility that a certain time after the experiment has been stopped, it could have germinated. If in the other hand, the non germinated seeds are known to not germinate anymore, then the calculation device would put you on wrong path. I would greatly appreciate any comments. Get a look at the zero inflated (and perhaps hurdle as well) distributions and the regressions associated with them. Using sos I get more than 100 entries to look at, so I'll refrain to put specific links here. HTH -- Cesar Rabak DC Consulting LTDA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 many records for suitable regression
Dear community, I was wondering if it's possible to know if you have enough data for a regression study. I remember you must have more data than parameters to obtain, but I'd like to know if there was something more sophisticated. Thanks, u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/how-many-records-for-suitable-regression-tp3331522p3331522.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] Selecting a subsample so that it follows a distribution.
Hi All, I want to select rows at random from a large data.frame while achieving a particular distribution defined my a given subset of this data.frame. How can I do this? More details and what I've done so far is given below. I have gene expression data and gene sets of interest. In order to look at enrichment of differential expression I'm doing a simple permutation approach: Selecting a an random set of genes (same size at those diff exp) and recording the overlap, repeating 10 000 times. The problem: The expression level and significance in differential expression is correlated (more power). Hence I want to do a biased permutation, selecting random genes that together follow the same expression level distribution. This is what I've done so far: geneExp is my data.frame with DE statistics. 6585 rows of genes, col one is gene ID. geneSet is my gene set, column one is gene ID. index is the index of the genes DE in my geneExp. dSign=density(geneExp[index,'baseMean']) #baseMean is a measure of expressionlevel prob=lapply(geneExp[,baseMean],function(x) approx(dSign$x,dSign$y,x)$y) prob=unlist(prob) So when I am doing my permutation I do: overlap=vector(0,length=1) for (i in 1:1) { index=sample(1:6585,543,prob=prob) overlap[i]=sum(!is.na(match(geneSet[,1],geneExp[index,1]))) } And thereafter look at the distribution of random overlaps compared to the initially observed overlap. But, the distribution of values that this permutation gives in NOT equal to the distr of significant genes, but a lot narrower. Simple because my method assumes a uniform distribution of values to chose from. Sorry if this was a complicated message, I would highly appreciate any help or comments! Best, Bryo -- View this message in context: http://r.789695.n4.nabble.com/Selecting-a-subsample-so-that-it-follows-a-distribution-tp3331659p3331659.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] Contingency table in R
Hi, I have a table in R with data I needed and need to create a contingency table out of it. The table I have so far looks like this: Binger r DietType No Yes Dangerous 15 12 Healthy52 9 None 134 24 Unhealthy 72 23 These are the error messages that I keep getting whenever I try to get a contingency table. I'm not sure why it won't work for me, any help would be appreciated! nametable-table(excat,recat) Error in table(excat, recat) : object 'excat' not found [[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] a question on sqldf's handling of missing value and factor
I am sorry for posting the wrong source file. the correct source file is as follows: a b c aa 23 aaa 34.6 77.8 They are tab delimited but somehow could not be displayed correctly in browser. -- View this message in context: http://r.789695.n4.nabble.com/a-question-on-sqldf-s-handling-of-missing-value-and-factor-tp3331007p3331667.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] Vector manipulations
I have a question regarding the most efficient way to select a substring of a vector: I have a vector of value v, and I want to select a subspace of this vector called w such that: w=v[1:n] where sum(w) = x I am interested in what you thing would be the most efficient way to do this - I would like to avoid slowing down my simulations as much as possible. Thank you very much for any help that anyone is able to give. [[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] a question on sqldf's handling of missing value and factor
Dear Mr. Grothendieck : thank you so much for your attention. You are the real expert here. the following is a mock text file: a b c aa 23 aaa 34 77 note that both b and c column contain missing value (blank) I save it under my C drive and use both read.table and sqldf to import it to R and then use identical() function to compare the result. The following is the result: setwd(c:/) library(sqldf) test - file(test.txt) testx - sqldf(select * from test, + dbname = tempfile(), file.format = list(header = T, sep=\t, row.names = F)) testy- read.table(test.txt, header = T, sep=\t) identical(testx, testy) [1] FALSE testx abc 1 aa 23.0 2 aaa 34.6 0.0 3 77.8 testy abc 1 aa NA 23.0 2 aaa 34.6 NA 3 NA 77.8 class(testx$b) [1] factor class(testy$b) [1] numeric read.table seems to get it right while sqldf treats b as factor (if I add method=raw, b become character). what is more troubling is that column C has number 0 at the second row while in the original file it is missing. In my real world situation with a much larger text file, the problem is that many cells are empty when they all actually have values in the original text file. I would greatly appreciate your help if you can shed some light on this. thanks -- View this message in context: http://r.789695.n4.nabble.com/a-question-on-sqldf-s-handling-of-missing-value-and-factor-tp3331007p3331662.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] *** caught segfault *** when using impute.knn (impute package)
On 02.03.2011 15:31, Bettina Kulle Andreassen wrote: hi, i am getting an error when calling the impute.knn function (see the screenshot below). what is the problem here and how can it be solved? Please write to the package maintainers. This is probably a bug in the package. Uwe Ligges screenshot: ## *** caught segfault *** address 0x513c7b84, cause 'memory not mapped' Traceback: 1: .Fortran(knnimp, x, ximp = x, p, n, imiss = imiss, irmiss, as.integer(k), double(p), double(n), integer(p), integer(n), PACKAGE = impute) 2: knnimp.internal(x, k, imiss, irmiss, p, n, maxp = maxp) 3: knnimp(x, k, maxmiss = rowmax, maxp = maxp) 4: impute.knn(dummy0, k) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace ## thanks for your help in advance! tina __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question regarding vector manipulation
I have a question regarding the most efficient way to select a substring of a vector: I have a vector of value v, and I want to select a subspace of this vector called w such that: w=v[1:n] where sum(w) = x I am interested in what you thing would be the most efficient way to do this - I would like to avoid slowing down my simulations as much as possible. Thank you very much for any help that anyone is able to give. Ben Hartley -- [[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] Probit Analysis and Interval Calculations for different LD50s
I am encountering a problem with the calculation of Fieller and Delta Method confidence intervals when performing probit analysis on simulated data; my code is included below. I am testing 5 dose groups, with log doses (-0.2, -0.1, 0, 0.1, 0.2) and (1.8, 1.9, 2, 2.1, 2.2) so that the log(LD50) are 0 and 2, respectively. However, while I get the coverage as seen in the literature for the log doses surrounding 0, I get very wide intervals when log(LD50)=2, with everything else remaining constant. Can anyone help please? nd=100 N=1 m=5 alpha=0.05 x-c(-0.2, -0.1, 0, 0.1, 0.2) logLD50-0 slope-10 for (i in 1:N){ dose1[i]-sum(rbinom(nd, 1, pnorm((x[1]-logLD50)*slope))) dose2[i]-sum(rbinom(nd, 1, pnorm((x[2]-logLD50)*slope))) dose3[i]-sum(rbinom(nd, 1, pnorm((x[3]-logLD50)*slope))) dose4[i]-sum(rbinom(nd, 1, pnorm((x[4]-logLD50)*slope))) dose5[i]-sum(rbinom(nd, 1, pnorm((x[5]-logLD50)*slope))) } ld50-function(b) -b[1]/b[2] for (i in 1:N){ pw-data.frame(x=x, n=rep(nd, m), y=c(dose1[i], dose2[i], dose3[i], dose4[i], dose5[i])) pw$Ymat-cbind(pw$y, nd-pw$y) pwp.1-glm(Ymat~x, family=binomial(link=probit), data=pw) pwp-summary(pwp.1) iter[i]-pwp.1$iter ld[i]-ld50(coef(pwp.1)) a[i]-coef(pwp.1)[1] b[i]-coef(pwp.1)[2] nu11-pwp$cov.unscaled[1,1] nu12-pwp$cov.unscaled[1,2] nu22[i]-pwp$cov.unscaled[2,2] mse[i]- nu11/b^2+nu22*a^2/b^4-2*nu12*a/(b^3) s.ab-sqrt(nu11/b^2+nu22*a^2/b^4-2*nu12*a/(b^3)) z.alpha-qnorm(1-alpha/2) g[i]-z.alpha^2*nu22/b[i]^2 fl.lower[i]-ld[i]+g[i]/(1-g[i])*(ld[i]-nu12/nu22)-z.alpha/(b[i]*(1-g[i]))*sqrt(nu11-2*ld[i]*nu12+ld[i]^2*nu22-g[i]*(nu11-nu12^2/nu22)) #Fieller interval fl.upper[i]-ld[i]+g[i]/(1-g[i])*(ld[i]-nu12/nu22)+z.alpha/(b[i]*(1-g[i]))*sqrt(nu11-2*ld[i]*nu12+ld[i]^2*nu22-g[i]*(nu11-nu12^2/nu22)) ci.lower[i]-ld[i]-z.alpha*s.ab #delta method interval ci.upper[i]-ld[i]+z.alpha*s.ab } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 with same font like in LaTeX
Jonas, have a look at tikzdevice Claudia -- Claudia Beleites Dipartimento dei Materiali e delle Risorse Naturali Università degli Studi di Trieste Via Alfonso Valerio 6/a I-34127 Trieste phone: +39 0 40 5 58-37 68 email: cbelei...@units.it __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 with same font like in LaTeX
Have a look at the tikzDevice package. Best, Ista On Wed, Mar 2, 2011 at 6:48 AM, Jonas Stein n...@jonasstein.de wrote: Hi, i want to make my plots look uniform in LaTeX documents. - usage of the same font on axes and in legend like LaTeX uses (for example Computer Modern) - put real LaTeX formulas on the axes Have you any hints how i can achieve that? I had no luck two years ago, but i want to try it again now. kind regards, -- Jonas Stein n...@jonasstein.de __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.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] inefficient ifelse() ?
Hi Ivo, It might be useful for you to study the examples below. The key from a programming language point of view is that functions like ifelse are functions of whole vectors, not elements of vectors. You either evaluate an argument or you don't; you don't evaluate only part of argument. (Somebody correct me if I'm wrong.) As you can see from the examples, if there are no TRUEs or no FALSEs in the condition, the corresponding arms are not evaluated, but if there are some of each, both must be evaluated. This a property of the entire condition vector. You can see all this if you type ifelse (not ?ifelse, just ifelse) and look at the definition. If you want to operate on elements of vectors, you need to use subsetting, e.g.: s = rep(NA,length(t)); b=t%%2==0; s[b]=g(t[b]); s[!b]=f(t[!b]) I agree that it might be counterintuitive for a beginner, but so is 0!=0^0=1, and both follow from first principles. (e.g. n! = n(n-1)!) Counterintuitive is not the same as incorrect, and correct is not the same as efficient. :) HTH Rex t = 1:30 ifelse(t%%2==0,g(t),f(t)) g for 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 f for 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [1] 2 6 6 12 10 18 14 24 18 30 22 36 26 42 30 48 34 54 38 60 42 66 46 72 50 [26] 78 54 84 58 90 t = 2*(1:30) ifelse(t%%2==0,g(t),f(t)) g for 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 [1] 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 [20] 120 126 132 138 144 150 156 162 168 174 180 t = 2*(1:30)+1 ifelse(t%%2==0,g(t),f(t)) f for 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 [1] 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62 66 70 74 78 [20] 82 86 90 94 98 102 106 110 114 118 122 t = rep(c(1,2,NA),3) ifelse(t%%2==0,g(t),f(t)) g for 1 2 NA 1 2 NA 1 2 NA f for 1 2 NA 1 2 NA 1 2 NA [1] 2 6 NA 2 6 NA 2 6 NA t = rep(NA,10) ifelse(t%%2==0,g(t),f(t)) [1] NA NA NA NA NA NA NA NA NA NA t=1:30 ifelse(c(TRUE,FALSE,FALSE,TRUE),g(t),f(t)) g for 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 f for 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [1] 3 4 6 12 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ivo welch Sent: Tuesday, March 01, 2011 5:20 PM To: William Dunlap Cc: r-help Subject: Re: [R] inefficient ifelse() ? yikes. you are asking me too much. thanks everybody for the information. I learned something new. my suggestion would be for the much smarter language designers (than I) to offer us more or less blissfully ignorant users another vector-related construct in R. It could perhaps be named %if% %else%, analogous to if else (with naming inspired by %in%, and with evaluation only of relevant parts [just as if else for scalars]), with different outcomes in some cases, but with the advantage of typically evaluating only half as many conditions as the ifelse() vector construct. %if% %else% may work only in a subset of cases, but when it does work, it would be nice to have. it would probably be my first goto function, with ifelse() use only as a fallback. of course, I now know how to fix my specific issue. I was just surprised that my first choice, ifelse(), was not as optimized as I had thought. best, /iaw On Tue, Mar 1, 2011 at 5:13 PM, William Dunlap wdun...@tibco.com wrote: An ifelse-like function that only evaluated what was needed would be fine, but it would have to be different from ifelse itself. The trick is to come up with a good parameterization. E.g., how would it deal with things like ifelse(is.na(x), mean(x, na.rm=TRUE), x) or ifelse(x1, log(x), runif(length(x),-1,0)) or ifelse(x1, log(x), -seq_along(x)) Would it reject such things? Deciding that the x in mean(x,na.rm=TRUE) should be replaced by x[is.na(x)] would be wrong. Deciding that runif(length(x)) should be replaced by runif(sum(x1)) seems a bit much to expect. Replacing seq_along(x) with seq_len(sum(x1)) is wrong. It would be better to parameterize the new function so it wouldn't have to think about those cases. Would you want it to depend only on a logical vector or perhaps also on a factor (a vectorized switch/case function)? Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ivo welch Sent: Tuesday, March 01, 2011 12:36 PM To: Henrique Dallazuanna Cc: r-help Subject: Re: [R] inefficient ifelse() ? thanks, Henrique. did you mean as.vector(t(mapply(function(x, f)f(x), split(t, ((t %% 2)==0)), list(f, g ? otherwise, you get a matrix. its a good solution, but unfortunately I don't think this can be used to redefine
Re: [R] *** caught segfault *** when using impute.knn (impute package)
On Wed, Mar 2, 2011 at 6:31 AM, Bettina Kulle Andreassen b.k.andreas...@medisin.uio.no wrote: hi, i am getting an error when calling the impute.knn function (see the screenshot below). what is the problem here and how can it be solved? screenshot: ## *** caught segfault *** address 0x513c7b84, cause 'memory not mapped' Traceback: 1: .Fortran(knnimp, x, ximp = x, p, n, imiss = imiss, irmiss, as.integer(k), double(p), double(n), integer(p), integer(n), PACKAGE = impute) 2: knnimp.internal(x, k, imiss, irmiss, p, n, maxp = maxp) 3: knnimp(x, k, maxmiss = rowmax, maxp = maxp) 4: impute.knn(dummy0, k) Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace ## thanks for your help in advance! I've been seeing the same problem for some time. It tends to happen when one of the clusters the function splits the data into has the same size as k. Make sure k is smaller than your data size, too. Try moving k a little bit, for example set k=9 or k=11 (the default is 10) and see if the crash goes away. I am CCing the package maintainer. HTH, Peter Bettina Kulle Andreassen University of Oslo Department of Biostatistics and Institute for Epi-Gen (Faculty Division Ahus) tel: +47 22851193 +47 67963923 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] message: please select CRAN mirror
On 02.03.2011 16:47, Aggita wrote: chooseCRANmirror() Error in m[, 1L] : incorrect number of dimensions Can someone explain me why I can't choose the cran mirror, but get again and again this error message. Have searched for this on several engines but can't find explanation. Thanks a lot in advance! -- View this message in context: http://r.789695.n4.nabble.com/message-please-select-CRAN-mirror-tp3331711p3331711.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Yes, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Which R version? Which OS? Have you tried with a recent version of R? Uwe Ligges __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rcommander
Dear Scott, I assume that Selda has already done this, but if not, the Rcmdr would still start and then offer to install its dependencies. Best, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Scott Chamberlain Sent: March-02-11 8:02 AM To: Selda Korkmaz Cc: r-help@r-project.org Subject: Re: [R] Rcommander install.packages(Rcmdr, dependencies=TRUE) library(Rcmdr) Scott On Wednesday, March 2, 2011 at 2:41 AM, Selda Korkmaz wrote: Dear Sirs, i just downloaded the R programm on my Macbook, but I canB4t open Rcmdr, although I installed the needed Rcmdr-packages. I would be very happy, if you could help me. Telephone: +49 151 10868600 (Germany) or e- mail Yous sincerely, Selda Korkmaz s...@seldakorkmaz.com www.seldakorkmaz.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. [[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 with same font like in LaTeX
Jonas, Try looking at the tikzDevice package, and/or the pgfSweave package. --Erik Jonas Stein wrote: Hi, i want to make my plots look uniform in LaTeX documents. - usage of the same font on axes and in legend like LaTeX uses (for example Computer Modern) - put real LaTeX formulas on the axes Have you any hints how i can achieve that? I had no luck two years ago, but i want to try it again now. kind regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot with same font like in LaTeX
The tikzDevice package can do this. On 3/2/2011 6:48 AM, Jonas Stein wrote: Hi, i want to make my plots look uniform in LaTeX documents. - usage of the same font on axes and in legend like LaTeX uses (for example Computer Modern) - put real LaTeX formulas on the axes Have you any hints how i can achieve that? I had no luck two years ago, but i want to try it again now. kind regards, [[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] transform table to matrix
If I understand you correctly, the easiest thing to do is import the data without converting the strings to factors (the default behavior) using: mydata - read.table(mydata.csv, as.is=TRUE) If that isn't actually your problem, the output of str(mydata) would be helpful, as would an actual example of what you are trying to do. Sarah On Wed, Mar 2, 2011 at 8:43 AM, SK MAIDUL HAQUE skmaidulha...@gmail.com wrote: I have a text file that I have imported into R. It contains 3 columns and 316940 rows. The first column is vegetation plot ID, the second species names and the third is a cover value (numeric). I imported using the read.table function. My problem is this. I need to reformat the information as a matrix, with the first column becoming the row labels and the second the column labels and the cover values as the matrix cell data. However, since the read.tablefunction imported the data as an indexed data frame, I can't use the columns as vectors. Is there a way around this, to convert the data frame as 3 separate vectors? I have been looking all over for a function, and my programming skills are not great. -- Sk Maidul Haque Scientific Officer-C Applied Spectroscopy Division Bhabha Atomic Research Centre, Vizag Mo: 09666429050/09093458503 -- 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] does rpy support R 2.12.2
On Tuesday 01 March 2011 23:36:20 Pete Shepard wrote: Hi, I am getting the following error when I try to run import rpy from the the python IDE: Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.6/dist-packages/rpy.py, line 134, in module % RVERSION) RuntimeError: No module named _rpy2122 RPy module can not be imported. Please check if your rpy installation supports R 2.12.2. If you have multiple R versions installed, you may need to set RHOME before importing rpy. For example: from rpy_options import set_options set_options(RHOME='c:/progra~1/r/rw2011/') from rpy import * I am wondering if rpy supports R 2.12.2? Thanks Yes it does but you need to recompile it for the new R version. FWIW your example above is strange in the sense that you are using a linux version and passing it a windows path... regardless it does not work because the installed rpy was compiled against a previous version of R. I hope it helps, -- José Abílio __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 and Android
If you search the list archives (using keywords such as iPhone or iPad), you will see extensive discussions on this point. There is/was an option to install a full R application on so-called jail broken Apple mobile units **only**. Otherwise, it's client/server. HTH, Marc Schwartz On Mar 2, 2011, at 8:04 AM, Ben Ward wrote: Is there really one for the iphone? As far as I was aware, apple had beef about their policy agreements and the fact such software is open source/free as in freedom. I actually expected the situation would be the other way round: console for android but none for iphone? Ben W. On 02/03/2011 11:44, Dr. Alireza Zolfaghari wrote: Hi List, Is anybody aware of any R console available for Android mobile? I know that there is one for Iphone. thanks, Alireza __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] transform table to matrix
Hi Sk, On Wed, Mar 2, 2011 at 8:43 AM, SK MAIDUL HAQUE skmaidulha...@gmail.com wrote: I have a text file that I have imported into R. It contains 3 columns and 316940 rows. The first column is vegetation plot ID, the second species names and the third is a cover value (numeric). I imported using the read.table function. My problem is this. I need to reformat the information as a matrix, with the first column becoming the row labels and the second the column labels and the cover values as the matrix cell data. dat.m - as.matrix(dat) rownames(dat.m) - dat[, 1] dat.m - dat.m[, -1] However, since the read.tablefunction imported the data as an indexed data frame, I can't use the columns as vectors. I'm not sure why you can't access the collumns in a data.frame. Of course you can -- see ?[ or ?subset Is there a way around this, to convert the data frame as 3 separate vectors? ?[ Best, Ista I have been looking all over for a function, and my programming skills are not great. -- Sk Maidul Haque Scientific Officer-C Applied Spectroscopy Division Bhabha Atomic Research Centre, Vizag Mo: 09666429050/09093458503 [[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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.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] transform table to matrix
This thread seems freakishly similar to what you are askingScott http://tolstoy.newcastle.edu.au/R/help/06/07/30127.html On Wednesday, March 2, 2011 at 7:43 AM, SK MAIDUL HAQUE wrote: I have a text file that I have imported into R. It contains 3 columns and 316940 rows. The first column is vegetation plot ID, the second species names and the third is a cover value (numeric). I imported using the read.table function. My problem is this. I need to reformat the information as a matrix, with the first column becoming the row labels and the second the column labels and the cover values as the matrix cell data. However, since the read.tablefunction imported the data as an indexed data frame, I can't use the columns as vectors. Is there a way around this, to convert the data frame as 3 separate vectors? I have been looking all over for a function, and my programming skills are not great. -- Sk Maidul Haque Scientific Officer-C Applied Spectroscopy Division Bhabha Atomic Research Centre, Vizag Mo: 09666429050/09093458503 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Contingency table in R
Hi Laura, On Wed, Mar 2, 2011 at 9:13 AM, Laura Clasemann violagirl...@msn.com wrote: Hi, I have a table in R with data I needed and need to create a contingency table out of it. The table I have so far looks like this: Binger r DietType No Yes Dangerous 15 12 Healthy 52 9 None 134 24 Unhealthy 72 23 These are the error messages that I keep getting whenever I try to get a contingency table. I'm not sure why it won't work for me, any help would be appreciated! nametable-table(excat,recat) Error in table(excat, recat) : object 'excat' not found That error seems pretty clear. The table function can't find the excat data. Is it in a data.frame or a list? Perhaps ?with will point you in the rigth direction. Best, Ista [[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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.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] Vector manipulations
Hi Benjamin, There may be faster ways, but v - 1:100 x - 10 n - which(cumsum(v) == x) w - v[1:n] seems pretty straightforward. Best, Ista On Wed, Mar 2, 2011 at 10:42 AM, Benjamin Hartley benhartley...@googlemail.com wrote: I have a question regarding the most efficient way to select a substring of a vector: I have a vector of value v, and I want to select a subspace of this vector called w such that: w=v[1:n] where sum(w) = x I am interested in what you thing would be the most efficient way to do this - I would like to avoid slowing down my simulations as much as possible. Thank you very much for any help that anyone is able to give. [[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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.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] Vector manipulations
Is this what you want? I don't know what your v looks like, but this won't work if there are cases in which v won't sum to exactly x. x - 20 v - sample(0:1, 100, T) w - v[1:which(cumsum(v)==x)] -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 03/02/2011 10:42:12 AM: [image removed] [R] Vector manipulations Benjamin Hartley to: r-help 03/02/2011 11:08 AM Sent by: r-help-boun...@r-project.org I have a question regarding the most efficient way to select a substring of a vector: I have a vector of value v, and I want to select a subspace of this vector called w such that: w=v[1:n] where sum(w) = x I am interested in what you thing would be the most efficient way to do this - I would like to avoid slowing down my simulations as much as possible. Thank you very much for any help that anyone is able to give. [[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] power regression: which package?
Dear R users and R friends, I have a little problem... I don't know anymore which package to use if I want to perform a power regression analysis. To be clear, I want to fit a regression model like this: fit - (y ~ a * x ^ b + c) where a, b and c are coefficients of the model. The R Site does not have the answer I want... Thanks in advance and with kind regards, David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RWinEdt difficulties
Thanks Robert. I will have a look at it. John Seers ** ** On Wed, Mar 2, 2011 at 3:10 PM, Robert Kinley kinley_rob...@lilly.comwrote: try RStudio instead:o) http://www.rstudio.org/ Robert Kinley *Uwe Ligges lig...@statistik.tu-dortmund.de* Sent by: r-help-boun...@r-project.org 02/03/2011 15:00 To John Seers john.se...@googlemail.com cc r-help@r-project.org Subject Re: [R] RWinEdt difficulties On 01.03.2011 11:01, John Seers wrote: Hello Everyone I have just upgraded my PC to Windows 7 (64 bit) and I have installed R 2.12.2. R seems to be working fine. I am having problems getting RWinEdt working with it though. I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the same error using R as 64 bit or 32 bit. I install the package using Administrator rights. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt 6\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt 6\R.ini' execution failed with error code 1 One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Does it matter if you are using 64 bit R and the 32 bit WinEdt? (I have tried 32 bit R). Does RWinEdt work with WinEdt 6.0? No, not yet, unfortunately. But some free time is scheduled for this in April. Uwe Ligges Can anybody suggest a solution? Thanks for any help. Regards John Seers ** ** [[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. [[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] power regression: which package?
?nls install.packages(nls2,dep=T) library(nls2) ?nls2 install.packages(nlstools) library(help=nlstools) install.packages(NISTnls, dep=T) library(help=NISTnls) the last one give access to many examples. On Wed, Mar 2, 2011 at 1:55 PM, David Croll david.cr...@gmx.ch wrote: Dear R users and R friends, I have a little problem... I don't know anymore which package to use if I want to perform a power regression analysis. To be clear, I want to fit a regression model like this: fit - (y ~ a * x ^ b + c) where a, b and c are coefficients of the model. The R Site does not have the answer I want... Thanks in advance and with kind regards, David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RWinEdt difficulties
** ** 2011/3/2 Uwe Ligges lig...@statistik.tu-dortmund.de On 01.03.2011 11:01, John Seers wrote: Hello Everyone I have just upgraded my PC to Windows 7 (64 bit) and I have installed R 2.12.2. R seems to be working fine. I am having problems getting RWinEdt working with it though. I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the same error using R as 64 bit or 32 bit. I install the package using Administrator rights. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt 6\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt 6\R.ini' execution failed with error code 1 One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Does it matter if you are using 64 bit R and the 32 bit WinEdt? (I have tried 32 bit R). Does RWinEdt work with WinEdt 6.0? No, not yet, unfortunately. But some free time is scheduled for this in April. Uwe Ligges Can anybody suggest a solution? Thanks for any help. Regards John Seers ** ** Hello Uwe Thank you for your reply. One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Hmmm. I think I did the first time. But I have tried again. Removed WinEdt 6.0 and installed 5.5. Uninstalled R and reinstalled only 64 bit version this time. Ensured all traces of RWinEdt were removed. Started R with admin privileges. Installed RWinEdt. Loaded RWinEdt. Same problem. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt\R.ini' execution failed with error code 1 Any other suggestions? Regards John Seers [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RWinEdt difficulties
On 02.03.2011 18:06, John Seers wrote: ** ** 2011/3/2 Uwe Liggeslig...@statistik.tu-dortmund.de On 01.03.2011 11:01, John Seers wrote: Hello Everyone I have just upgraded my PC to Windows 7 (64 bit) and I have installed R 2.12.2. R seems to be working fine. I am having problems getting RWinEdt working with it though. I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the same error using R as 64 bit or 32 bit. I install the package using Administrator rights. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt 6\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt 6\R.ini' execution failed with error code 1 One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Does it matter if you are using 64 bit R and the 32 bit WinEdt? (I have tried 32 bit R). Does RWinEdt work with WinEdt 6.0? No, not yet, unfortunately. But some free time is scheduled for this in April. Uwe Ligges Can anybody suggest a solution? Thanks for any help. Regards John Seers ** ** Hello Uwe Thank you for your reply. One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should worksmoothly with WinEdt 6.0. Hmmm. I think I did the first time. But I have tried again. Removed WinEdt 6.0 and installed 5.5. Uninstalled R and reinstalled only 64 bit version this time. Ensured all traces of RWinEdt were removed. Started R with admin privileges. Installed RWinEdt. Loaded RWinEdt. Same problem. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt\R.ini' execution failed with error code 1 Any other suggestions? Well, use the manual setup as indicated in the readme cinatined in the package. No idea what went wrong in this case. Uwe Regards John Seers [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RWinEdt difficulties
Well, use the manual setup as indicated in the readme cinatined in the package. No idea what went wrong in this case. OK, thanks. John Seers ** ** 2011/3/2 Uwe Ligges lig...@statistik.tu-dortmund.de On 02.03.2011 18:06, John Seers wrote: ** ** 2011/3/2 Uwe Liggeslig...@statistik.tu-dortmund.de On 01.03.2011 11:01, John Seers wrote: Hello Everyone I have just upgraded my PC to Windows 7 (64 bit) and I have installed R 2.12.2. R seems to be working fine. I am having problems getting RWinEdt working with it though. I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the same error using R as 64 bit or 32 bit. I install the package using Administrator rights. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt 6\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt 6\R.ini' execution failed with error code 1 One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. Does it matter if you are using 64 bit R and the 32 bit WinEdt? (I have tried 32 bit R). Does RWinEdt work with WinEdt 6.0? No, not yet, unfortunately. But some free time is scheduled for this in April. Uwe Ligges Can anybody suggest a solution? Thanks for any help. Regards John Seers ** ** Hello Uwe Thank you for your reply. One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should worksmoothly with WinEdt 6.0. Hmmm. I think I did the first time. But I have tried again. Removed WinEdt 6.0 and installed 5.5. Uninstalled R and reinstalled only 64 bit version this time. Ensured all traces of RWinEdt were removed. Started R with admin privileges. Installed RWinEdt. Loaded RWinEdt. Same problem. library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt\WinEdt.exe -C=R-WinEdt -E=C:\Program Files (x86)\WinEdt Team\WinEdt\R.ini' execution failed with error code 1 Any other suggestions? Well, use the manual setup as indicated in the readme cinatined in the package. No idea what went wrong in this case. Uwe Regards John Seers [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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] Line numbering in Sweave
Is there a way of getting line numbers in Schunks? Ideally, I would like to have numbers printed every two or five lines. Thank you in advance, Giovanni -- 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] merge in data.tables -- non-visible
Thanks for the help -- merge.data.table was being used! On Wed, Mar 2, 2011 at 12:25 AM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: Hi Ted, On Tue, Mar 1, 2011 at 9:45 PM, Ted Rosenbaum ted.rosenb...@yale.edu wrote: Hi, I am trying to use the merge command in the data.tables package. However, when I run the command I am not sure if it is running the merge command from the base package or the merge command from data.tables. When I run methods(generic.function=merge)' it informs me that 'merge.data.table is non-visible. I am just trying to run the merge command on two data tables using the index, is there anything else that I need to do (my googling has simply left me uncertain about how to get this to work). Thanks for your help! Assuming everything is normal, I'm going to bet the merge.data.table function is the one that is being used. Assuming you are using version = 1.5.3, though, an easy way to check is to see if the result of the merge ignores the `suffixes` argument. The behavior of merge is being changed for the next version, but this feature is an easy way for you to check which merge function is being used in the current version ;-) 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 [[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] please help with interaction.plot
Dear all I have the following code to produce a graph of 5 different variables in the same graph; however when I follow it in the end it produces the plot of the 5 variables and a legend in right but the problem is that the legend is too close to the margin of the plot and when I try to write the text for each line it does not fit. How can I change the location of the legend to be placed a little bit to the left? example-read.csv(file=example.csv) example$date-as.Date(example$Date,format=%d/%m/%Y,order=dmy) head(example) str(example) names-names(example)[2:5] examplelong - reshape(example, idvar = id, varying = list(names), v.names=outcome,direction = long) examplelong$time2-factor(examplelong$time,labels=rep( ,4)) d3-c((examplelong$date[1]),(examplelong$date[103])) d4-as.Date((d3[1])+150*(0:20)) interaction.plot(examplelong$date, examplelong$time2,examplelong$outcome,xaxt=n,type=l,pch=20,xlab=, log=y, ylab=expression(paste(Concentration~(~mu~g/L))), trace.label=,col=rainbow(4)) Thank you Maria [[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] bootstrap resampling - simplified
On 2011-03-02, at 4:00 AM, r-help-requ...@r-project.org wrote: Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4, 5, ... 18, 19, 20). I would like to resample this database many times for the bootstrap process with the following conditions. Firstly, every resampled database should also include 20 observations. Secondly, when selecting a number from the above-mentioned 20 numbers, you can do this selection with replacement. The difficult part comes now: one number can be selected only maximum 5 times. In order to make this clear I show you a couple of examples. So the resampled databases might be like the following ones: (1st database) 1,2,1,2,1,2,1,2,1,2,3,3,3,3,3,4,4,4,4,4 4 different numbers are chosen (1, 2, 3, 4), each selected - for the maximum possible - 5 times. (2nd database) 1,8,8,6,8,8,8,2,3,4,5,6,6,6,6,7,19,1,1,1 Two numbers - 8 and 6 - selected 5 times (the maximum possible times), number 1 selected 4 times, the others selected less than 4 times. (3rd database) 1,1,2,2,3,3,4,4,9,9,9,10,10,13,10,9,3,9,2,1 Number 9 chosen for the maximum possible 5 times, number 10, 3, 2, 1 chosen for 3 times, number 4 selected twice and number 13 selected only once. ... Anybody knows how to implement my tricky condition into one of the R functions - that one number can be selected only 5 times at most? Are 'boot' and 'bootstrap' packages capable of managing this? I guess they are, I just couldn't figure it out yet... Thanks very much! Best regards, Laszlo Bodnar Laszlo, Create a vector consisting of 5 of each number. Then, for each sample, scramble the order of the items in the vector, and select the first 20. -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] bootstrap resampling - simplified
I will point out again that sampling a five-fold replicate of 1:20 is not the same as resampling with replacement, although I made an error in reporting probabilities - the P(x2 = 1 | x1 = 1) = 4/99 and not 4/100. When sampling with replacement, P(x2 = 1 | x1 = 1) = P(x2 = 1 | x1 != 1) = 1/20. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 03/02/2011 01:05:01 PM: [image removed] Re: [R] bootstrap resampling - simplified Vokey, John to: r-help 03/02/2011 01:07 PM Sent by: r-help-boun...@r-project.org On 2011-03-02, at 4:00 AM, r-help-requ...@r-project.org wrote: Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4, 5, ... 18, 19, 20). I would like to resample this database many times for the bootstrap process with the following conditions. Firstly, every resampled database should also include 20 observations. Secondly, when selecting a number from the above-mentioned 20 numbers, you can do this selection with replacement. The difficult part comes now: one number can be selected only maximum 5 times. In order to make this clear I show you a couple of examples. So the resampled databases might be like the following ones: (1st database) 1,2,1,2,1,2,1,2,1,2,3,3,3,3,3,4,4,4,4,4 4 different numbers are chosen (1, 2, 3, 4), each selected - for the maximum possible - 5 times. (2nd database) 1,8,8,6,8,8,8,2,3,4,5,6,6,6,6,7,19,1,1,1 Two numbers - 8 and 6 - selected 5 times (the maximum possible times), number 1 selected 4 times, the others selected less than 4 times. (3rd database) 1,1,2,2,3,3,4,4,9,9,9,10,10,13,10,9,3,9,2,1 Number 9 chosen for the maximum possible 5 times, number 10, 3, 2, 1 chosen for 3 times, number 4 selected twice and number 13 selectedonly once. ... Anybody knows how to implement my tricky condition into one of the R functions - that one number can be selected only 5 times at most? Are 'boot' and 'bootstrap' packages capable of managing this? I guess they are, I just couldn't figure it out yet... Thanks very much! Best regards, Laszlo Bodnar Laszlo, Create a vector consisting of 5 of each number. Then, for each sample, scramble the order of the items in the vector, and select the first 20. -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] bootstrap resampling - simplified
But this seems to me to be equivalent to sample(rep(1:20, 5), 20), which I previously suggested and was pointed out to be wrong Giovanni On Wed, 2011-03-02 at 11:05 -0700, Vokey, John wrote: On 2011-03-02, at 4:00 AM, r-help-requ...@r-project.org wrote: Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4, 5, ... 18, 19, 20). I would like to resample this database many times for the bootstrap process with the following conditions. Firstly, every resampled database should also include 20 observations. Secondly, when selecting a number from the above-mentioned 20 numbers, you can do this selection with replacement. The difficult part comes now: one number can be selected only maximum 5 times. In order to make this clear I show you a couple of examples. So the resampled databases might be like the following ones: (1st database) 1,2,1,2,1,2,1,2,1,2,3,3,3,3,3,4,4,4,4,4 4 different numbers are chosen (1, 2, 3, 4), each selected - for the maximum possible - 5 times. (2nd database) 1,8,8,6,8,8,8,2,3,4,5,6,6,6,6,7,19,1,1,1 Two numbers - 8 and 6 - selected 5 times (the maximum possible times), number 1 selected 4 times, the others selected less than 4 times. (3rd database) 1,1,2,2,3,3,4,4,9,9,9,10,10,13,10,9,3,9,2,1 Number 9 chosen for the maximum possible 5 times, number 10, 3, 2, 1 chosen for 3 times, number 4 selected twice and number 13 selected only once. ... Anybody knows how to implement my tricky condition into one of the R functions - that one number can be selected only 5 times at most? Are 'boot' and 'bootstrap' packages capable of managing this? I guess they are, I just couldn't figure it out yet... Thanks very much! Best regards, Laszlo Bodnar Laszlo, Create a vector consisting of 5 of each number. Then, for each sample, scramble the order of the items in the vector, and select the first 20. -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Line numbering in Sweave
SweaveListingUtils might do it. http://cran.r-project.org/web/packages/SweaveListingUtils/index.html Best, Ista On Wed, Mar 2, 2011 at 12:30 PM, Giovanni Petris gpet...@uark.edu wrote: Is there a way of getting line numbers in Schunks? Ideally, I would like to have numbers printed every two or five lines. Thank you in advance, Giovanni -- 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.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] message: please select CRAN mirror
Aggita a.strelniece at eurotransplant.org writes: chooseCRANmirror() Error in m[, 1L] : incorrect number of dimensions Can someone explain me why I can't choose the cran mirror, but get again and again this error message. Have searched for this on several engines but can't find explanation. It's hard for us to diagnose this if we can't reproduce it. I will take a shot though. The chooseCRANmirror function looks like this: function (graphics = getOption(menu.graphics)) { if (!interactive()) stop(cannot choose a CRAN mirror non-interactively) m - getCRANmirrors(all = FALSE, local.only = FALSE) res - menu(m[, 1L], graphics, CRAN mirror) if (res 0L) { URL - m[res, URL] repos - getOption(repos) repos[CRAN] - gsub(/$, , URL[1L]) options(repos = repos) } invisible() } Looking in the guts of the function, it is clear that it is failing when it looks at the list of mirrors that it has gotten -- this list of mirrors has somehow turned into a vector instead of a matrix. You could use debug(chooseCRANmirror) to step through the function and inspect the value of m just before the function crashes. This is probably the result of some sort of network problem -- you're not getting a decent list of mirrors. What is the result of str(getCRANmirrors(all=FALSE,local.only=FALSE)) ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] bootstrap resampling - simplified
Folks: On Wed, Mar 2, 2011 at 10:32 AM, Jonathan P Daily jda...@usgs.gov wrote: I will point out again that sampling a five-fold replicate of 1:20 is not the same as resampling with replacement, -- Correct. In sampling with replacement from 1:20 there is positive probability of getting all 1's or all 2's, etc. The poster specifically said that he wanted 0 probability of such results. So, obviously, the poster does NOT want to sample with replacement from 1:20. What he does want (I think) is a re-sample of size n from the set of all **vectors** of length 20, each element of which is an integer from 1 to 20, and for which no individual values occur more than 5 times in the vector. Of course I'm just interpreting/paraphrasing the original post (if I got it right), but I think doing so makes the nature of the task clearer: one needs to find some way to sample with replacement from the space of all such **sequences**. I think it is now clear that one may do so by rejection sampling: i.e. sample with replacement from 1:20 and throw away any sequences that fail the at most 5 criterion. The sequences that remain are samples of size 1 from the population of sequences that satisfy the poster's criteria (in theory, anyway; this might tax a pseudo RNG in practice). A collection of n such sequences is a bootstrap sample from this population. I **think** that's what the poster wants -- and what others have already provided. However, maybe this clarifies why it works. If I have made any error in this, **Please** post a message pointing out my error. I sometimes get confused about this stuff, too. Cheers, Bert although I made an error in reporting probabilities - the P(x2 = 1 | x1 = 1) = 4/99 and not 4/100. When sampling with replacement, P(x2 = 1 | x1 = 1) = P(x2 = 1 | x1 != 1) = 1/20. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 03/02/2011 01:05:01 PM: [image removed] Re: [R] bootstrap resampling - simplified Vokey, John to: r-help 03/02/2011 01:07 PM Sent by: r-help-boun...@r-project.org On 2011-03-02, at 4:00 AM, r-help-requ...@r-project.org wrote: Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4, 5, ... 18, 19, 20). I would like to resample this database many times for the bootstrap process with the following conditions. Firstly, every resampled database should also include 20 observations. Secondly, when selecting a number from the above-mentioned 20 numbers, you can do this selection with replacement. The difficult part comes now: one number can be selected only maximum 5 times. In order to make this clear I show you a couple of examples. So the resampled databases might be like the following ones: (1st database) 1,2,1,2,1,2,1,2,1,2,3,3,3,3,3,4,4,4,4,4 4 different numbers are chosen (1, 2, 3, 4), each selected - for the maximum possible - 5 times. (2nd database) 1,8,8,6,8,8,8,2,3,4,5,6,6,6,6,7,19,1,1,1 Two numbers - 8 and 6 - selected 5 times (the maximum possible times), number 1 selected 4 times, the others selected less than 4 times. (3rd database) 1,1,2,2,3,3,4,4,9,9,9,10,10,13,10,9,3,9,2,1 Number 9 chosen for the maximum possible 5 times, number 10, 3, 2, 1 chosen for 3 times, number 4 selected twice and number 13 selectedonly once. ... Anybody knows how to implement my tricky condition into one of the R functions - that one number can be selected only 5 times at most? Are 'boot' and 'bootstrap' packages capable of managing this? I guess they are, I just couldn't figure it out yet... Thanks very much! Best regards, Laszlo Bodnar Laszlo, Create a vector consisting of 5 of each number. Then, for each sample, scramble the order of the items in the vector, and select the first 20. -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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,
Re: [R] bootstrap resampling - simplified
I apologize if I was not clear in my response. I only mentioned x1, x2 in my example, but I did not clarify that I also knew that P(x6 = 1 | x1..5 = 1) = 0 in the original request. I also see that if he meant that he wanted to sample with replacement from the set of sequences that sample(rep(1:20, 5), 20) is fine for generating said sequences. My interpretation was that the sequences themselves should be sampling with replacement until frequency hits 5, whereupon it is not replaced. Hence my suggestion of: bigsamp - sample(1:20, 100, T) idx - sort(unlist(sapply(1:20, function(x) which(bigsamp == x)[1:5])))[1:20] samp - bigsamp[idx] I apologize for my lack of clarity, though after reading the original post I'm not sure which solution the OP was looking for. Cheers, Jon -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly Bert Gunter gunter.ber...@gene.com wrote on 03/02/2011 02:42:40 PM: [image removed] Re: [R] bootstrap resampling - simplified Bert Gunter to: Jonathan P Daily 03/02/2011 02:42 PM Cc: Vokey, John, r-help, r-help-bounces Folks: On Wed, Mar 2, 2011 at 10:32 AM, Jonathan P Daily jda...@usgs.gov wrote: I will point out again that sampling a five-fold replicate of 1:20 is not the same as resampling with replacement, -- Correct. In sampling with replacement from 1:20 there is positive probability of getting all 1's or all 2's, etc. The poster specifically said that he wanted 0 probability of such results. So, obviously, the poster does NOT want to sample with replacement from 1:20. What he does want (I think) is a re-sample of size n from the set of all **vectors** of length 20, each element of which is an integer from 1 to 20, and for which no individual values occur more than 5 times in the vector. Of course I'm just interpreting/paraphrasing the original post (if I got it right), but I think doing so makes the nature of the task clearer: one needs to find some way to sample with replacement from the space of all such **sequences**. I think it is now clear that one may do so by rejection sampling: i.e. sample with replacement from 1:20 and throw away any sequences that fail the at most 5 criterion. The sequences that remain are samples of size 1 from the population of sequences that satisfy the poster's criteria (in theory, anyway; this might tax a pseudo RNG in practice). A collection of n such sequences is a bootstrap sample from this population. I **think** that's what the poster wants -- and what others have already provided. However, maybe this clarifies why it works. If I have made any error in this, **Please** post a message pointing out my error. I sometimes get confused about this stuff, too. Cheers, Bert although I made an error in reporting probabilities - the P(x2 = 1 | x1 = 1) = 4/99 and not 4/100. When sampling with replacement, P(x2 = 1 | x1 = 1) = P(x2 = 1 | x1 != 1) = 1/20. -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 03/02/2011 01:05:01 PM: [image removed] Re: [R] bootstrap resampling - simplified Vokey, John to: r-help 03/02/2011 01:07 PM Sent by: r-help-boun...@r-project.org On 2011-03-02, at 4:00 AM, r-help-requ...@r-project.org wrote: Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4, 5, ... 18, 19, 20). I would like to resample this database many times for the bootstrap process with the following conditions. Firstly, every resampled database should also include 20 observations. Secondly, when selecting a number from the above-mentioned 20 numbers, you can do this selection with replacement. The difficult part comes now: one number can be selected only maximum 5 times. In order to make this clear I show you a couple of examples. So the resampled databases might be like the following ones: (1st database) 1,2,1,2,1,2,1,2,1,2,3,3,3,3,3,4,4,4,4,4 4 different numbers are chosen (1, 2, 3, 4), each selected - for the maximum possible - 5 times. (2nd database) 1,8,8,6,8,8,8,2,3,4,5,6,6,6,6,7,19,1,1,1 Two numbers - 8 and 6 - selected 5 times (the maximum
[R] merge( , by='row.names') slowness
I noticed that joining two data.frames in R using the merge function that using by='row.names' slows things down substantially when compared to just joining on a common index column. Using a dataframe size of ~10,000 rows: it's as slow as 10 minutes in the by='row.names' case versus merely 1 second using an index column. Beyond the 10^6 range, it's unusably slow. n - 5 a - data.frame(id=as.character(1:10^n), x=rnorm(10^n)); rownames(a) - a$id b - data.frame(id=as.character(1:10^n + 10^(n-1)), y=rnorm(10^n)); rownames(b) - b$id date() fast - merge(a, b, all=T) date() slow - merge(a, b, all=T, by='row.names') date() Has anybody else noticed this? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Vector manipulations
Thanks Jonathan and Ista, that's really helpful. Got it running much better now. Ben On 2 March 2011 17:33, Jonathan P Daily jda...@usgs.gov wrote: Is this what you want? I don't know what your v looks like, but this won't work if there are cases in which v won't sum to exactly x. x - 20 v - sample(0:1, 100, T) w - v[1:which(cumsum(v)==x)] -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it. - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 03/02/2011 10:42:12 AM: [image removed] [R] Vector manipulations Benjamin Hartley to: r-help 03/02/2011 11:08 AM Sent by: r-help-boun...@r-project.org I have a question regarding the most efficient way to select a substring of a vector: I have a vector of value v, and I want to select a subspace of this vector called w such that: w=v[1:n] where sum(w) = x I am interested in what you thing would be the most efficient way to do this - I would like to avoid slowing down my simulations as much as possible. Thank you very much for any help that anyone is able to give. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Contingency table in R
Hi Laura and R users, I would like to know whether we can do siginificance test between Column Yes and Column No. Any one tried? I have seen it in Tabulaiton software packages from our vendors and in SPSS Custom Table. Thanks, On Wed, Mar 2, 2011 at 7:43 PM, Laura Clasemann violagirl...@msn.comwrote: Hi, I have a table in R with data I needed and need to create a contingency table out of it. The table I have so far looks like this: Binger r DietType No Yes Dangerous 15 12 Healthy52 9 None 134 24 Unhealthy 72 23 These are the error messages that I keep getting whenever I try to get a contingency table. I'm not sure why it won't work for me, any help would be appreciated! nametable-table(excat,recat) Error in table(excat, recat) : object 'excat' not found [[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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] finding model order components for arima()
Amar nandan.amar at gmail.com writes: Hi, I am trying to model a time series using arima(). For getting the model order components(p, d, q and P,D,Q) I am using procedure discussed in [1] in section 3.2 . It is most likely hit and trial method based on lower AIC value. I want to know what is the correct way to find model order components or the method described in [1] is the appropriate one. thanks in advance. [1]Automatic Time Series Forecasting: The forecast Package for R (http://www.jstatsoft.org/v27/i03) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] trouble loading ggplot2 using R
I'm having trouble loading ggplot2 on my mac (Snow Leopard) using R version 2.12.1, as shown below. I can't find a posting relevant to this problem, so any help would be very much appreciated. Thanks, peter l install.packages('ggplot2', dep = TRUE) trying URL 'http://cran.cnr.Berkeley.edu/bin/macosx/leopard/contrib/2.12/ggplot2_0.8.9.tgz' Content type 'application/x-gzip' length 2481399 bytes (2.4 Mb) opened URL == downloaded 2.4 Mb The downloaded packages are in /var/folders/XF/XF0tU7gdGTeF4Th7KhKYDk+++TI/-Tmp-//RtmpFMnqLB/downloaded_packages library(ggplot2) Error in assign(names[i], dots[[i]], env = envir) : invalid first argument Error : unable to load R code in package 'ggplot2' Error: package/namespace load failed for 'ggplot2' -- View this message in context: http://r.789695.n4.nabble.com/trouble-loading-ggplot2-using-R-tp3332044p3332044.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] spplot() - costumize the color-legend
Hi! Is there a way to manually costumize the color legend in an spplot() - especially where to draw ticks and labels for the ticks? The reason I'm asking: Usually spplot() automatically divides the data into fitting slices and makes a color legend (also automatically). I want to assign the slices myself and have a fixed scale instead of an automatic/dynamic scale. I think what I want gets clear in this example: library(sp) data(meuse.grid) gridded(meuse.grid) = ~x+y ## DATA GENERATION meuse.grid$random - rnorm(nrow(meuse.grid), 7, 2) # generate random data meuse.grid$random[meuse.grid$random 0] - 0 # make sure there is no value is smaller than zero ... meuse.grid$random[meuse.grid$random 10] - 10 # and bigger than ten ## DATA GENERATION FINISHED ## making a factor out of meuse.grid$ random to have absolute values plotted meuse.grid$random - cut(meuse.grid$random, seq(0, 10, 0.1)) # here I assign the levels I want to use in my plot!!! spplot(meuse.grid, c(random), col.regions = rainbow(100, start = 4/6, end = 1)) # look at the color-legend - not so good. The graphic itself is like I want it, but the legend doesn't look too good. Although I assign 100 factors, I want just a few ticks in the legend (and also just a few labels). How can this be achieved? Thank you! -- View this message in context: http://r.789695.n4.nabble.com/spplot-costumize-the-color-legend-tp3332225p3332225.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] GLM / Logistic Regression Problem
Hi there, I am encountering a problem with the GLM tool performing logistic regression. After computing a warning appears, saying “glm.fit: fitted probabilities numerically 0 or 1 occurred”. A prediction of new values confirms the problem as the model does not produce regular probability estimates but values which are way higher than 1 and lower than 0 in many cases. I have tried both methods setting the family=binomial and family=binomial(“logit”) so this can’t be the reason that causes the error. As an alternative solution I have considered to resort to the Logistic tool from the RWeka package. The manual says that it exists for building multinomial logistic regression models. I can’t image it would be a problem but can anyone confirm that it indeed is possible to use the algorithm for also computing binary models?! Best regards Patrick -- Schon gehört? GMX hat einen genialen Phishing-Filter in die __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Step by step procedure for the application of Threshold model
Hello Friends, Can you kindly help me with step by step procedure (in terms of the required/necessary statistical tests) before threshold model can be applied in time series analysis? I need to understand all the necessary tests - ranging from testing the properity of a time series to the application of Threshold model. A flowchart procedure will be appreciated. Thank you. Best Regards, __ MakuaChukwu Gabriel OjideResearch Analyst The Centre for public Policy Alternatives (CPPA) City Hall, Catholic Mission Street, Lagos Island, Lagos, Nigeria +234-803-778-5251 [[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] Creating a weighted sample - Help
Hi I'm new to R and most things I want to do I can do but I'm stuck on how to weight a sample. I have had a look through the post but I can't find anything that addresses my specific problem. I am wanting to scale up a sample which has been taken based on a single variable (perf) which has 4 attributes H,I, J and K. The make up of the sample is shown below:- Perf Factored Count (A) Raw Count (B) Factor (A/B) H 5,945 2,9242.033174 I 1,305 2,4360.535714 J 2,000 2,0920.956023 K 7501,2250.612245 I then want to produce all further analysis based on this factored sample. I can produce a weighted sample in SAS using the weight function which I have shown below wt=0; if perf='H' then wt=2.033174; if perf='I ' then wt=0.535714; if perf='J ' then wt=0.956023; if perf='K ' then wt=0.612245; proc freq data=DD.new; tables resdstat; weight wt; run; Does anyone know how to reproduce this in R? Thanks very much -- View this message in context: http://r.789695.n4.nabble.com/Creating-a-weighted-sample-Help-tp3331842p3331842.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] thank you
Hi Dennis I was able to my problem. Thank you encouragement and time. n-7 newvars - c(paste('m', rep(1:n, each = 4), rep(c('a', 'b')), rep(c('p1', 'p2'), each = 2), sep = '')) newvars [1] m1ap1 m1bp1 m1ap2 m1bp2 m2ap1 m2bp1 m2ap2 m2bp2 m3ap1 [10] m3bp1 m3ap2 m3bp2 m4ap1 m4bp1 m4ap2 m4bp2 m5ap1 m5bp1 [19] m5ap2 m5bp2 m6ap1 m6bp1 m6ap2 m6bp2 m7ap1 m7bp1 m7ap2 [28] m7bp2 Umesh R [[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] GLM / Logistic Regression Problem
Please read the Help for predict.glm carefully to make sure you are not confusing predicted response on the linear scale (log odds) with that on the probability scale. The warning is just that: a warning. It means that you have fitted PROBABILITIES on the boundary, which might compromise the iterative fitting algorithm and inference thereon. Ergo: examine this carefully before bithely proceeding. -- Bert On Wed, Mar 2, 2011 at 8:10 AM, pat...@gmx.de wrote: Hi there, I am encountering a problem with the GLM tool performing logistic regression. After computing a warning appears, saying “glm.fit: fitted probabilities numerically 0 or 1 occurred”. A prediction of new values confirms the problem as the model does not produce regular probability estimates but values which are way higher than 1 and lower than 0 in many cases. I have tried both methods setting the family=binomial and family=binomial(“logit”) so this can’t be the reason that causes the error. As an alternative solution I have considered to resort to the Logistic tool from the RWeka package. The manual says that it exists for building multinomial logistic regression models. I can’t image it would be a problem but can anyone confirm that it indeed is possible to use the algorithm for also computing binary models?! Best regards Patrick -- Schon gehört? GMX hat einen genialen Phishing-Filter in die __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 many records for suitable regression
It really depends on what question you are trying to answer. Things like the relative importance of type I and type II errors could matter a lot. Correlation among the predictors can affect things. What effect size are you looking for and what power do you want? And much more. There is a general rule of thumb that you need at least 10-20 observations per predictor variable (categorical variables need to be thought of as their indicator variables for this rule) to have any chance that the coefficients will be meaningful, but this is very much a lower bound and you may need more depending on some of the above questions. If you have some idea of what the structure of your data will be, then you can simulate various sample sizes, analyze them, and see which sizes start to give meaningful answers. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of agent dunham Sent: Wednesday, March 02, 2011 6:50 AM To: r-help@r-project.org Subject: [R] how many records for suitable regression Dear community, I was wondering if it's possible to know if you have enough data for a regression study. I remember you must have more data than parameters to obtain, but I'd like to know if there was something more sophisticated. Thanks, u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/how-many- records-for-suitable-regression-tp3331522p3331522.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] clustering problem
Hi, I have a gene expression experiment with 20 samples and 25000 genes each. I'd like to perform clustering on these. It turned out to become much faster when I transform the underlying matrix with t(matrix). Unfortunately then I'm not anymore able to use cutree to access individual clusters. In general I do something like this: hc - hclust(dist(USArrests), ave) library(RColorBrewer) library(gplots) clrno=3 cols-rainbow(clrno, alpha = 1) clstrs - cutree(hc, k=clrno) ccols - cols[as.vector(clstrs)] heatcol-colorRampPalette(c(3,1,2), bias = 1.0)(32) heatmap.2(as.matrix(USArrests), Rowv=as.dendrogram(hc),col=heatcol, trace=none,RowSideColors=ccols) Nice, I can access 3 main clusters with cutree. But what about a situation when I perform hclust like hc - hclust(dist(t(USArrests)), ave) which I have to do in order to speed up the clustering process. This I can plot with: heatmap.2(as.matrix(USArrests), Colv=as.dendrogram(hc),col=heatcol, trace=none) But where do I find information about the clustering that was applied to the rows? cutree(hc, k=clrno) delivers the clustering on the columns, so what can I do to access the levels for the rows? I guess the solution is easy, but after ours of playing around I thought it might be a good time to contact the mailing list! Maxim [[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] clustering problem
Don't you expect it to be a lot faster if you cluster 20 items instead of 25000? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Maxim Sent: Wednesday, March 02, 2011 4:08 PM To: r-help@r-project.org Subject: [R] clustering problem Hi, I have a gene expression experiment with 20 samples and 25000 genes each. I'd like to perform clustering on these. It turned out to become much faster when I transform the underlying matrix with t(matrix). Unfortunately then I'm not anymore able to use cutree to access individual clusters. In general I do something like this: hc - hclust(dist(USArrests), ave) library(RColorBrewer) library(gplots) clrno=3 cols-rainbow(clrno, alpha = 1) clstrs - cutree(hc, k=clrno) ccols - cols[as.vector(clstrs)] heatcol-colorRampPalette(c(3,1,2), bias = 1.0)(32) heatmap.2(as.matrix(USArrests), Rowv=as.dendrogram(hc),col=heatcol, trace=none,RowSideColors=ccols) Nice, I can access 3 main clusters with cutree. But what about a situation when I perform hclust like hc - hclust(dist(t(USArrests)), ave) which I have to do in order to speed up the clustering process. This I can plot with: heatmap.2(as.matrix(USArrests), Colv=as.dendrogram(hc),col=heatcol, trace=none) But where do I find information about the clustering that was applied to the rows? cutree(hc, k=clrno) delivers the clustering on the columns, so what can I do to access the levels for the rows? I guess the solution is easy, but after ours of playing around I thought it might be a good time to contact the mailing list! Maxim [[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. message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] a question on sqldf's handling of missing value and factor
On Wed, Mar 2, 2011 at 10:17 AM, xin wei xin...@stat.psu.edu wrote: I am sorry for posting the wrong source file. the correct source file is as follows: a b c aa 23 aaa 34.6 77.8 They are tab delimited but somehow could not be displayed correctly in browser. The problem is that you are using empty fields to represent missing values but SQLite regarded them as zero length character fields. See FAQ 14 on the sqldf home page for a solution: http://code.google.com/p/sqldf/#14._How_does_one_read_files_where_numeric_NAs_are_represented_as -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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] how to delete empty levels from lattice xyplot
Hello All, I try to use the attached code to produce a cross over plot. There are 13 subjects, 7 of them in for/sal group, and 6 of them in sal/for group. But in xyplot, all the subjects are listed in both subgraphs. Could anyone help me figure out how to get rid of the empty levels? Thanks library(lattice) pef1 - c(310,310,370,410,250,380,330,370,310,380,290,260,90) pef2 - c(270,260,300,390,210,350,365,385,400,410,320,340,220) id - c(1,4,6,7,10,11,14,2,3,5,9,12,13) sequence - c(rep('for/sal', 7), rep('sal/for', 6)) treat1 - c(rep('for', 7), rep('sal', 6)) treat2 - c(rep('sal', 7), rep('for', 6)) study - data.frame(id, sequence, treat1, pef1, treat2, pef2) studyLong - as.data.frame(rbind(as.matrix(study[,c('id', 'sequence', 'treat1', 'pef1')]), as.matrix(study[,c('id', 'sequence', 'treat2', 'pef2')]))) colnames(studyLong) - c('id', 'sequence', 'treat', 'pef') xyplot(pef ~ id | sequence, groups=treat, data=studyLong, auto.key=list(columns=2)) [[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] clustering problem
Sure, but in the end I like to call clusters of genes and not of samples. Actually the experiment is a time-lapse experiment, therefore the samples (columns) are fixed anyway. I guess my misunderstanding is that I get clustering of rows in the latter case (with dist(t(matrix))) because it's actually the heatmap function itself, that does the actual clustering on rows, right? But still my question stays the same: how can I cluster 25000 genes for 20 samples with a normal (i7) processor without running into several hours of clustering/ presumably anyhow freezing of the process? Best Maxim 2011/3/2 rex.dw...@syngenta.com Don't you expect it to be a lot faster if you cluster 20 items instead of 25000? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Maxim Sent: Wednesday, March 02, 2011 4:08 PM To: r-help@r-project.org Subject: [R] clustering problem Hi, I have a gene expression experiment with 20 samples and 25000 genes each. I'd like to perform clustering on these. It turned out to become much faster when I transform the underlying matrix with t(matrix). Unfortunately then I'm not anymore able to use cutree to access individual clusters. In general I do something like this: hc - hclust(dist(USArrests), ave) library(RColorBrewer) library(gplots) clrno=3 cols-rainbow(clrno, alpha = 1) clstrs - cutree(hc, k=clrno) ccols - cols[as.vector(clstrs)] heatcol-colorRampPalette(c(3,1,2), bias = 1.0)(32) heatmap.2(as.matrix(USArrests), Rowv=as.dendrogram(hc),col=heatcol, trace=none,RowSideColors=ccols) Nice, I can access 3 main clusters with cutree. But what about a situation when I perform hclust like hc - hclust(dist(t(USArrests)), ave) which I have to do in order to speed up the clustering process. This I can plot with: heatmap.2(as.matrix(USArrests), Colv=as.dendrogram(hc),col=heatcol, trace=none) But where do I find information about the clustering that was applied to the rows? cutree(hc, k=clrno) delivers the clustering on the columns, so what can I do to access the levels for the rows? I guess the solution is easy, but after ours of playing around I thought it might be a good time to contact the mailing list! Maxim [[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. message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. [[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] Create a zoo/xts Time Series with Millisecond jumps
Is there a easy way to create the time index for a zoo/xts object for every 100 milliseconds. eg. time Index would be: 10:00:00:100 10:00:00:200 10:00:00:300 10:00:00:400 I am looking to build an empty zoo/xts object with time index from 10am to 3pm, index jumps by 100ms each row. Thanks, Chris -- View this message in context: http://r.789695.n4.nabble.com/Create-a-zoo-xts-Time-Series-with-Millisecond-jumps-tp3332427p3332427.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] looping through data in sections and performing a function on each one
Hi, I have a series of data (y) against the time of day (x), for simplicity consider: x=c(0,1,2,3,4,5,6,7,8,9,10) y=c(0,1,2,3,0,-1,-2,1,2,1,0) I wish to loop through the y values and and at the point where they touch or cross the x axis, subtract the previous times of day from this point, and calculate the y weighted average time for this interval. The loop then needs to continue to the next interval bounded by the points where y=0 and do the same. I will finally take the arithmetic average all of these to come up with an average value of time. To clarify by considering the simplified values above, the program needs to return: (4*0+3*1+2*2+1*3)/(0+1+2+3) = 1.66 (3*0+2*1+1*2)/(0+1+2)=1.33 (2*2+1*1)/(2+1)=1.66 returning an average time of 1.55 the final value of the sequence is always 0. considering just the first interval i could use something like for(i in 1:length(x))print(abs(y[i])*x[length(x)]-x[i]) but how do I sum over these values and divide by the sum of the y values in that interval? Secondly how do I continue iterating through the data over each subsequent interval? I have found this fairly easy to code in Fortran but I need to do it in R which is relatively new to me. Any suggestions on improving the method would also be appreciated if it is over complicating things Many thanks, Ryan [[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] parallel bootstrap linear model on multicore mac (re-post)
Hello all, I am re-posting my previous question with a simpler, more transparent, commented code. I have been ramming my head against this problem, and I wondered if anyone could lend a hand. I want to make parallel a bootstrap of a linear mixed model on my 8-core mac. Below is the process that I want to make parallel (namely, the boot.out-boot(dat.res,boot.fun, R = nboot) command). This is an extension to lmer of the bootstrapping linear models example in Venables and Ripley. Please excuse my rather terrible programming skills. I am always open to suggestions. Below the example I describe what methods I have tried. library(boot) library(lme4) dat-read.table(http://www2.fiu.edu/~adick/downloads/toy2.dat http://www2.fiu.edu/%7Eadick/downloads/toy2.dat, header = T) nboot-1000 # number of bootstraps attach(dat) x-dat[,2] # IV number 1 y-dat[,4] # DV z-dat[,3] # IV number 2 subj-dat[,1] # random factor boot.fun-function(data,i) { # function to resample residuals d-data d$y- d$fitted+d$res[i] # populate new y values based on resampled residuals as.numeric(coef(update(m2.fit,data=d))[1][[1]][1,c(1:4)]) # update the linear model and output the coefficients } fit-lmer(y~x*z + (1|(subj))) # the linear model dat.res-data.frame(y,x,z,subj, res=resid(fit), fitted=fitted(fit)) # add residuals and fitted values to dat boot.out-boot(dat.res,boot.fun, R = nboot) # run the bootstrap using the boot.fun boot.out Methods attempted: Using the multicore package, I tried boot.out-collect(parallel(boot(dat.res,boot.fun, R = nboot))). This returned a correct result, but did not speed things up. Not sure why... I also tried snowfall and snow. While I can create a cluster and run simple processes (e.g., provided example from literature), I can't get the bootstrap to run. For example, using snow: cl- makeCluster(8) clusterSetupRNG(cl) clusterEvalQ(cl,library(boot)) clusterEvalQ(cl,library(lme4)) boot.out-clusterCall(cl,boot(dat.res,boot.fun, R = nboot)) stopCluster() returns the following error: Error in checkForRemoteErrors(lapply(cl, recvResult)) : 8 nodes produced errors; first error: could not find function fun I am stuck and at the limit of my programming knowledge and am punting to the R-help list. I need to run this process thousands of times, which is the reason to make it parallel. Any suggestions are much appreciated. Anthony -- Anthony Steven Dick, Ph.D. Assistant Professor Department of Psychology Florida International University Modesto A. Maidique Campus DM 296B 11200 S.W. 8th Street Miami, FL 33199 Phone: 305-348-4202 Lab Phone: 305-348-9057 or 305-348-9055 (I am usually here) Fax: 305-348-3879 Email: ad...@fiu.edu Webpage: http://www.fiu.edu/~adick [[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] merge( , by='row.names') slowness
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of dms Sent: Wednesday, March 02, 2011 3:16 PM To: r-help@r-project.org Subject: [R] merge( , by='row.names') slowness I noticed that joining two data.frames in R using the merge function that using by='row.names' slows things down substantially when compared to just joining on a common index column. Using a dataframe size of ~10,000 rows: it's as slow as 10 minutes in the by='row.names' case versus merely 1 second using an index column. Beyond the 10^6 range, it's unusably slow. n - 5 a - data.frame(id=as.character(1:10^n), x=rnorm(10^n)); rownames(a) - a$id b - data.frame(id=as.character(1:10^n + 10^(n-1)), y=rnorm(10^n)); rownames(b) - b$id date() fast - merge(a, b, all=T) date() slow - merge(a, b, all=T, by='row.names') date() Has anybody else noticed this? _ HI DMS, Well, first off, they don't give the same answer... in fact, not even the same dimension. Even so, from looking at merge.data.frame, it's not immediately obvious what would make a difference of this magnitude. The answer might be buried in the internal merge. Here for n=3: system.time(print(dim(merge(a,b,all=T [1] 11003 user system elapsed 0.010.000.01 system.time(print(dim(merge(a,b,all=T,by=1 [1] 11003 user system elapsed 0.010.000.02 system.time(print(dim(merge(a,b,all=T,by=0 [1] 11005 user system elapsed 3.260.003.17 system.time(print(dim(merge(a,b,all=T,by=row.names [1] 11005 user system elapsed 3.170.003.17 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Create a zoo/xts Time Series with Millisecond jumps
On Wed, Mar 2, 2011 at 5:14 PM, rivercode aqua...@gmail.com wrote: Is there a easy way to create the time index for a zoo/xts object for every 100 milliseconds. eg. time Index would be: 10:00:00:100 10:00:00:200 10:00:00:300 10:00:00:400 I am looking to build an empty zoo/xts object with time index from 10am to 3pm, index jumps by 100ms each row. Here are three ways. as.xts(z2) could be used to turn the second one into xts. library(zoo) library(chron) len - 5 * 60 * 60 * 10 + 1 # use chron times class z1 - zoo(, seq(times(10:00:00), times(15:00:00), length = len)) # use POSIXct times z2 - zoo(, seq(as.POSIXct(2011-01-01 10:00:00), as.POSIXct(2011-01-01 15:00:00), length = len)) # number intervals from 1 to len z3 - zoo(, seq_len(len)) -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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] transform table to matrix
Scott Chamberlain wrote: This thread seems freakishly similar to what you are askingScott Even to the point of including the same typo as well as proof that neither poster bothered to read the posting guide. Great spot, Scott! Peter Ehlers http://tolstoy.newcastle.edu.au/R/help/06/07/30127.html On Wednesday, March 2, 2011 at 7:43 AM, SK MAIDUL HAQUE wrote: I have a text file that I have imported into R. It contains 3 columns and 316940 rows. The first column is vegetation plot ID, the second species names and the third is a cover value (numeric). I imported using the read.table function. My problem is this. I need to reformat the information as a matrix, with the first column becoming the row labels and the second the column labels and the cover values as the matrix cell data. However, since the read.tablefunction imported the data as an indexed data frame, I can't use the columns as vectors. Is there a way around this, to convert the data frame as 3 separate vectors? I have been looking all over for a function, and my programming skills are not great. -- Sk Maidul Haque Scientific Officer-C Applied Spectroscopy Division Bhabha Atomic Research Centre, Vizag Mo: 09666429050/09093458503 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] transform table to matrix
Agreed Peter: weird. What is the purpose of your inquiry SK? And why is your inquiry so similar to the one at the hyperlink I provided? Scott On Wednesday, March 2, 2011 at 6:10 PM, P Ehlers wrote: Scott Chamberlain wrote: This thread seems freakishly similar to what you are askingScott Even to the point of including the same typo as well as proof that neither poster bothered to read the posting guide. Great spot, Scott! Peter Ehlers http://tolstoy.newcastle.edu.au/R/help/06/07/30127.html On Wednesday, March 2, 2011 at 7:43 AM, SK MAIDUL HAQUE wrote: I have a text file that I have imported into R. It contains 3 columns and 316940 rows. The first column is vegetation plot ID, the second species names and the third is a cover value (numeric). I imported using the read.table function. My problem is this. I need to reformat the information as a matrix, with the first column becoming the row labels and the second the column labels and the cover values as the matrix cell data. However, since the read.tablefunction imported the data as an indexed data frame, I can't use the columns as vectors. Is there a way around this, to convert the data frame as 3 separate vectors? I have been looking all over for a function, and my programming skills are not great. -- Sk Maidul Haque Scientific Officer-C Applied Spectroscopy Division Bhabha Atomic Research Centre, Vizag Mo: 09666429050/09093458503 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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.