[R] Problem loading RGtk2 (iconv.dll)
Hello dear R-help list and Michael Lawrence. I wish to use GTK with R. I installed the newest RGtk2 and GTK from: http://sourceforge.net/projects/gladewin32/files/gtk%2B-win32-devel/2.12.9/gtk-dev-2.12.9-win32-2.exe/download on the path: C:\Program Files\Common Files\GTK\2.0\ And followed the instructions on the installation manual for RGtk2, and added the line: GTK_PATH=C:/Program Files/Common Files/GTK/2.0 To the etc/Renviron.site file. Yet when I come to load the package via require(RGtk2), I get the following *error massage*: the procedure entry point libiconv_set_relocation_prefix could not be located in the dynamic linke library iconv.dll And then (in the R console) I get: Loading required package: RGtk2 Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/Program Files/R/library/RGtk2/libs/RGtk2.dll': LoadLibrary failure: The specified procedure could not be found. The interesting thing is that after I install GTK (through the auto-install), then RGtk2 loads without error in R. But if I try to run something, for example: demo(alphaSlider) I will get the error massage: Error in .Call(name, ..., PACKAGE = PACKAGE) : C symbol name S_gtk_window_new not in DLL for package RGtk2 Upon restarting R, again, I wouldn't be able to use require(RGtk2) Here is my sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RGtk2_2.12.18 loaded via a namespace (and not attached): [1] tools_2.11.0 (I am running win XP) I tried searching for this error on the mailing list and on google, but couldn't find a solution. Thanks, Tal 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) -- [[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 with ICD9 codes
Hello: I am working on getting some statistics related to clinical trials and stuff. I have to work with ICD9 codes. Is anyone aware of any R package that deals with ICD9 codes verification and manipulation. Thanks Vishwanath __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] authorization for posting
I would like to post to this list from carloscanogutier...@gmail.com Thanks, Carlos Cano __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 in R
Hi Ayesha, hclust is a way to go (much better then trying to invent the wheel here). Please add what you used to create: distA And create a sample data set to show us what you did, using dput Best, Tal 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 Fri, May 28, 2010 at 2:41 AM, Ayesha Khan ayesha.diamond...@gmail.comwrote: i have a matrix with the following dimensions 136 3 and it looks something like [,1] [,2] [,3] [1,] 402 675 1.802758 [2,] 402 696 1.938902 [3,] 402 699 1.994253 [4,] 402 945 1.898619 [5,] 424 470 1.812857 [6,] 424 905 1.816345 [7,] 470 905 1.871252 [8,] 504 780 1.958191 [9,] 504 848 1.997111... so you get the idea. I want to group similar items in one group/cluster following the friends of friends approach. I tried doing distclust - hclust(distA,method=single) However, I got the following error. Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero which probably means there's something wrong with my input here. Is there another way of doing this kind of clustering without getting into all the looping and ifelse etc. Basically, if 402 is close to 675,696,and699 and thus fall in cluster A then all items close to 675,696,and 699 should also fall into the same cluster A following a friends of friedns strategy. Any help would be highly appreciated. -- Ayesha Khan MS Bioengineering Dept. of Bioengineering Rice University, TX [[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] Data frame manipulation
Hi there, The tool to learn for this is the cast function using the reshape package. In your example you have more then one value for RTL, which you should think of how to account for. But basically, here is a solution to what you asked for (assuming I understood you correctly) require(reshape) #?cast cast(EmpTotCt.Zn.., Taz ~ ClusterType , value = TotEmp, mean, fill = 0) Best, Tal 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 Fri, May 28, 2010 at 3:14 AM, LCOG1 jr...@lcog.org wrote: Hello All, Please consider the following: TotEmp-c(19,6,1,1,8,44,2,33,48,1) ClusterType-c(AGF,CNS,OSV,RTL,RTL,TRN,REL,ACC_CLUST,RTL,WHL) Taz-c(0,0,0,100,100,100,101,101,102,103) AllCtTypes_-c(AGF,CNS,OSV,RTL,TRN,REL,ACC_CLUST,WHL,ADM_CLUST, HLH,HLH_CLUST,ACC,RTL_CLUST,MFG,ADM,MFG_CLUST,CNS_CLUST,PRF,PUB, FIN,INF_CLUST,INF,EDU_CLUST,REC,EDU, MNG,UTL,MIN) #Build data frame EmpTotCt.Zn..-data.frame(TotEmp,ClusterType,Taz) #Reverse rows to columns EmpTotCt.Zn2..-as.data.frame(t(as.matrix(EmpTotCt.Zn..))) EmpTotCt.Zn.. is a data frame that i would like to alter by adding new columns and input 0s where no values exist. I tried the line below as its the only way i know of switching columns to rows but its far from what i am looking for. So EmpTotCt.Zn.. returns TotEmp ClusterType Taz 1 19 AGF 0 2 6 CNS0 3 1 OSV 0 4 1 RTL 100 5 8 RTL 100 6 44 TRN100 7 2 REL 101 8 33 ACC_CLUST 101 9 48 RTL 102 10 1 RTL 103 But what i want is to return the below: AGF CNS OSV RTL RTL TRN REL ACC_CLUST RTL 0 19 6 1 0 0 0 0 0 0 100 0 0 0 1 8 44 0 0 0 101 0 0 0 0 0 0 2 33 0 102 0 0 0 0 0 0 0 0 48 103 0 0 0 0 0 0 0 0 1 Where the rows represent Taz and the columns represent ALL ClusterType's found in AllCtTypes_, this would mean that the above output example would have many more columns with 0s in all the rows since there are no observations. Its taken me a while to get the data into the above format and im afraid im stuck with how to get it into the final computational format, so hopefully someone can help. Perhaps i have to build a blank data frame with the appropriate dimensions first but i am not sure if this is the most efficient way of accomplishing this. Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/Data-frame-manipulation-tp2233932p2233932.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. [[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] Comparing and Interpreting GAMMs
Dear R users I have a question related to the interpretation of results based on GAMMs using Simon Woods package gamm4. I have repeated measurements (hours24) of subjects (vpnr) and one factor with three levels (pred). The outcome (dv) is binary. In the first model I'd like to test for differences among factor levels (main effects only): gamm.11-gamm4(dv ~ pred +s(hours24), random = ~ (1|vpnr),data=sdata,family=binomial) In the second model I'd like to test whether the smooths vary across factor levels (interaction): gamm.12-gamm4(dv ~ pred +s(hours24) +s(hours24,by=pred), random = ~ (1|vpnr),data=sdata,family=binomial) Part of the output for both models is shown below. My questions are: 1) Which is the best way to test whether smooths actually vary across factor levels? Is thought that one way would be to compare the two models, e.g. by calculating differences between the two deviances and degrees of freedom (as long as this has a chi-square distribution). If so this would serve as a kind of overall test for interaction which would be fine. Would this be suitable or is there a better way to accomplish this? 2) It would be interesting to compare smooths of specific factor levels with each other. I thought that I would get the answer to this question by correctly interpreting the coefficients of the second model. I've assumed that in the output below (at the very end) the (approximate) significance of the first smooth term s(hours24) tests for the smooth of the averaged values (across all three factor levels) against a horizontal line, whereas the three additional smooths (s(hours24):pred1 etc.) test for the deviation from this average to the respective factor level. If so how would I have to set up a model in which I could directly compare specific factors with each other? I've also tried to omit the smooth term s(hours24): gamm.12-gamm4(dv ~ pred +s(hours24,by=pred), random = ~ (1|vpnr),data=sdata,family=binomial) However this would obviously test each of the smooths aginst a horizontal line which is not what I want. Any help is greatly appreciated, thanks! Andrea Output of 1st model gamm.11: logLik(gamm.11$mer);deviance(gamm.11$mer);attributes(summary(gamm.11$mer))$AICtab[1];gamm.11$...@deviance[disc] 'log Lik.' -49054.65 (df=5) ML 98109.3 AIC 98119.3 disc 97600 summary(gamm.11$mer);summary(gamm.11$gam) Generalized linear mixed model fit by the Laplace approximation AIC BIC logLik deviance 98119 98167 -4905598109 Random effects: Groups NameVariance Std.Dev. vpnr (Intercept)0.12965 0.36007 Xr.1 s(hours24) 1291.42444 35.93639 Number of obs: 97920, groups: vpnr, 114; Xr.1, 8 Fixed effects: Estimate Std. Error z value Pr(|z|) X(Intercept) 0.3713345 0.0644469 5.762 8.32e-09 *** Xpred2 -0.0575848 0.0865231 -0.6660.506 Xpred30.0003748 0.0869543 0.0040.997 Parametric coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.3713345 0.0149858 24.779 2e-16 *** pred2 -0.0575848 0.0197488 -2.916 0.00355 ** pred30.0003748 0.0198803 0.019 0.98496 Output of 2nd model gamm.12: - logLik(gamm.12$mer);deviance(gamm.12$mer);attributes(summary(gamm.12$mer))$AICtab[1];gamm.12$...@deviance[disc] 'log Lik.' -48714.29 (df=8) ML 97428.59 AIC 97444.59 disc 96840.12 summary(gamm.12$mer);summary(gamm.12$gam) Generalized linear mixed model fit by the Laplace approximation AIC BIC logLik deviance 97445 97521 -4871497429 Random effects: Groups Name Variance Std.Dev. vpnr (Intercept) 0.12777 0.35744 Xr.4 s(hours24):pred3 262.64433 16.20631 Xr.3 s(hours24):pred20.0 0.0 Xr.2 s(hours24):pred1 422.37197 20.55169 Xr.1 s(hours24) 1377.63864 37.11655 Number of obs: 97920, groups: vpnr, 114; Xr.4, 8; Xr.3, 8; Xr.2, 8; Xr.1, 8 Fixed effects: Estimate Std. Error z value Pr(|z|) X(Intercept) 0.339910.06402 5.310 1.10e-07 *** Xpred2 -0.049120.08607 -0.5710.568 Xpred30.114600.08691 1.3190.187 Parametric coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 0.339910.01504 22.598 2e-16 *** pred2 -0.049120.02036 -2.412 0.0159 * pred30.114600.02217 5.170 2.34e-07 *** Approximate significance of smooth terms: edfRef.df Chi.sq p-value s(hours24) 7.943e+00 7.943e+00 9030.4 2e-16 *** s(hours24):pred1 7.598e+00 7.598e+00 139.1 2e-16 *** s(hours24):pred2 5.000e-12 5.000e-120.0 NA s(hours24):pred3 7.367e+00 7.367e+00 350.7 2e-16 *** [[alternative HTML version deleted]] __ R-help@r-project.org mailing list
Re: [R] Methods to explore R data structures
Great, these are valuable tips. Thanks both of you. I appreciate it. :) Timothy [[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] vlookup in R?
Hi: I think the idea here is to use the cdf intervals as the lookup table for rand (the entire vector) and then return the seq value corresponding to the found interval. Combining the ideas from Jim Holtman (use findInterval()) and Josh Wiley, what worked for me was to split the OP's data into three vectors. Starting from Josh's datasamp, datasamp - structure(list(cdf = c(0, 0.00156, 0.0155, 0.053, 0.116, 0.197, 0.288, 0.38, 0.468, 0.548, 0.618, 0.679, 0.732, 0.776, 0.813, 0.844, 0.87, 0.892, 0.91, 0.926, 0.938, 0.949, 0.957, 0.965, 0.971, 0.976, 0.98, 0.983, 0.986, 0.988, 0.99), seq = c(0L, 20L, 40L, 60L, 80L, 100L, 120L, 140L, 160L, 180L, 200L, 220L, 240L, 260L, 280L, 300L, 320L, 340L, 360L, 380L, 400L, 420L, 440L, 460L, 480L, 500L, 520L, 540L, 560L, 580L, 600L), rand = c(0.262123478, 0.964293344, 0.494827113, 0.733726005, 0.800408948, 0.925748466, 0.047578356, 0.266060366, 0.125522629, 0.701193274, 0.915799432, 0.735984375, 0.517838069, 0.042085025, 0.568346202, 0.067140721, 0.71437727, 0.712210456, 0.288460952, 0.185857723, 0.108859523, 0.513351848, 0.22214423, 0.500350963, 0.437818537, 0.851771599, 0.803521836, 0.249824519, 0.859248634, 0.126926481, 0.713431196 )), .Names = c(cdf, seq, rand), class = data.frame, row.names = c(NA, -31L)) cdf - datasamp[, 1] sq - datasamp[, 2] rand - c(datasamp$rand, 0.253425703, 0.830195013, 0.723929563, 0.027588733, 0.091067232, 0.689504685, 0.890469069, 0.710440382) rm(datasamp) cbind(rand, sq[findInterval(rand, cdf)], sq[findInterval(rand, cdf) + 1]) rand [1,] 0.26212348 100 120 [2,] 0.96429334 440 460 [3,] 0.49482711 160 180 [4,] 0.73372600 240 260 [5,] 0.80040895 260 280 [6,] 0.92574847 360 380 [7,] 0.04757836 40 60 ... I noticed that the original result seemed to be an interval below what the OP expected, so add one to the vector of indices returned from findInterval() to get the third column. HTH, Dennis On Thu, May 27, 2010 at 6:20 PM, Roslina Zakaria zrosl...@yahoo.com wrote: Hi R-users, I would like to search for the values of seq that match my rand values. In excel I will use =VLOOKUP(G2,$E$2:$F$32,2). For example, for rand=.262 it will give me approximately seq=120 and rand=0.964293344, seq=460 and etc. E F G cdf seq rand 0.00E+000 0.262123478 1.56E-03200.964293344 1.55E-02400.494827113 5.30E-02600.733726005 1.16E-01800.800408948 1.97E-01100 0.925748466 2.88E-01120 0.047578356 3.80E-01140 0.266060366 4.68E-01160 0.125522629 5.48E-01180 0.701193274 6.18E-01200 0.915799432 6.79E-01220 0.735984375 7.32E-01240 0.517838069 7.76E-01260 0.042085025 8.13E-01280 0.568346202 8.44E-01300 0.067140721 8.70E-01320 0.71437727 8.92E-01340 0.712210456 9.10E-01360 0.288460952 9.26E-01380 0.185857723 9.38E-01400 0.108859523 9.49E-01420 0.513351848 9.57E-01440 0.22214423 9.65E-01460 0.500350963 9.71E-01480 0.437818537 9.76E-01500 0.851771599 9.80E-01520 0.803521836 9.83E-01540 0.249824519 9.86E-01560 0.859248634 9.88E-01580 0.126926481 9.90E-01600 0.713431196 0.253425703 0.830195013 0.723929563 0.027588733 0.091067232 0.689504685 0.890469069 0.710440382 Thank you so much for your help. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : help to replace variable value
Dear All, I have a data frame data with Jan , Feb as column. I using like this data$Jan to take Jan column. I have the Jan in another variable var1 - Jan data$var1 I need to replace the variable value there . Any help will be greatly appreciated. Thanks Rg Mohan L [[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] Match 2 vectors
Hi: On Thu, May 27, 2010 at 10:26 PM, Kang Min ngokang...@gmail.com wrote: Hi, I have 2 dataframes of unequal length, and I would like to match a factor to them so that both dataframes will have the same number of rows. example: # create the 2 dataframes with unequal length data1 - data.frame(letters, 1:26)[-c(5,10,19:21),] data2 - data.frame(letters, 1:26)[-c(6,9,15:18),] If this is your real problem, then an easy thing to do is data1 - data2 - data.frame(letters[1:26]) data1[c(5,10,19:21), ] - NA data2[c(6, 9, 15:18), ] - NA data3 - cbind(data1, data2) names(data3, c('lett1', 'lett2')) data3 However, I suspect this is not your real problem, so let's add a variable to each of the data frames you posted and try again: data1 - data.frame(letters, 1:26)[-c(5,10,19:21),] data2 - data.frame(letters, 1:26)[-c(6,9,15:18),] data1$x - rpois(nrow(data1), 10) data2$y - rpois(nrow(data2), 5) # Now merge data1 and data2: (data3 - merge(data1, data2, all = TRUE)) letters X1.26 x y 1a 1 7 1 2b 2 13 3 3c 3 10 5 4d 4 4 9 5e 5 NA 4 6f 6 10 NA 7g 7 15 4 8h 8 10 6 9i 9 12 NA 10 j10 NA 3 11 k11 8 6 12 l12 12 3 13 m13 10 3 14 n14 7 8 15 o15 6 NA 16 p16 8 NA 17 q17 6 NA 18 r18 4 NA 19 s19 NA 2 20 t20 NA 6 21 u21 NA 4 22 v22 12 6 23 w23 10 3 24 x24 7 8 25 y25 9 6 26 z26 15 7 To get rid of the second column, set data3[, 2] - NULL. HTH, Dennis data2a - match(data1[,1], data2[,1]) data2b - data2[data2a,] When I match data1 to data2, and combine the data2a vector to the original data2, I'm still missing some rows. I need to get the 26 rows, and preferably with the first column displaying all the levels. In data2b the mismatches show up as NA in the whole row. Thanks. Kang Min __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] difference in sort order linux/Windows (R.2.11.0)
Dear R users, I'm a bit perplexed with the effect sort has here, as it is different on Windows vs. linux. It makes my factor levels and subsequent plots different on the two systems. Given: types - c(PC-D-Euro-0, PC-D-Euro-1, PC-D-Euro-2, PC-D-Euro-3, PC-D-Euro-4, PC-D-Euro-5, PC-D-Euro-6, LCV-D-Euro-0, LCV-D-Euro-1, LCV-D-Euro-2, LCV-D-Euro-3, LCV-D-Euro-4, LCV-D-Euro-5, LCV-D-Euro-6, HGV-D-Euro-0, HGV-D-Euro-I, HGV-D-Euro-II, HGV-D-Euro-III, HGV-D-Euro-IV EGR, HGV-D-Euro-IV SCR, HGV-D-Euro-IV SCRb, HGV-D-Euro-V EGR, HGV-D-Euro-V SCR, HGV-D-Euro-V SCRb, HGV-D-Euro-VI, HGV-D-Euro-VIb) On linux, sort does: sort(types) [1] HGV-D-Euro-0 HGV-D-Euro-I HGV-D-Euro-II [4] HGV-D-Euro-III HGV-D-Euro-IV EGR HGV-D-Euro-IV SCR [7] HGV-D-Euro-IV SCRb HGV-D-Euro-V EGR HGV-D-Euro-VI [10] HGV-D-Euro-VIb HGV-D-Euro-V SCR HGV-D-Euro-V SCRb [13] LCV-D-Euro-0 LCV-D-Euro-1 LCV-D-Euro-2 [16] LCV-D-Euro-3 LCV-D-Euro-4 LCV-D-Euro-5 [19] LCV-D-Euro-6 PC-D-Euro-0PC-D-Euro-1 [22] PC-D-Euro-2PC-D-Euro-3PC-D-Euro-4 [25] PC-D-Euro-5PC-D-Euro-6 And on Windows: sort(types) [1] HGV-D-Euro-0 HGV-D-Euro-I HGV-D-Euro-II [4] HGV-D-Euro-III HGV-D-Euro-IV EGR HGV-D-Euro-IV SCR [7] HGV-D-Euro-IV SCRb HGV-D-Euro-V EGR HGV-D-Euro-V SCR [10] HGV-D-Euro-V SCRb HGV-D-Euro-VI HGV-D-Euro-VIb [13] LCV-D-Euro-0 LCV-D-Euro-1 LCV-D-Euro-2 [16] LCV-D-Euro-3 LCV-D-Euro-4 LCV-D-Euro-5 [19] LCV-D-Euro-6 PC-D-Euro-0PC-D-Euro-1 [22] PC-D-Euro-2PC-D-Euro-3PC-D-Euro-4 [25] PC-D-Euro-5PC-D-Euro-6 Session info for both systems is below. The order I actually want is the Windows one, but looking at it, the linux order is perhaps more intuitive. However, the problem is the order is inconsistent between the two systems. Any suggestions? sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 [9] LC_ADDRESS=en_GB.utf8LC_TELEPHONE=en_GB.utf8 [11] LC_MEASUREMENT=en_GB.utf8LC_IDENTIFICATION=en_GB.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rkward_0.5.3 loaded via a namespace (and not attached): [1] tools_2.11.0 sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base Dr David Carslaw King's College London Environmental Research Group Franklin Wilkins Building 150 Stamford Street London SE1 9NH -- View this message in context: http://r.789695.n4.nabble.com/difference-in-sort-order-linux-Windows-R-2-11-0-tp2234251p2234251.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Re : help to replace variable value
Hi! Not sure to understand what you mean... Would data[[var1]] do what you're looking for? HTH, Ivan Le 5/28/2010 11:13, Mohan L a écrit : Dear All, I have a data frame data with Jan , Feb as column. I using like this data$Jan to take Jan column. I have the Jan in another variable var1- Jan data$var1 I need to replace the variable value there . Any help will be greatly appreciated. Thanks Rg Mohan L [[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. -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] MLE for multivariate t-distribution
Hey, I've got a problem with the estimation of a multivariate t-distribution. I've got 200 observations vor 20 variables. Now I want to estimate the parameters of the densityfunction of the multivarate t-distribution with mean=0. I found a function mst.mle in the package sn, but here it is for a skwed t- distribution and the mean is also estimated. I need a function which estimated only the degrees of freedom and the covarianzmatrix/ Omega. Can anybody help me please! Thanks a lot! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 sort order linux/Windows (R.2.11.0)
On 28-May-10 08:17:49, carslaw wrote: Dear R users, I'm a bit perplexed with the effect sort has here, as it is different on Windows vs. linux. It makes my factor levels and subsequent plots different on the two systems. Given: types - c(PC-D-Euro-0, PC-D-Euro-1, PC-D-Euro-2, PC-D-Euro-3, PC-D-Euro-4, PC-D-Euro-5, PC-D-Euro-6, LCV-D-Euro-0, LCV-D-Euro-1, LCV-D-Euro-2, LCV-D-Euro-3, LCV-D-Euro-4, LCV-D-Euro-5, LCV-D-Euro-6, HGV-D-Euro-0, HGV-D-Euro-I, HGV-D-Euro-II, HGV-D-Euro-III, HGV-D-Euro-IV EGR, HGV-D-Euro-IV SCR, HGV-D-Euro-IV SCRb, HGV-D-Euro-V EGR, HGV-D-Euro-V SCR, HGV-D-Euro-V SCRb, HGV-D-Euro-VI, HGV-D-Euro-VIb) On linux, sort does: sort(types) [1] HGV-D-Euro-0 HGV-D-Euro-I HGV-D-Euro-II [4] HGV-D-Euro-III HGV-D-Euro-IV EGR HGV-D-Euro-IV SCR [7] HGV-D-Euro-IV SCRb HGV-D-Euro-V EGR HGV-D-Euro-VI [10] HGV-D-Euro-VIb HGV-D-Euro-V SCR HGV-D-Euro-V SCRb [13] LCV-D-Euro-0 LCV-D-Euro-1 LCV-D-Euro-2 [16] LCV-D-Euro-3 LCV-D-Euro-4 LCV-D-Euro-5 [19] LCV-D-Euro-6 PC-D-Euro-0PC-D-Euro-1 [22] PC-D-Euro-2PC-D-Euro-3PC-D-Euro-4 [25] PC-D-Euro-5PC-D-Euro-6 And on Windows: sort(types) [1] HGV-D-Euro-0 HGV-D-Euro-I HGV-D-Euro-II [4] HGV-D-Euro-III HGV-D-Euro-IV EGR HGV-D-Euro-IV SCR [7] HGV-D-Euro-IV SCRb HGV-D-Euro-V EGR HGV-D-Euro-V SCR [10] HGV-D-Euro-V SCRb HGV-D-Euro-VI HGV-D-Euro-VIb [13] LCV-D-Euro-0 LCV-D-Euro-1 LCV-D-Euro-2 [16] LCV-D-Euro-3 LCV-D-Euro-4 LCV-D-Euro-5 [19] LCV-D-Euro-6 PC-D-Euro-0PC-D-Euro-1 [22] PC-D-Euro-2PC-D-Euro-3PC-D-Euro-4 [25] PC-D-Euro-5PC-D-Euro-6 Session info for both systems is below. The order I actually want is the Windows one, but looking at it, the linux order is perhaps more intuitive. However, the problem is the order is inconsistent between the two systems. Any suggestions? sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 [9] LC_ADDRESS=en_GB.utf8LC_TELEPHONE=en_GB.utf8 [11] LC_MEASUREMENT=en_GB.utf8LC_IDENTIFICATION=en_GB.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rkward_0.5.3 loaded via a namespace (and not attached): [1] tools_2.11.0 sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base Dr David Carslaw I suspect the result (in Linux, I can't test this on Windows) may be related to the following phenomenon: sort(c(AB CD,ABCD)) # [1] ABCD AB CD sort(c(AB CD,ABCD )) # [1] AB CD ABCD I.e. ABCD precedes AB CD apparently because it is shorter, despite the fact that it would come later in an alphabetical sort. If I use the Linux 'sort' command (on the same machine) I get: sort EOT AB CD ABCD EOT AB CD ABCD sort EOT AB CD ABCD EOT AB CD ABCD I.e. the same result for either case. In my view the R result is anomalous! In ?Comparison it is stated that characters are translated to UTF8 before conparison is done; so a possible explanation could be that the UTF8 encoding for SPACE (for all I know) may be greater than that for the letters of the alphabet (as opposed to ASCII, where -- I do know -- it is less). And, if that is the case, why doesn't it apply also in Windows? This strikes me as a nasty little trap! Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-May-10 Time: 10:55:33 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 sort order linux/Windows (R.2.11.0)
In my response cited below: On 28-May-10 09:55:36, Ted Harding wrote: I suspect the result (in Linux, I can't test this on Windows) may be related to the following phenomenon: sort(c(AB CD,ABCD)) # [1] ABCD AB CD sort(c(AB CD,ABCD )) # [1] AB CD ABCD I.e. ABCD precedes AB CD apparently because it is shorter, despite the fact that it would come later in an alphabetical sort. If I use the Linux 'sort' command (on the same machine) I get: sort EOT AB CD ABCD EOT AB CD ABCD sort EOT AB CD ABCD EOT AB CD ABCD I.e. the same result for either case. In my view the R result is anomalous! In ?Comparison it is stated that characters are translated to UTF8 before conparison is done; so a possible explanation could be that the UTF8 encoding for SPACE (for all I know) may be greater than that for the letters of the alphabet (as opposed to ASCII, where -- I do know -- it is less). And, if that is the case, why doesn't it apply also in Windows? This strikes me as a nasty little trap! Ted. Please ignore the stuff about UTF8 -- the reasoning is false! (since then ABCD and ABCD would always precede AB CD). I.e. read it as: I.e. the same result for either case. In my view the R result is anomalous! This strikes me as a nasty little trap! Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-May-10 Time: 11:05:44 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Match 2 vectors
That's what I wanted, thanks!! On May 28, 5:13 pm, Dennis Murphy djmu...@gmail.com wrote: Hi: On Thu, May 27, 2010 at 10:26 PM, Kang Min ngokang...@gmail.com wrote: Hi, I have 2 dataframes of unequal length, and I would like to match a factor to them so that both dataframes will have the same number of rows. example: # create the 2 dataframes with unequal length data1 - data.frame(letters, 1:26)[-c(5,10,19:21),] data2 - data.frame(letters, 1:26)[-c(6,9,15:18),] If this is your real problem, then an easy thing to do is data1 - data2 - data.frame(letters[1:26]) data1[c(5,10,19:21), ] - NA data2[c(6, 9, 15:18), ] - NA data3 - cbind(data1, data2) names(data3, c('lett1', 'lett2')) data3 However, I suspect this is not your real problem, so let's add a variable to each of the data frames you posted and try again: data1 - data.frame(letters, 1:26)[-c(5,10,19:21),] data2 - data.frame(letters, 1:26)[-c(6,9,15:18),] data1$x - rpois(nrow(data1), 10) data2$y - rpois(nrow(data2), 5) # Now merge data1 and data2: (data3 - merge(data1, data2, all = TRUE)) letters X1.26 x y 1 a 1 7 1 2 b 2 13 3 3 c 3 10 5 4 d 4 4 9 5 e 5 NA 4 6 f 6 10 NA 7 g 7 15 4 8 h 8 10 6 9 i 9 12 NA 10 j 10 NA 3 11 k 11 8 6 12 l 12 12 3 13 m 13 10 3 14 n 14 7 8 15 o 15 6 NA 16 p 16 8 NA 17 q 17 6 NA 18 r 18 4 NA 19 s 19 NA 2 20 t 20 NA 6 21 u 21 NA 4 22 v 22 12 6 23 w 23 10 3 24 x 24 7 8 25 y 25 9 6 26 z 26 15 7 To get rid of the second column, set data3[, 2] - NULL. HTH, Dennis data2a - match(data1[,1], data2[,1]) data2b - data2[data2a,] When I match data1 to data2, and combine the data2a vector to the original data2, I'm still missing some rows. I need to get the 26 rows, and preferably with the first column displaying all the levels. In data2b the mismatches show up as NA in the whole row. Thanks. Kang Min __ r-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://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] Apply: Output matrix orientation
David Winsemius wrote: On May 27, 2010, at 7:24 AM, Johannes Graumann wrote: Hi, Why is the result of below apply call rotated with respect to the input and how to remedy this? Because the processing you requested is with respect to rows and the construction of matrices is by default by columns. ?t Thanks. t solved my problem without having to load another package. Joh __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] One application of Tcltk2
Hello, tk2notebook() is a ttk/tile styled widget. Its appearance is governed by styles. Before you change style, you should first look if there is one predefined theme that better suits you: tk2theme.list() # List all available themes [1] clamalt default classic tk2theme(clam) # Change is dynamic! [1] clam tk2theme(alt) # Change is dynamic! [1] alt ... Look how your dialog box(es) look like when you switch the theme. Then, starting from your preferred theme, you can change the appearance of specific theme styles. Here is how you change the color of notebook tabs, for instance: tcl(ttk::style, configure, TNotebook, background=skyplue) # Make non selected tabs a little darker tcl(ttk::style, configure, TNotebook.Tab, background=skyblue3) tcl(ttk::style, map, TNotebook.Tab, background=c(active, skyblue)) tcl(ttk::style, map, TNotebook.Tab, background=c(active, skyblue)) tcl(ttk::style, map, TNotebook.Tab, background=c(selected, skyblue)) See the Tile documentation at http://tktable.sourceforge.net/tile/doc, and also this document: http://tktable.sourceforge.net/tile/tile-tcl2004.pdf. Best, Philippe Grosjean ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .. On 27/05/10 19:14, Abelian wrote: Dear All I utilize the Tcltk2 to develop a Gui for application. In order to make my function more clearly, i use a function ,tk2notebook, to build several notes for different application. I have studied the example of this function. In the R- help, it provided a example below. tt2- tktoplevel() nb- tk2notebook(tt2, tabs = c(Test, Button)) tkpack(nb, fill = both, expand = 1) tb1- tk2notetab(nb, Test) lab- tk2label(tb1, text = Nothing here.) tkpack(lab) tb2- tk2notetab(nb, Button) but- tk2button(tb2, text = Click me, command = function() tkdestroy(tt2)) tkgrid(but) tk2notetab.select(nb, Button) tk2notetab.text(nb) # Text of the currently selected tab However, i want to modify the font and cex.size of tabs. Because the original setting is too small. By the way, how can i change the color of frames in this function? The defult is gray, but i want to be skyblue. I hope someone can give me suggestion or give me some direction to solve this problem. Sincerely __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] difference in sort order linux/Windows (R.2.11.0)
Thanks Ted, Indeed, there is a difference between the systems on your much-simplified example (thanks). So, linux: sort(c(AB CD,ABCD)) [1] ABCD AB CD Windows: sort(c(AB CD,ABCD)) [1] AB CD ABCD Regards, David -- View this message in context: http://r.789695.n4.nabble.com/difference-in-sort-order-linux-Windows-R-2-11-0-tp2234251p2234366.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] difference in sort order linux/Windows (R.2.11.0)
carslaw wrote: Dear R users, I'm a bit perplexed with the effect sort has here, as it is different on Windows vs. linux. It makes my factor levels and subsequent plots different on the two systems. You are using different collation orders. On Linux, your sessionInfo shows en_GB.utf8 while Windows shows English_United Kingdom.1252 so you should be prepared for differences. That said, it certainly looks as though the string comparison is wrong on Linux. Using Ted Harding's examples, I get these results: AB CD ABCD [1] FALSE AB CD ABCD [1] FALSE on Windows in the English_Canada.1252 locale and on Linux in the C locale. However, when I use the locale that's default on our system, en_US.UTF-8, I get AB CD ABCD [1] TRUE AB CD ABCD [1] FALSE as Ted did, and that certainly looks wrong. Duncan Murdoch Given: types - c(PC-D-Euro-0, PC-D-Euro-1, PC-D-Euro-2, PC-D-Euro-3, PC-D-Euro-4, PC-D-Euro-5, PC-D-Euro-6, LCV-D-Euro-0, LCV-D-Euro-1, LCV-D-Euro-2, LCV-D-Euro-3, LCV-D-Euro-4, LCV-D-Euro-5, LCV-D-Euro-6, HGV-D-Euro-0, HGV-D-Euro-I, HGV-D-Euro-II, HGV-D-Euro-III, HGV-D-Euro-IV EGR, HGV-D-Euro-IV SCR, HGV-D-Euro-IV SCRb, HGV-D-Euro-V EGR, HGV-D-Euro-V SCR, HGV-D-Euro-V SCRb, HGV-D-Euro-VI, HGV-D-Euro-VIb) On linux, sort does: sort(types) [1] HGV-D-Euro-0 HGV-D-Euro-I HGV-D-Euro-II [4] HGV-D-Euro-III HGV-D-Euro-IV EGR HGV-D-Euro-IV SCR [7] HGV-D-Euro-IV SCRb HGV-D-Euro-V EGR HGV-D-Euro-VI [10] HGV-D-Euro-VIb HGV-D-Euro-V SCR HGV-D-Euro-V SCRb [13] LCV-D-Euro-0 LCV-D-Euro-1 LCV-D-Euro-2 [16] LCV-D-Euro-3 LCV-D-Euro-4 LCV-D-Euro-5 [19] LCV-D-Euro-6 PC-D-Euro-0PC-D-Euro-1 [22] PC-D-Euro-2PC-D-Euro-3PC-D-Euro-4 [25] PC-D-Euro-5PC-D-Euro-6 And on Windows: sort(types) [1] HGV-D-Euro-0 HGV-D-Euro-I HGV-D-Euro-II [4] HGV-D-Euro-III HGV-D-Euro-IV EGR HGV-D-Euro-IV SCR [7] HGV-D-Euro-IV SCRb HGV-D-Euro-V EGR HGV-D-Euro-V SCR [10] HGV-D-Euro-V SCRb HGV-D-Euro-VI HGV-D-Euro-VIb [13] LCV-D-Euro-0 LCV-D-Euro-1 LCV-D-Euro-2 [16] LCV-D-Euro-3 LCV-D-Euro-4 LCV-D-Euro-5 [19] LCV-D-Euro-6 PC-D-Euro-0PC-D-Euro-1 [22] PC-D-Euro-2PC-D-Euro-3PC-D-Euro-4 [25] PC-D-Euro-5PC-D-Euro-6 Session info for both systems is below. The order I actually want is the Windows one, but looking at it, the linux order is perhaps more intuitive. However, the problem is the order is inconsistent between the two systems. Any suggestions? sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 [9] LC_ADDRESS=en_GB.utf8LC_TELEPHONE=en_GB.utf8 [11] LC_MEASUREMENT=en_GB.utf8LC_IDENTIFICATION=en_GB.utf8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rkward_0.5.3 loaded via a namespace (and not attached): [1] tools_2.11.0 sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base Dr David Carslaw King's College London Environmental Research Group Franklin Wilkins Building 150 Stamford Street London SE1 9NH __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Handing significance digits
Hi folks, recently I was trying evaluation of some complex function having exactly same starting values as well as same algorithm in both R and .Net environment. However at the end point I notice that there are some differences in the reported figures from those two applications (as much as 0.10%). I feel this is basically due to consideration of different significance digits in handling floating point numbers between R and .Net. Therefore I want to fix the number of digits that should be there after . in each and every calculations in R. For example suppose I am multiplying two numbers : 18.456 and 20.345. Ideally it should come as 375.48732. However I want R to consider only 2 significant digits i.e. 18.46 20.35 and reports 375.66 and should consider this trimmed value for subsequent calculations.It would be good if there is any possibility to define such behavior once at the beginning of my R-session. Is there any way to do that? Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference in sort order linux/Windows (R.2.11.0)
Pretty obvious: You use different locales (collate). What happens if you use the same on both machines? Cheers Joris On Fri, May 28, 2010 at 10:17 AM, carslaw david.cars...@kcl.ac.uk wrote: Dear R users, I'm a bit perplexed with the effect sort has here, as it is different on ... the linux order is perhaps more intuitive. However, the problem is the order is inconsistent between the two systems. Any suggestions? sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 [9] LC_ADDRESS=en_GB.utf8LC_TELEPHONE=en_GB.utf8 [11] LC_MEASUREMENT=en_GB.utf8LC_IDENTIFICATION=en_GB.utf8 ... sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 ... Dr David Carslaw King's College London Environmental Research Group Franklin Wilkins Building 150 Stamford Street London SE1 9NH -- View this message in context: http://r.789695.n4.nabble.com/difference-in-sort-order-linux-Windows-R-2-11-0-tp2234251p2234251.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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Significance in GEE
Hi, I'm using 'geepack' and have a question regarding how to determine which variable is significant. Is Wald test the one to determine significance? If so, how is it calculated in regard to the estimate and standard error? Is there another test to show significance? Thank you, Sachi [[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 in R
As Tal said. Next to that, I read that column1 (and column2?) are supposed to be seen as factors, not as numerical variables. Did you take that into account somehow? It's easy to reproduce the error code : n - NULL if(n2)print(This is OK) Error in if (n 2) print(This is OK) : argument is of length zero In the hclust code, you find following line : n - as.integer(attr(d, Size)) where d is the distance object entered in the hclust function. Looking at the error you get, this means that the size attribute of your distance is NULL. Which tells me that distA is not a dist-object. A - matrix(1:4,ncol=2) A [,1] [,2] [1,]13 [2,]24 hclust(A,method=single) Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero Did you actually put in a distance object? see also ?dist or ?as.dist. Cheers Joris On Fri, May 28, 2010 at 1:41 AM, Ayesha Khan ayesha.diamond...@gmail.comwrote: i have a matrix with the following dimensions 136 3 and it looks something like [,1] [,2] [,3] [1,] 402 675 1.802758 [2,] 402 696 1.938902 [3,] 402 699 1.994253 [4,] 402 945 1.898619 [5,] 424 470 1.812857 [6,] 424 905 1.816345 [7,] 470 905 1.871252 [8,] 504 780 1.958191 [9,] 504 848 1.997111... so you get the idea. I want to group similar items in one group/cluster following the friends of friends approach. I tried doing distclust - hclust(distA,method=single) However, I got the following error. Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero which probably means there's something wrong with my input here. Is there another way of doing this kind of clustering without getting into all the looping and ifelse etc. Basically, if 402 is close to 675,696,and699 and thus fall in cluster A then all items close to 675,696,and 699 should also fall into the same cluster A following a friends of friedns strategy. Any help would be highly appreciated. -- Ayesha Khan MS Bioengineering Dept. of Bioengineering Rice University, TX [[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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Handing significance digits
You can use round(value, 2) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Christofer Bogaso Verzonden: vrijdag 28 mei 2010 12:51 Aan: r-h...@stat.math.ethz.ch Onderwerp: [R] Handing significance digits Hi folks, recently I was trying evaluation of some complex function having exactly same starting values as well as same algorithm in both R and .Net environment. However at the end point I notice that there are some differences in the reported figures from those two applications (as much as 0.10%). I feel this is basically due to consideration of different significance digits in handling floating point numbers between R and .Net. Therefore I want to fix the number of digits that should be there after . in each and every calculations in R. For example suppose I am multiplying two numbers : 18.456 and 20.345. Ideally it should come as 375.48732. However I want R to consider only 2 significant digits i.e. 18.46 20.35 and reports 375.66 and should consider this trimmed value for subsequent calculations.It would be good if there is any possibility to define such behavior once at the beginning of my R-session. Is there any way to do that? Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 loading RGtk2 (iconv.dll)
This sounds like a DLL conflict to me. For example, do you have Matlab installed? Sometimes if Matlab is on the PATH, the DLLs can conflict. Michael On Thu, May 27, 2010 at 11:06 PM, Tal Galili tal.gal...@gmail.com wrote: Hello dear R-help list and Michael Lawrence. I wish to use GTK with R. I installed the newest RGtk2 and GTK from: http://sourceforge.net/projects/gladewin32/files/gtk%2B-win32-devel/2.12.9/gtk-dev-2.12.9-win32-2.exe/download on the path: C:\Program Files\Common Files\GTK\2.0\ And followed the instructions on the installation manual for RGtk2, and added the line: GTK_PATH=C:/Program Files/Common Files/GTK/2.0 To the etc/Renviron.site file. Yet when I come to load the package via require(RGtk2), I get the following *error massage*: the procedure entry point libiconv_set_relocation_prefix could not be located in the dynamic linke library iconv.dll And then (in the R console) I get: Loading required package: RGtk2 Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/Program Files/R/library/RGtk2/libs/RGtk2.dll': LoadLibrary failure: The specified procedure could not be found. The interesting thing is that after I install GTK (through the auto-install), then RGtk2 loads without error in R. But if I try to run something, for example: demo(alphaSlider) I will get the error massage: Error in .Call(name, ..., PACKAGE = PACKAGE) : C symbol name S_gtk_window_new not in DLL for package RGtk2 Upon restarting R, again, I wouldn't be able to use require(RGtk2) Here is my sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RGtk2_2.12.18 loaded via a namespace (and not attached): [1] tools_2.11.0 (I am running win XP) I tried searching for this error on the mailing list and on google, but couldn't find a solution. Thanks, Tal 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) -- [[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 sort order linux/Windows (R.2.11.0)
It would seem that there is indeed a locale effect. Revisiting the examples I used on Linux in a previous post, at which time I was using the default LC_COLLATE=en_GB.UTF-8, I changed this to C. Both the C and the en_GB.UTF-8 are indicated (the latter copied from my previous post): Sys.setlocale(LC_COLLATE, C) # [1] C sort(c(AB CD,ABCD)) # [1] AB CD ABCD ## (C) # [1] ABCD AB CD ## (en_GB.UTF-8) sort(c(AB CD,ABCD )) # [1] AB CD ABCD ## (C) # [1] AB CD ABCD ## (en_GB.UTF-8) So the C ordering comes out as one would expect in either case, while the en_GB.UTF-8 ordering does not in the first case (where the two strings are of different lengths). Is there any way to extract the numerical encoding of a character string (according to the collating locale encoding) to which the comparison in the sort() algorithm is applied? Ted. On 28-May-10 11:07:57, Joris Meys wrote: Pretty obvious: You use different locales (collate). What happens if you use the same on both machines? Cheers Joris On Fri, May 28, 2010 at 10:17 AM, carslaw david.cars...@kcl.ac.uk wrote: Dear R users, I'm a bit perplexed with the effect sort has here, as it is different on ... the linux order is perhaps more intuitive. However, the problem is the order is inconsistent between the two systems. Any suggestions? sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=en_GB.utf8 LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=en_GB.utf8 [9] LC_ADDRESS=en_GB.utf8LC_TELEPHONE=en_GB.utf8 [11] LC_MEASUREMENT=en_GB.utf8LC_IDENTIFICATION=en_GB.utf8 ... sessionInfo() R version 2.11.0 (2010-04-22) x86_64-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 ... Dr David Carslaw -- Joris Meys E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-May-10 Time: 12:49:19 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Using a loop to define new variables
Hi, I'm a novice R user, much more used to SAS. My problem is pretty simple - basically, in a data frame, I have variables named x1,,x10 and y1,...,y10; and I would like to create r1 = x1 / y1 etc Apologies if this is way too rudimentary - but I couldn't find any posts online which solve this exact issue. Cheers, Andre ** This email and any attachments are confidential, protect...{{dropped:22}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Handing significance digits
Hi Christofer, I don't know what .Net is doing, but for R these globals are dependent on your machine and platform. ?.Machine ?.Platform Don't know if you can actually hack R into believing otherwise. Did you consider the possibility that the underlying algorithms differ between .Net and R? Cheers Joris On Fri, May 28, 2010 at 12:51 PM, Christofer Bogaso bogaso.christo...@gmail.com wrote: Hi folks, recently I was trying evaluation of some complex function having exactly same starting values as well as same algorithm in both R and .Net environment. However at the end point I notice that there are some differences in the reported figures from those two applications (as much as 0.10%). I feel this is basically due to consideration of different significance digits in handling floating point numbers between R and .Net. Therefore I want to fix the number of digits that should be there after . in each and every calculations in R. For example suppose I am multiplying two numbers : 18.456 and 20.345. Ideally it should come as 375.48732. However I want R to consider only 2 significant digits i.e. 18.46 20.35 and reports 375.66 and should consider this trimmed value for subsequent calculations.It would be good if there is any possibility to define such behavior once at the beginning of my R-session. Is there any way to do that? Thanks, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Using a loop to define new variables
Hi, Would this do: test - data.frame(a=LETTERS[1:10], x=1:10, y=seq(0.1,1,0.1)) #create some data.frame test$z - test$x/test$y #add a column ? HTH, Ivan Le 5/28/2010 13:52, Andre Easom a écrit : Hi, I'm a novice R user, much more used to SAS. My problem is pretty simple - basically, in a data frame, I have variables named x1,,x10 and y1,...,y10; and I would like to create r1 = x1 / y1 etc Apologies if this is way too rudimentary - but I couldn't find any posts online which solve this exact issue. Cheers, Andre ** This email and any attachments are confidential, protect...{{dropped:22}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Using a loop to define new variables
Sorry, I should have written it an other way: test$z - test[[2]]/test[[3]] Which is then really easy to fit into a for loop Ivan Le 5/28/2010 14:05, Ivan Calandra a écrit : Hi, Would this do: test - data.frame(a=LETTERS[1:10], x=1:10, y=seq(0.1,1,0.1)) #create some data.frame test$z - test$x/test$y #add a column ? HTH, Ivan Le 5/28/2010 13:52, Andre Easom a écrit : Hi, I'm a novice R user, much more used to SAS. My problem is pretty simple - basically, in a data frame, I have variables named x1,,x10 and y1,...,y10; and I would like to create r1 = x1 / y1 etc Apologies if this is way too rudimentary - but I couldn't find any posts online which solve this exact issue. Cheers, Andre ** This email and any attachments are confidential, protect...{{dropped:22}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] anova post hoc tests
Hi everybody does anyone know how I can run ANOVA post-hoc tests using R commander or R in general? Thank you Dr. Iasonas Lamprianou __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Using a loop to define new variables
On Fri, May 28, 2010 at 12:52 PM, Andre Easom aea...@sportingindex.com wrote: Hi, I'm a novice R user, much more used to SAS. My problem is pretty simple - basically, in a data frame, I have variables named x1,,x10 and y1,...,y10; and I would like to create r1 = x1 / y1 etc Apologies if this is way too rudimentary - but I couldn't find any posts online which solve this exact issue. Well, you can also access columns by number, so if you know what columns your x's and y's are in you can do: if you know the columns your x's and y's are in you can do it all at once: 3-column example: foo=data.frame(x1=1:10,x2=1:10,x3=1:10,y1=10:1,y2=runif(10),y3=runif(10)) foo[,1:3]/foo[,4:6] x1x2x3 1 0.100 2.037364 4.242166 2 0.222 38.651953 2.475068 3 0.375 9.351609 4.682223 etc you can then add this to your data frame: foo=cbind(foo,foo[,1:3]/foo[,4:6]) foo x1 x2 x3 y1 y2y3 x1x2x3 1 1 1 1 10 0.49083037 0.2357286 0.100 2.037364 4.242166 2 2 2 2 9 0.05174383 0.8080586 0.222 38.651953 2.475068 3 3 3 3 8 0.32080042 0.6407213 0.375 9.351609 4.682223 etc and fix up the names: names(foo)[7:9]=paste(r,1:3,sep=) foo x1 x2 x3 y1 y2y3 r1r2r3 1 1 1 1 10 0.49083037 0.2357286 0.100 2.037364 4.242166 2 2 2 2 9 0.05174383 0.8080586 0.222 38.651953 2.475068 3 3 3 3 8 0.32080042 0.6407213 0.375 9.351609 4.682223 Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 get values out of a string using regular expressions?
Dear all, I have a vector of filenames which begins like this : X - c(OrthoP1_DNA_str.aln, OrthoP10_DNA_str.aln, OrthoP100_DNA_str.aln, OrthoP101_DNA_str.aln, OrthoP102_DNA_str.aln, OrthoP103_DNA_str.aln, OrthoP104_DNA_str.aln, OrthoP105_DNA_str.aln, OrthoP106_DNA_str.aln, OrthoP107_DNA_str.aln) using grep((\\d+),X,perl=T,value=T) I get the complete values back. Yet, I want a vector : c(1,10,100,101,102,103,104,105,106,107) In Perl, using the brackets allows for extracting only the numbers (using a construct with $1 for those who know Perl). I want to do the same in R, but can't find a way of doing that without extensive string manipulations. Problem is that the length of the numbers differ, so I can't use substr. I tried strsplit(X,\\d+) [[1]] [1] OrthoP _DNA_str.aln which gives me exactly what I want to throw away. So : strsplit(X,\\D+) [[1]] [1] 1 [[2]] [1]10 gives something I can use, but it still requires a lot of list manipulation afterwards to get the right vector. Is there an option or a function I'm missing somewhere? Cheers Joris -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] anova post hoc tests
See : http://www.statmethods.net/stats/anova.html ?TukeyHSD Cheers Joris On Fri, May 28, 2010 at 2:11 PM, Iasonas Lamprianou lampria...@yahoo.comwrote: Hi everybody does anyone know how I can run ANOVA post-hoc tests using R commander or R in general? Thank you Dr. Iasonas Lamprianou __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Using a loop to define new variables
Although you asked for a loop this may be clearer if you just have to do it once and only have 10 x and 10 y columns. Here we use the built in anscombe data frame which has columns x1, x2, x3, x4, y1, y2, y3, y4: transform(anscombe, r1 = y1 / x1, r2 = y2 / x2, r3 = y3 / x3, r4 = y4 / x4) In the future please provide sample data with your posts. On Fri, May 28, 2010 at 7:52 AM, Andre Easom aea...@sportingindex.com wrote: Hi, I'm a novice R user, much more used to SAS. My problem is pretty simple - basically, in a data frame, I have variables named x1,,x10 and y1,...,y10; and I would like to create r1 = x1 / y1 etc Apologies if this is way too rudimentary - but I couldn't find any posts online which solve this exact issue. Cheers, Andre ** This email and any attachments are confidential, protect...{{dropped:22}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Problem loading RGtk2 (iconv.dll)
Thanks Michael, I don't have matlab. How might I check this ? 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 Fri, May 28, 2010 at 2:47 PM, Michael Lawrence lawrence.mich...@gene.com wrote: This sounds like a DLL conflict to me. For example, do you have Matlab installed? Sometimes if Matlab is on the PATH, the DLLs can conflict. Michael On Thu, May 27, 2010 at 11:06 PM, Tal Galili tal.gal...@gmail.com wrote: Hello dear R-help list and Michael Lawrence. I wish to use GTK with R. I installed the newest RGtk2 and GTK from: http://sourceforge.net/projects/gladewin32/files/gtk%2B-win32-devel/2.12.9/gtk-dev-2.12.9-win32-2.exe/download on the path: C:\Program Files\Common Files\GTK\2.0\ And followed the instructions on the installation manual for RGtk2, and added the line: GTK_PATH=C:/Program Files/Common Files/GTK/2.0 To the etc/Renviron.site file. Yet when I come to load the package via require(RGtk2), I get the following *error massage*: the procedure entry point libiconv_set_relocation_prefix could not be located in the dynamic linke library iconv.dll And then (in the R console) I get: Loading required package: RGtk2 Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/Program Files/R/library/RGtk2/libs/RGtk2.dll': LoadLibrary failure: The specified procedure could not be found. The interesting thing is that after I install GTK (through the auto-install), then RGtk2 loads without error in R. But if I try to run something, for example: demo(alphaSlider) I will get the error massage: Error in .Call(name, ..., PACKAGE = PACKAGE) : C symbol name S_gtk_window_new not in DLL for package RGtk2 Upon restarting R, again, I wouldn't be able to use require(RGtk2) Here is my sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RGtk2_2.12.18 loaded via a namespace (and not attached): [1] tools_2.11.0 (I am running win XP) I tried searching for this error on the mailing list and on google, but couldn't find a solution. Thanks, Tal 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) -- [[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 get values out of a string using regular expressions?
Try this: as.numeric(gsub(\\D, , X)) On Fri, May 28, 2010 at 8:21 AM, Joris Meys jorism...@gmail.com wrote: Dear all, I have a vector of filenames which begins like this : X - c(OrthoP1_DNA_str.aln, OrthoP10_DNA_str.aln, OrthoP100_DNA_str.aln, OrthoP101_DNA_str.aln, OrthoP102_DNA_str.aln, OrthoP103_DNA_str.aln, OrthoP104_DNA_str.aln, OrthoP105_DNA_str.aln, OrthoP106_DNA_str.aln, OrthoP107_DNA_str.aln) using grep((\\d+),X,perl=T,value=T) I get the complete values back. Yet, I want a vector : c(1,10,100,101,102,103,104,105,106,107) In Perl, using the brackets allows for extracting only the numbers (using a construct with $1 for those who know Perl). I want to do the same in R, but can't find a way of doing that without extensive string manipulations. Problem is that the length of the numbers differ, so I can't use substr. I tried strsplit(X,\\d+) [[1]] [1] OrthoP _DNA_str.aln which gives me exactly what I want to throw away. So : strsplit(X,\\D+) [[1]] [1] 1 [[2]] [1] 10 gives something I can use, but it still requires a lot of list manipulation afterwards to get the right vector. Is there an option or a function I'm missing somewhere? Cheers Joris -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Problems executing cor(dataset) function in R 2.11.0 for OSX ( It works fine in R 2.10.1)
Hi all, I was experiencing a similar problem with some code which uses the package maCorrPlot (BioConductor) http://www.bioconductor.org/packages/2.6/bioc/html/maCorrPlot.html to compute the correlation between different variables. This code was working apparently fine under R 2.9 (but it was raising warning messages!) and the same was not working under R 2.11. A simple example was: 1. library(maCorrPlot) 2. m - as.matrix(read.table(fileIn, header=TRUE, sep='\t')) 3. m - m[,2:ncol(m)] 4. corr.m - CorrSample(m,np=1000) The WARNING (in version 2.9) was: NAs introduced by coercion The ERROR in version 2.11 was: Error in cor(g1, g2, use = pairwise) : 'x' must be numeric My problem was that the matrix (that I was reading and loading into m in line 2) contained a first column with the row names (character strings). Therefore, although it was not being taken into account for computing correlation in line 4, (because this column was removed from m in line 3), it was forcing a casting to string when reading the whole m matrix. I.e, reading this first column as part of the values of the matrix makes as.matrix(read.table(..)) produce a matrix of char strings. Simply changing line 2 with: 2'. m - as.matrix(read.table(fileIn, header=TRUE, sep='\t',row.names=1)) and removing line 3 above, the code works (both in R 2.10 and R 2.11) because there are only numeric values in the matrix and as.matrix(read.table(..)) now converts the values to numeric by default. I couldn't check John M. Quick's site, but I think the problem is that somehow you are loading char string values in your matrix datavar. Carlos On 10/05/2010 7:36 AM, Ruben Garcia Berasategui wrote: Dear all, when trying to replicate John M. Quick's example for correlations between multiple variables posted on: http://rtutorialseries.blogspot.com/2009/11/r-tutorial-series-zero-order.html with R 2.11.0 (GUI 1.33) using my MacBook Pro with OX X 10.5.8 I got the following error message datavar-read.csv(dataset_readingTests.csv) cor(datavar) Error in cor(datavar) : 'x' must be numeric The funny thing is that when I tried to do the same example using R 2.10.1, it worked fine. Any ideas regarding how to solve this problem? I would think the first step would be to ask Mr. Quick what's wrong. Duncan Murdoch [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to create automatically names for vectors in a loop?
Before polluting your workspace with objects, look at how you might use a 'list' to collect them all together, especially if you are going to do processing on them later as a group, or if you want to easily save/load them. You could do the following: myList - list() for (i in 1:10) myList[[paste('funny name', i)]] - runif(10) myList $`funny name 1` [1] 0.26550866 0.37212390 0.57285336 0.90820779 0.20168193 0.89838968 0.94467527 0.66079779 0.62911404 [10] 0.06178627 $`funny name 2` [1] 0.2059746 0.1765568 0.6870228 0.3841037 0.7698414 0.4976992 0.7176185 0.9919061 0.3800352 0.7774452 $`funny name 3` [1] 0.93470523 0.21214252 0.65167377 0.1210 0.26722067 0.38611409 0.01339033 0.38238796 0.86969085 [10] 0.34034900 $`funny name 4` [1] 0.4820801 0.5995658 0.4935413 0.1862176 0.8273733 0.6684667 0.7942399 0.1079436 0.7237109 0.4112744 . On Thu, May 27, 2010 at 10:43 PM, Zoppoli, Gabriele (NIH/NCI) [G] zoppo...@mail.nih.gov wrote: Hi, I want to generate a number of vectors and store them with different names, like this: x=1 while (x100) { vector#x# = rnorm(100) x=x+1 } where each vector has, at its hand, instead of #x# a number which goes from 1 to 99. How can I do this? Thanks Gabriele Zoppoli, MD Ph.D. Fellow, Experimental and Clinical Oncology and Hematology, University of Genova, Genova, Italy Guest Researcher, LMP, NCI, NIH, Bethesda MD Work: 301-451-8575 Mobile: 301-204-5642 Email: zoppo...@mail.nih.gov __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linear Discriminant Analysis in R
Could you provide us with data to test the code? use dput (and limit the size!) eg: dput(vowel_features) dput(mask_features) Without this information, it's impossible to say what's going wrong. It looks like you're doing something wrong in the selection. What should vowel_features[15] return? Did you check it's actually what you want? Did you use str(G) to check the type? Cheers Joris On Thu, May 27, 2010 at 5:28 PM, cobbler_squad la.f...@gmail.com wrote: Joris, You are a life saver. Based on two sample files above, I think lda should go something like this: vowel_features - read.table(file = mappings_for_vowels.txt) mask_features - data.frame(as.matrix(read.table(file = 3dmaskdump_ICA_37_Combined.txt))) G - vowel_features[15] cvc_lda - lda(G~ vowel_features[15], data=mask_features, na.action=na.omit, CV=TRUE) ERROR: Error in model.frame.default(formula = G ~ vowel_features[15], data = mask_features, : invalid type (list) for variable 'G' I am clearly doing something wrong declaring G (how should I declare grouping in R when I need to use one column from vowel_feature file)? Sorry for stupid questions and thank you for being so helpful! - again, sample files that I am working with: mappings_for_vowels.txt: V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 V23 V24 V25 V26 1E 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 2o 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 0 0 3I 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 4^ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 5@ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 and the mask_features file is: V42 V43 V44 V45 V46 V47 V48 V49 [1,] 2.890891625 2.881188521 2.88778 -2.882606612 -2.77341 2.879834384 2.886483229 2.883815864 [2,] 2.763404707 2.756198683 2.761863881 -2.756827983 -2.762268531 2.754305072 2.760017050 2.758399799 [3,] 0.556614506 0.556377530 0.556247414 -0.556300910 -0.556098321 0.557495060 0.557383073 0.556867424 [4,] 0.367065248 0.366962036 0.366870087 -0.366794442 -0.366644148 0.366613343 0.366537320 0.366953464 [5,] 0.423692393 0.421835623 0.421741829 -0.421897460 -0.421659824 0.421567705 0.421465738 0.422407838 -- View this message in context: http://r.789695.n4.nabble.com/Linear-Discriminant-Analysis-in-R-tp2231922p223.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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Linear Discriminant Analysis in R
cobler_squad needs more basic help than doing lda. The data input just doesn't make sense. If vowel_feature is a data frame, than G - vowel_feature[15] creates another data frame containing the 15th variable in vowel_feature, so G is the name of a data frame, not a variable in a data frame. The lda() call makes even less sense. I wonder if he had tried to go through the examples in the help file and try to understand how it is used? Andy -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Joris Meys Sent: Friday, May 28, 2010 8:50 AM To: cobbler_squad Cc: r-help@r-project.org Subject: Re: [R] Linear Discriminant Analysis in R Could you provide us with data to test the code? use dput (and limit the size!) eg: dput(vowel_features) dput(mask_features) Without this information, it's impossible to say what's going wrong. It looks like you're doing something wrong in the selection. What should vowel_features[15] return? Did you check it's actually what you want? Did you use str(G) to check the type? Cheers Joris On Thu, May 27, 2010 at 5:28 PM, cobbler_squad la.f...@gmail.com wrote: Joris, You are a life saver. Based on two sample files above, I think lda should go something like this: vowel_features - read.table(file = mappings_for_vowels.txt) mask_features - data.frame(as.matrix(read.table(file = 3dmaskdump_ICA_37_Combined.txt))) G - vowel_features[15] cvc_lda - lda(G~ vowel_features[15], data=mask_features, na.action=na.omit, CV=TRUE) ERROR: Error in model.frame.default(formula = G ~ vowel_features[15], data = mask_features, : invalid type (list) for variable 'G' I am clearly doing something wrong declaring G (how should I declare grouping in R when I need to use one column from vowel_feature file)? Sorry for stupid questions and thank you for being so helpful! - again, sample files that I am working with: mappings_for_vowels.txt: V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 V23 V24 V25 V26 1E 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 2o 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 0 0 3I 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 4^ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 5@ 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 and the mask_features file is: V42 V43 V44 V45 V46 V47 V48 V49 [1,] 2.890891625 2.881188521 2.88778 -2.882606612 -2.77341 2.879834384 2.886483229 2.883815864 [2,] 2.763404707 2.756198683 2.761863881 -2.756827983 -2.762268531 2.754305072 2.760017050 2.758399799 [3,] 0.556614506 0.556377530 0.556247414 -0.556300910 -0.556098321 0.557495060 0.557383073 0.556867424 [4,] 0.367065248 0.366962036 0.366870087 -0.366794442 -0.366644148 0.366613343 0.366537320 0.366953464 [5,] 0.423692393 0.421835623 0.421741829 -0.421897460 -0.421659824 0.421567705 0.421465738 0.422407838 -- View this message in context: http://r.789695.n4.nabble.com/Linear-Discriminant-Analysis-in-R-tp2231 922p223.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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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. Notice: This e-mail message, together with any attachme...{{dropped:11}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 sort order linux/Windows (R.2.11.0)
An experiment: sort(c(AACD,A CD)) # [1] AACD A CD sort(c(ABCD,A CD)) # [1] ABCD A CD sort(c(ACCD,A CD)) # [1] ACCD A CD sort(c(ADCD,A CD)) # [1] A CD ADCD sort(c(AECD,A CD)) # [1] A CD AECD ## (with results for AFCD, ... AZCD similar to the last two). LC_COLLATE=en_GB.UTF-8 (R version 2.11.0 (2010-04-22) on Linux). So this behaves, in en_GB.UTF-8, as though (SPACE) is between C and D. This is nuts!!! Curable if I set (e.g.) LC_LOCALE=C on startup. But what else might break if I do so? Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-May-10 Time: 14:24:08 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Gelman 2006 half-Cauchy distribution
Hi, I am trying to recreate the right graph on page 524 of Gelman's 2006 paper Prior distributions for variance parameters in hierarchical models in Bayesian Analysis, 3, 515-533. I am only interested, however, in recreating the portion of the graph for the overlain prior density for the half-Cauchy with scale 25 and not the posterior distribution. However, when I try: curve(dcauchy, from=0, to=200, location=0, scale=25) the probabilities for the half-Cauchy values seem to approach zero almost immediately after 0 whereas in Gelman 2006 the tail appears much fatter giving non-zero probabilities out to 100. I am interested in replicating this because I want to use half-Cauchy priors and want to play around with the scale values but I want to know what my prior looks like before using it in models. Please cc me as I am digest subscriber. Thanks! Chris __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 a function
Hi all, I have a function rho.f which gives a list of estimators. I have the following problems. rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give me a different answer, even though corr[4]==0.3. This prevents me from using a for loop. Can someone give me some help? Thank you very much in advance. Hannah rho.f(0.3) $est.1 [1] 0 0 0 0 0 0 $est.2 [1] 0 0 0 0 0 0 $est.3 [1] 0 0 0 0 0 0 $est.4 [1] 0 0 0 0 0 0 $est.5 [1] 0 0 0 0 0 0 corr - seq(0,0.9, by=0.1) corr[4] [1] 0.3 rho.f(corr[4]) $est.1 [1] 0.0 0.0 2.5 0.0 5.0 0.0 $est.2 [1] 0.0 0.0 0.0 0.0 3.72678 0.0 $est.3 [1] 0.00 0.00 0.00 0.00 2.78 0.00 $est.4 [1] 0.0 0.0 0.0 0.0 13.9 0.0 $est.5 [1] 0.0 0.0 0.0 0.0 13.9 0.0 [[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] anova post hoc tests
Download and install install.packages(RcmdrPlugin.HH) library(RcmdrPlugin.HH) Then there are two options. The Rcmdr menu item Statistics Means One-way ANOVA... has a checkbox for pairwise comparison of means It uses glht in the multcomp package. The second option, which I prefer, is to use the MMC (Mean-mean Multiple Comparisons) plot. I describe the one-way ANOVA use here. See the help file for higher-order designs and user-specified contrasts. After running the One-way ANOVA above, click the Rcmdr menu item Models Graphs MMC plot... (HH) Select the model and click OK. If the means of the groups are close together, you might need to check the box for the tiebreaker plot. You will need to record graph history if you need the teibreaker plot as it appears on a second page. Rich On Fri, May 28, 2010 at 8:11 AM, Iasonas Lamprianou lampria...@yahoo.comwrote: Hi everybody does anyone know how I can run ANOVA post-hoc tests using R commander or R in general? Thank you Dr. Iasonas Lamprianou __ R-help@r-project.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] Gelman 2006 half-Cauchy distribution
Am 28.05.2010 15:29, schrieb Christopher David Desjardins: Hi, I am trying to recreate the right graph on page 524 of Gelman's 2006 paper Prior distributions for variance parameters in hierarchical models in Bayesian Analysis, 3, 515-533. I am only interested, however, in recreating the portion of the graph for the overlain prior density for the half-Cauchy with scale 25 and not the posterior distribution. However, when I try: curve(dcauchy, from=0, to=200, location=0, scale=25) This won't pass location and scale to dcauchy. You need something along the lines dcauchy0_25 - function(x) dcauchy(x, location=0, scale=25) curve(dcauchy0_25, from=0, to=200) Uwe Ligges the probabilities for the half-Cauchy values seem to approach zero almost immediately after 0 whereas in Gelman 2006 the tail appears much fatter giving non-zero probabilities out to 100. I am interested in replicating this because I want to use half-Cauchy priors and want to play around with the scale values but I want to know what my prior looks like before using it in models. Please cc me as I am digest subscriber. Thanks! Chris __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] problem with a function
Hi Hannah, No, we can't help because we have no idea what rho.f does - you didn't provide the requested reproducible example. Without more information, the only thing I can think of is that your function might be ridiculously sensive to numeric precision (though that seems unlikely): corr - seq(0,0.9, by=0.1) identical(0.3, corr[4]) [1] FALSE all.equal(0.3, corr[4]) [1] TRUE apply() is likely to be more elegant in this case than a for loop. Sarah On Fri, May 28, 2010 at 9:52 AM, li li hannah@gmail.com wrote: Hi all, I have a function rho.f which gives a list of estimators. I have the following problems. rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give me a different answer, even though corr[4]==0.3. This prevents me from using a for loop. Can someone give me some help? Thank you very much in advance. Hannah rho.f(0.3) $est.1 [1] 0 0 0 0 0 0 $est.2 [1] 0 0 0 0 0 0 $est.3 [1] 0 0 0 0 0 0 $est.4 [1] 0 0 0 0 0 0 $est.5 [1] 0 0 0 0 0 0 corr - seq(0,0.9, by=0.1) corr[4] [1] 0.3 rho.f(corr[4]) $est.1 [1] 0.0 0.0 2.5 0.0 5.0 0.0 $est.2 [1] 0.0 0.0 0.0 0.0 3.72678 0.0 $est.3 [1] 0.00 0.00 0.00 0.00 2.78 0.00 $est.4 [1] 0.0 0.0 0.0 0.0 13.9 0.0 $est.5 [1] 0.0 0.0 0.0 0.0 13.9 0.0 -- 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] problem with a function
Hi: The problem is that input arguments such as corr[4] have to be evaluated within the body of your function, and apparently you haven't written it to do so. Unfortunately, I can't help further because my clairvoyance package is still in the concept development stage. In the meantime, it would be advisable if you could post a *minimal* version of the function that works with 0.3 but fails at corr[4] (as per instructions in the posting guide, which is linked at the bottom of this message. The simpler you make it for others to help, the more likely it will be that you'll get a satisfactory answer. HTH, Dennis On Fri, May 28, 2010 at 6:52 AM, li li hannah@gmail.com wrote: Hi all, I have a function rho.f which gives a list of estimators. I have the following problems. rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give me a different answer, even though corr[4]==0.3. This prevents me from using a for loop. Can someone give me some help? Thank you very much in advance. Hannah rho.f(0.3) $est.1 [1] 0 0 0 0 0 0 $est.2 [1] 0 0 0 0 0 0 $est.3 [1] 0 0 0 0 0 0 $est.4 [1] 0 0 0 0 0 0 $est.5 [1] 0 0 0 0 0 0 corr - seq(0,0.9, by=0.1) corr[4] [1] 0.3 rho.f(corr[4]) $est.1 [1] 0.0 0.0 2.5 0.0 5.0 0.0 $est.2 [1] 0.0 0.0 0.0 0.0 3.72678 0.0 $est.3 [1] 0.00 0.00 0.00 0.00 2.78 0.00 $est.4 [1] 0.0 0.0 0.0 0.0 13.9 0.0 $est.5 [1] 0.0 0.0 0.0 0.0 13.9 0.0 [[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] Gelman 2006 half-Cauchy distribution
Thanks that works. I am presuming that the density on the Y-axis would be wrong in the case of a half-Cauchy distribution and in fact should be doubled if it's folded at 0? Chris On 05/28/2010 09:02 AM, Uwe Ligges wrote: Am 28.05.2010 15:29, schrieb Christopher David Desjardins: Hi, I am trying to recreate the right graph on page 524 of Gelman's 2006 paper Prior distributions for variance parameters in hierarchical models in Bayesian Analysis, 3, 515-533. I am only interested, however, in recreating the portion of the graph for the overlain prior density for the half-Cauchy with scale 25 and not the posterior distribution. However, when I try: curve(dcauchy, from=0, to=200, location=0, scale=25) This won't pass location and scale to dcauchy. You need something along the lines dcauchy0_25 - function(x) dcauchy(x, location=0, scale=25) curve(dcauchy0_25, from=0, to=200) Uwe Ligges the probabilities for the half-Cauchy values seem to approach zero almost immediately after 0 whereas in Gelman 2006 the tail appears much fatter giving non-zero probabilities out to 100. I am interested in replicating this because I want to use half-Cauchy priors and want to play around with the scale values but I want to know what my prior looks like before using it in models. Please cc me as I am digest subscriber. Thanks! Chris __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Gelman 2006 half-Cauchy distribution
Perfect. Thanks. Also using R 2.11.0 on Fedora I didn't get any warnings with my command. Chris On 05/28/2010 09:09 AM, Berwin A Turlach wrote: curve(2*dcauchy(x, location=0, scale=25), from=0, to=200) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Gelman 2006 half-Cauchy distribution
G'day Chris, On Fri, 28 May 2010 08:29:30 -0500 Christopher David Desjardins cddesjard...@gmail.com wrote: Hi, I am trying to recreate the right graph on page 524 of Gelman's 2006 paper Prior distributions for variance parameters in hierarchical models in Bayesian Analysis, 3, 515-533. I am only interested, however, in recreating the portion of the graph for the overlain prior density for the half-Cauchy with scale 25 and not the posterior distribution. However, when I try: curve(dcauchy, from=0, to=200, location=0, scale=25) Which version of R do you use? This command creates 12 warnings under R 2.11.0 on my linux machine. Reading up on the help page of curve() would make you realise that you cannot pass the location and scale parameter to dcauchy in the manner you try. I guess you want: R prior - function(x) 2*dcauchy(x,location=0, scale=25) R curve(prior, from=0, to=200) or, more compactly, R curve(2*dcauchy(x, location=0, scale=25), from=0, to=200) Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Maths and Stats (M019)+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: ber...@maths.uwa.edu.au Australiahttp://www.maths.uwa.edu.au/~berwin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 a function
Thanks very much for your reply. The function is a bit long. I attached it. rho.f () is in second text document. It uses rada1.mnorm() function which is contained in the first document. Thank you very very much!!! 2010/5/28 Dennis Murphy djmu...@gmail.com Hi: The problem is that input arguments such as corr[4] have to be evaluated within the body of your function, and apparently you haven't written it to do so. Unfortunately, I can't help further because my clairvoyance package is still in the concept development stage. In the meantime, it would be advisable if you could post a *minimal* version of the function that works with 0.3 but fails at corr[4] (as per instructions in the posting guide, which is linked at the bottom of this message. The simpler you make it for others to help, the more likely it will be that you'll get a satisfactory answer. HTH, Dennis On Fri, May 28, 2010 at 6:52 AM, li li hannah@gmail.com wrote: Hi all, I have a function rho.f which gives a list of estimators. I have the following problems. rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give me a different answer, even though corr[4]==0.3. This prevents me from using a for loop. Can someone give me some help? Thank you very much in advance. Hannah rho.f(0.3) $est.1 [1] 0 0 0 0 0 0 $est.2 [1] 0 0 0 0 0 0 $est.3 [1] 0 0 0 0 0 0 $est.4 [1] 0 0 0 0 0 0 $est.5 [1] 0 0 0 0 0 0 corr - seq(0,0.9, by=0.1) corr[4] [1] 0.3 rho.f(corr[4]) $est.1 [1] 0.0 0.0 2.5 0.0 5.0 0.0 $est.2 [1] 0.0 0.0 0.0 0.0 3.72678 0.0 $est.3 [1] 0.00 0.00 0.00 0.00 2.78 0.00 $est.4 [1] 0.0 0.0 0.0 0.0 13.9 0.0 $est.5 [1] 0.0 0.0 0.0 0.0 13.9 0.0 [[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. rdata1.mnorm-function(m,n,mzero,mu0, mu1,rho ) { ## ARGUEMENTS # n: sample size # m: dimension of multivariate normal library(MASS) mean - c(rep(mu0, mzero), rep(mu1,m-mzero)) J - rep(1, m) var.f - function(rho) { (1-rho)*diag(m)+rho*J%*%t(J) } set.seed(103) x - mvrnorm(n,mean, var.f(rho)) theta - matrix(0, nrow=n, ncol=m) for (i in 1:m){theta[,i]- mean[i]1} data-list(s=theta, o=x) return(data) } rho.f - function(rho){ ###generate data result - rdata1.mnorm(m=10,n=6,mzero=5,mu0=0,mu1=2,rho=rho) o - result$o s - result$s ### the p-values pv-1-pnorm(o, 0, 1) m - dim(pv)[2] n - dim(pv)[1] lambda - 0.96 w1 - apply(pvlambda, 1, sum) est.1 - w1/((1-lambda)*m) w2 - numeric(n) for (i in 1:n){w2[i]- choose(w1[i],2)} est2 - 2*w2/((1-lambda)^2*m*(m-1)) est.2 - sqrt(est2) est.3 - numeric(n) for (i in 1:n){ if (est.1[i]0) {est.3[i]- est2[i]/est.1[i]} else {est.3[i] - 0} } est.4 - numeric(n) w4.f - function(x, lambda){ k - length(x)-1 w - numeric(k) for (i in 1:k){ w[i] - (x[i]lambda)*(x[i+1]lambda)} w4 - sum(w) y - list(vec=w, sum=w4) return(y) } w4 - numeric(n) for (i in 1:n){ w4[i] - as.numeric(w4.f(pv[i,], lambda)$sum)} est4 - w4/((1-lambda)^2*(m-1)) est.4 - numeric(n) for (i in 1:n){if (est.1[i]0) {est.4[i]- est4[i]/est.1[i]} else est.4[i] - 0} st.pv - t(apply(pv,1,sort)) w5 - numeric(n) for (i in 1:n){ w5[i] - as.numeric(w4.f(st.pv[i,], lambda)$sum)} est5 - w5/((1-lambda)^2*(m-1)) est.5 - numeric(n) for (i in 1:n){if (est.1[i]0) {est.5[i]- est5[i]/est.1[i]} else est.5[i] - 0} y - list(est.1=est.1, est.2=est.2, est.3=est.3, est.4=est.4, est.5=est.5) return(y) } rho - seq(0,0.9, by=0.1) k- length(rho) est.1 - matrix(0, nrow=k, ncol=n) est.2 - matrix(0, nrow=k, ncol=n) est.3 - matrix(0, nrow=k, ncol=n) est.4 - matrix(0, nrow=k, ncol=n) est.5 - matrix(0, nrow=k, ncol=n) for (i in 1:k){ result - rho.f(rho[i]) est.1[i,] - result$est.1 est.2[i,] - result$est.2 est.3[i,] - result$est.3 est.4[i,] - result$est.4 est.5[i,] - result$est.5 } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] anova post hoc tests
Thanks, this is a good solution Dr. Iasonas Lamprianou Assistant Professor (Educational Research and Evaluation) Department of Education Sciences European University-Cyprus P.O. Box 22006 1516 Nicosia Cyprus Tel.: +357-22-713178 Fax: +357-22-590539 Honorary Research Fellow Department of Education The University of Manchester Oxford Road, Manchester M13 9PL, UK Tel. 0044 161 275 3485 iasonas.lampria...@manchester.ac.uk --- On Fri, 28/5/10, RICHARD M. HEIBERGER r...@temple.edu wrote: From: RICHARD M. HEIBERGER r...@temple.edu Subject: Re: [R] anova post hoc tests To: Iasonas Lamprianou lampria...@yahoo.com Cc: r-help@r-project.org Date: Friday, 28 May, 2010, 15:00 Download and install install.packages(RcmdrPlugin.HH) library(RcmdrPlugin.HH) Then there are two options. The Rcmdr menu item Statistics Means One-way ANOVA... has a checkbox for pairwise comparison of means It uses glht in the multcomp package. The second option, which I prefer, is to use the MMC (Mean-mean Multiple Comparisons) plot. I describe the one-way ANOVA use here. See the help file for higher-order designs and user-specified contrasts. After running the One-way ANOVA above, click the Rcmdr menu item Models Graphs MMC plot... (HH) Select the model and click OK. If the means of the groups are close together, you might need to check the box for the tiebreaker plot. You will need to record graph history if you need the teibreaker plot as it appears on a second page. Rich On Fri, May 28, 2010 at 8:11 AM, Iasonas Lamprianou lampria...@yahoo.com wrote: Hi everybody does anyone know how I can run ANOVA post-hoc tests using R commander or R in general? Thank you Dr. Iasonas Lamprianou __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] difference in sort order linux/Windows (R.2.11.0)
On 28/05/2010 9:24 AM, (Ted Harding) wrote: An experiment: sort(c(AACD,A CD)) # [1] AACD A CD sort(c(ABCD,A CD)) # [1] ABCD A CD sort(c(ACCD,A CD)) # [1] ACCD A CD sort(c(ADCD,A CD)) # [1] A CD ADCD sort(c(AECD,A CD)) # [1] A CD AECD ## (with results for AFCD, ... AZCD similar to the last two). LC_COLLATE=en_GB.UTF-8 (R version 2.11.0 (2010-04-22) on Linux). So this behaves, in en_GB.UTF-8, as though (SPACE) is between C and D. This is nuts!!! Curable if I set (e.g.) LC_LOCALE=C on startup. But what else might break if I do so? You have to realize that to a large extent this is not under our control. Your system will have linked to some library (outside of R) to do string collation, and the problem lies in that library. You should determine which system library is handling your collations. I'd like to tell you how to do that, but I don't know for your build. You can find out if you're using the recommended ICU library by running example(icuSetCollate); that gives a number of warnings like In icuSetCollate(locale = da_DK, case_first = default) : ICU is not supported on this build in Windows. If you don't see those, then you want to talk to the ICU people. If you do, then you'll need to look deeper to find out what you're actually using. Duncan Murdoch Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-May-10 Time: 14:24:08 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] problem with a function
There are a bunch of problems in your code: you overwrite mean() with data, and that could screw things up. you have a function var.f that isn't passed all the arguments it needs. est.4 is defined several times, each overwriting the previous. First you need to clean up these sorts of problems since they can lead to all kinds of bizarre results. Then, if you are still getting unexpected results, please send the list a minimal example so that we can take a look. Sarah On Fri, May 28, 2010 at 10:17 AM, li li hannah@gmail.com wrote: Thanks very much for your reply. The function is a bit long. I attached it. rho.f () is in second text document. It uses rada1.mnorm() function which is contained in the first document. Thank you very very much!!! -- 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] Gelman 2006 half-Cauchy distribution
On 28/05/2010 9:29 AM, Christopher David Desjardins wrote: Hi, I am trying to recreate the right graph on page 524 of Gelman's 2006 paper Prior distributions for variance parameters in hierarchical models in Bayesian Analysis, 3, 515-533. I am only interested, however, in recreating the portion of the graph for the overlain prior density for the half-Cauchy with scale 25 and not the posterior distribution. However, when I try: curve(dcauchy, from=0, to=200, location=0, scale=25) the probabilities for the half-Cauchy values seem to approach zero almost immediately after 0 whereas in Gelman 2006 the tail appears much fatter giving non-zero probabilities out to 100. Don't ignore the warnings!!! The scale argument is not being passed to dcauchy. (Nothing in the help page suggests it would be, but some other similar functions would have passed it, so I can see how you made the wrong assumption. But why did you ignore all those warnings?) You'll get what you want with curve( dcauchy(x, location=0, scale=25), from=0, to=200) or with den - function(x) dcauchy(x, location=0, scale=25) curve(den, from=0, to=200) if you don't like using the magic name x in the first one. Duncan Murdoch I am interested in replicating this because I want to use half-Cauchy priors and want to play around with the scale values but I want to know what my prior looks like before using it in models. Please cc me as I am digest subscriber. Thanks! Chris __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Wait for keystroke or timeout
Matt's suggestion works in Linux (I use Ubuntu and Debian variants), but I haven't yet been able to get it to work in Windows. In a DOS terminal, I can run Cygwin's blas.exe via blas -c read -t 1 -n 1 and get the right functioning, but when embedded in R in various ways, I get several error messages that imply R is not finding or interpreting the command correctly. As the details are arcane, please contact me off-line, and I'll report back to the list when we have a solution. However, if someone could try Matt's suggestion on a Mac and let me know outcome, that would be helpful. Since .Platform allows me to determine OS type, I should be able to work out a more or less platform-independent function. JN biostatmatt wrote: On Thu, 2010-05-27 at 19:08 -0400, Prof. John C Nash wrote: I would like to have a function that would wait either until a specified timeout (in seconds preferably) or until a key is pressed. If you are using Linux you can use try this system(read -t 1 -n 1) where -n indicates the number of characters to read and -t specifies the timeout in seconds. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Gelman 2006 half-Cauchy distribution
On 28/05/2010 10:14 AM, Christopher David Desjardins wrote: Perfect. Thanks. Also using R 2.11.0 on Fedora I didn't get any warnings with my command. That's a serious problem. Can you give more details (i.e. just plain R, R under ESS, etc.)? Duncan Murdoch Chris On 05/28/2010 09:09 AM, Berwin A Turlach wrote: curve(2*dcauchy(x, location=0, scale=25), from=0, to=200) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] why biomaRt cannot extract 3UTR sequences for 1941 ENSGxxxxx ?
I executed the following lines several times from a script as well as pasting them in an R shell. Systematically biomaRt is failing. The problem is to extract the 3UTR sequences corresponding to a vector containing 1941 Ensembl Transcript numbers (some are duplicated ... is this s problem ?) Please, find the failing instructions in the following including the ENST vector Any suggestion is welcome. Thank you, Maura hmart - useMart('ensembl', dataset='hsapiens_gene_ensembl') Checking attributes ... ok Checking filters ... ok genes_map[,ensembl_transcript_id] [1] ENST0262187 ENST0296271 ENST0346166 ENST0381570 [5] ENST0381588 ENST0399762 ENST0270357 ENST0283646 [9] ENST0314915 ENST0356660 ENST0395978 ENST0395980 [13] ENST0395981 ENST0395983 ENST0395986 ENST0418212 [17] ENST0420794 ENST0438929 ENST0439476 ENST0273064 [21] ENST0296084 ENST0355481 ENST0359596 ENST0355794 [25] ENST0389232 ENST0373537 ENST0397131 ENST0397134 [29] ENST0397135 ENST0397137 ENST0432507 ENST0451676 [33] ENST0261714 ENST0302190 ENST0372733 ENST0260130 [37] ENST0413219 ENST0424270 ENST0447182 ENST0343575 [41] ENST0374426 ENST0374429 ENST0307712 ENST0398844 [45] ENST0396425 ENST0396426 ENST0239944 ENST0479209 [49] ENST0484761 ENST0258962 ENST0423765 ENST0374580 [53] ENST0229390 ENST0344528 ENST0392011 ENST0409212 [57] ENST0389589 ENST0425436 ENST0483851 ENST0262461 [61] ENST0316341 ENST0369626 ENST0276033 ENST0392339 [65] ENST0392340 ENST0392341 ENST0355773 ENST0234256 [69] ENST0448784 ENST0380379 ENST0245407 ENST0215882 [73] ENST0265631 ENST0416240 ENST0367001 ENST0489447 [77] ENST0295736 ENST0380752 ENST0280612 ENST0236877 [81] ENST0191922 ENST0424542 ENST0432365 ENST0020945 [85] ENST0396822 ENST0262188 ENST0356800 ENST0392811 [89] ENST0348513 ENST0324856 ENST0457599 ENST0249647 [93] ENST0349777 ENST0397138 ENST0215730 ENST0329565 [97] ENST0337404 ENST0367054 ENST0367055 ENST0327443 [101] ENST0426431 ENST0222584 ENST0262554 ENST0337841 [105] ENST0216484 ENST0360718 ENST0389805 ENST0265354 [109] ENST0332118 ENST0256015 ENST0320370 ENST0431877 [113] ENST0322310 ENST0339775 ENST0348354 ENST0218089 [117] ENST0371144 ENST0371145 ENST0371157 ENST0371160 [121] ENST0264657 ENST0389272 ENST0404395 ENST0300134 [125] ENST0300737 ENST0316199 ENST0372806 ENST0263918 [129] ENST0242770 ENST0367568 ENST0367941 ENST0448348 [133] ENST0225777 ENST0011473 ENST0455385 ENST0371225 [137] ENST0320307 ENST0368096 ENST0368097 ENST0040877 [141] ENST0267811 ENST0333725 ENST0343827 ENST0438423 [145] ENST0246912 ENST0346833 ENST0435881 ENST0309134 [149] ENST0361905 ENST0361985 ENST0204517 ENST0310282 [153] ENST0397991 ENST0467072 ENST0486111 ENST0442011 [157] ENST0260356 ENST0265460 ENST0278836 ENST0266085 [161] ENST0265384 ENST0348208 ENST0377245 ENST0314888 [165] ENST0346501 ENST0397396 ENST0397397 ENST0397404 [169] ENST0397406 ENST0397408 ENST0397411 ENST0399778 [173] ENST0409531 ENST0421676 ENST0322019 ENST0379384 [177] ENST0377044 ENST0377066 ENST0412275 ENST0226225 [181] ENST0333007 ENST0221132 ENST0276431 ENST0347739 [185] ENST0245817 ENST0374080 ENST0445275 ENST0269305 [189] ENST0359597 ENST0396473 ENST0419024 ENST0420246 [193] ENST0445888 ENST0455263 ENST0267996 ENST0288398 [197] ENST0317516 ENST0334895 ENST0358278 ENST0403994 [201] ENST0360958 ENST0378292 ENST0312970 ENST0323144 [205] ENST0330188 ENST0368527 ENST0368533 ENST0300933 [209] ENST0344824 ENST0267622 ENST0166345 ENST0223208 [213] ENST0231238 ENST0234831 ENST0256997 ENST0444355 [217] ENST0323274 ENST0367926 ENST0252108 ENST0262999 [221] ENST0310836 ENST0394511 ENST0260187 ENST0313870 [225] ENST0054666 ENST0263559 ENST0373382 ENST0395098 [229] ENST0382882 ENST0225512 ENST0264634 ENST0474267 [233] ENST0216037 ENST0344347 ENST0297857 ENST0395571 [237] ENST0300823 ENST0337433 ENST0413984 ENST0454662 [241] ENST0358704 ENST0366538 ENST0263095 ENST0373953 [245] ENST0318522 ENST0402711 ENST0321027 ENST0345514 [249] ENST0357195
Re: [R] why biomaRt cannot extract 3UTR sequences for 1941 ENSGxxxxx ?
Hi, Two things: 1. You mistakenly posted this to the R-help list, when you should have (and probably meant to) send to the bioconductor list. You might want to repost there if you can't figure out the problem. 2. I just tried your query with 4 transcript IDs (one of them was a duplicate) and it worked fine. Maybe the error you are receiving is actually informative of what your problem is: Error in value[[3L]](cond) : Request to BioMart web service failed. Verify if you are still connected to the internet. Alternatively the BioMart web service is temporarily down. and for some reason you're just having a problem talking to the biomart service itself ... Why not try your query with a small number of ensemble transcript id's to see if that'll work? -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 2.11.0 on ubuntu (hardy) inadvertently installed
Hi- Looks like this morning, I did the ultimate in foobar to a main prod box. I was using apt-get upgrade on the box and totally missed the fact that my entire R installation went from 2.10.0 to 2.11.0. I now have a bunch of pkgs that aren't loading due to the fact that they were built before 2.10.0 -- There's some *ancient* packages, like (sma) that I was able to figure out what we were using, and pull out the relevant functions and just temporarily do a source('xxx.r') until I can re-build those things into new 2.11 packages. Am I totally SOL today or is there a way to reverse what the heck I did this morning to the entire R installation? thx,c __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 a function
I am not sure about overwrite mean() with data. My purpose was to generate random numbers that are from a multivariate normal distribution with the mean vector. For the var.f function, since I already specify m and J, so the only variable is really rho, so I wrote it as a function of rho only. Could you be a little more specific? Thanks a lot again. 2010/5/28 Sarah Goslee sarah.gos...@gmail.com There are a bunch of problems in your code: you overwrite mean() with data, and that could screw things up. you have a function var.f that isn't passed all the arguments it needs. est.4 is defined several times, each overwriting the previous. First you need to clean up these sorts of problems since they can lead to all kinds of bizarre results. Then, if you are still getting unexpected results, please send the list a minimal example so that we can take a look. Sarah On Fri, May 28, 2010 at 10:17 AM, li li hannah@gmail.com wrote: Thanks very much for your reply. The function is a bit long. I attached it. rho.f () is in second text document. It uses rada1.mnorm() function which is contained in the first document. Thank you very very much!!! -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] median test
On Fri, May 28, 2010 at 6:58 AM, linda Porz linda.p...@gmail.com wrote: Hello, I can't have different data these data came from mice that have lived under certain condition in the lab! I have just read the mentioned publication Should the median test be retired from general use? It says in the conclusion If one felt that the data could not come from a Cauchy or slash distribution, the Wilcoxon should be used.! What is this? Is there is any test in R for a Cauchy or slash distribution? Can I used the unpaired Wilcoxon, or I have a Cauchy distributed data? **Disclaimer: I have no idea what your data represents or how (in)appropriate any of these tests may be** R can do the tests you mentioned (and many more). Wilcoxon test: wilcox.test(x=group1, y=group2, paired=FALSE) see ?wilcox.test For testing the distribution look at: ?ks.test and ?pcauchy The code might be something along the lines of: ks.test(x=yourdata, y=pcauchy) Again I want to stress that you should know your data and what tests you are doing and why you are doing them. R will do just about whatever you want, including many things that you probably should not do. Josh Many thanks, Linda 2010/5/27 Joshua Wiley jwiley.ps...@gmail.com Hello Linda, The problem is actually the median of your data. What the function median.test() does first is combine both groups. Look at this: median(c(group1, group2)) the median is 1, but the lowest value of the groups is also 1. So when the function does the logical check z m where z = c(group1, group2) and m is the median, there are no values that are less than the median value. Therefore there is only 1 level, and the fisher test fails. You would either need different data or adjust the function to be: fisher.test(z = m, g)$p.value that way it's less than or equal to the median. Hope that helps, Josh On Thu, May 27, 2010 at 7:24 AM, linda Porz linda.p...@gmail.com wrote: Hi all, I have found the following function online median.test-function(y1,y2){ z-c(y1,y2) g - rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(zm,g)$p.value } in http://www.mail-archive.com/r-help@r-project.org/msg95278.html I have the following data group1 - c(2, 2, 2, 1, 4, 3, 1, 1) group2 - c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) median.test(w1,group1) [1] 1 median.test(group1,group2) Error in fisher.test(z m, g) : 'x' and 'y' must have at least 2 levels I am very thankful in advance for any suggestion and help. Regards, Linda [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with a function
You mean there is a function mean in R, so I should avoid to use it, right? so I do the following: mean1 - c(rep(mu0, mzero), rep(mu1,m-mzero)) var.f - function(rho, m, J) { (1-rho)*diag(m)+rho*J%*%t(J) } Thanks! 2010/5/28 Sarah Goslee sarah.gos...@gmail.com From your code: mean - c(rep(mu0, mzero), rep(mu1,m-mzero)) mean() is a function. If you overwrite it with data, you may mess other things up - any function you call that calls mean will now fail (at best). var.f - function(rho) { (1-rho)*diag(m)+rho*J%*%t(J) } var.f() is a complete function, except that m and J are not passed as arguments. Instead, you rely on them being present in the calling environment, and that is both dangerous and bad practice. Sarah On Fri, May 28, 2010 at 12:00 PM, li li hannah@gmail.com wrote: I am not sure about overwrite mean() with data. My purpose was to generate random numbers that are from a multivariate normal distribution with the mean vector. For the var.f function, since I already specify m and J, so the only variable is really rho, so I wrote it as a function of rho only. Could you be a little more specific? Thanks a lot again. 2010/5/28 Sarah Goslee sarah.gos...@gmail.com There are a bunch of problems in your code: you overwrite mean() with data, and that could screw things up. you have a function var.f that isn't passed all the arguments it needs. est.4 is defined several times, each overwriting the previous. First you need to clean up these sorts of problems since they can lead to all kinds of bizarre results. Then, if you are still getting unexpected results, please send the list a minimal example so that we can take a look. Sarah -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to get values out of a string using regular expressions?
Bingo! Thx Gabor. Thank you too Tal, I looked briefly at the package and it looks like a nice interface. I keep it in mind for later. Cheers Joris On Fri, May 28, 2010 at 2:25 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: as.numeric(gsub(\\D, , X)) On Fri, May 28, 2010 at 8:21 AM, Joris Meys jorism...@gmail.com wrote: Dear all, I have a vector of filenames which begins like this : X - c(OrthoP1_DNA_str.aln, OrthoP10_DNA_str.aln, OrthoP100_DNA_str.aln, OrthoP101_DNA_str.aln, OrthoP102_DNA_str.aln, OrthoP103_DNA_str.aln, OrthoP104_DNA_str.aln, OrthoP105_DNA_str.aln, OrthoP106_DNA_str.aln, OrthoP107_DNA_str.aln) using grep((\\d+),X,perl=T,value=T) I get the complete values back. Yet, I want a vector : c(1,10,100,101,102,103,104,105,106,107) In Perl, using the brackets allows for extracting only the numbers (using a construct with $1 for those who know Perl). I want to do the same in R, but can't find a way of doing that without extensive string manipulations. Problem is that the length of the numbers differ, so I can't use substr. I tried strsplit(X,\\d+) [[1]] [1] OrthoP _DNA_str.aln which gives me exactly what I want to throw away. So : strsplit(X,\\D+) [[1]] [1] 1 [[2]] [1]10 gives something I can use, but it still requires a lot of list manipulation afterwards to get the right vector. Is there an option or a function I'm missing somewhere? Cheers Joris -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] extracat , JGR, iWidgets install problems
I think you tried to start JGR from the console, which will usually not work. JGR has to be started using the launcher which is available at http://jgr.markushelbig.org/Download.html The irmb function will not only need the package installed, but also requires you to use the JGR console for your session. (because iWidgets depends on it) I will include some more detailed information on that in my help files in the next version. Best Alexander _ [[elided Hotmail spam]] [[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] median test
Hello, I can't have different data these data came from mice that have lived under certain condition in the lab! I have just read the mentioned publication Should the median test be retired from general use? It says in the conclusion If one felt that the data could not come from a Cauchy or slash distribution, the Wilcoxon should be used.! What is this? Is there is any test in R for a Cauchy or slash distribution? Can I used the unpaired Wilcoxon, or I have a Cauchy distributed data? Many thanks, Linda 2010/5/27 Joshua Wiley jwiley.ps...@gmail.com Hello Linda, The problem is actually the median of your data. What the function median.test() does first is combine both groups. Look at this: median(c(group1, group2)) the median is 1, but the lowest value of the groups is also 1. So when the function does the logical check z m where z = c(group1, group2) and m is the median, there are no values that are less than the median value. Therefore there is only 1 level, and the fisher test fails. You would either need different data or adjust the function to be: fisher.test(z = m, g)$p.value that way it's less than or equal to the median. Hope that helps, Josh On Thu, May 27, 2010 at 7:24 AM, linda Porz linda.p...@gmail.com wrote: Hi all, I have found the following function online median.test-function(y1,y2){ z-c(y1,y2) g - rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(zm,g)$p.value } in http://www.mail-archive.com/r-help@r-project.org/msg95278.html I have the following data group1 - c(2, 2, 2, 1, 4, 3, 1, 1) group2 - c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) median.test(w1,group1) [1] 1 median.test(group1,group2) Error in fisher.test(z m, g) : 'x' and 'y' must have at least 2 levels I am very thankful in advance for any suggestion and help. Regards, Linda [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.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] if negative value, make zero
I have a data frame with both positive and negative values, and I want to make all the negative values equal zero, so i can eventually take an average. I've tried temp2 - ifelse(tempr0, 0, tempr) but it doesn't seem to work. Any suggestions? Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Survival analysis extrapolation
Dear Terry, Thanks so much for your help; I'm a bit of an R novice at the moment (as you can probably tell from my failure to use the data argument!) so any help is most welcome. I'm hoping to use this model to generate transition probabilities for a Markov model and, as such, I was wondering if there is an easy way of returning the probability of failure at discrete time intervals, (i.e. 360, 390, 420, 450...etc)? Kind regards, Tim. -- View this message in context: http://r.789695.n4.nabble.com/Survival-analysis-extrapolation-tp2231735p2234691.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] how to use GenABEL genetic information??
Does anyone use the R library GenABEL? I am using it to calculate SNP interactions. I have a list of 100 SNPs, I need to look at the interaction between each of two SNPs among the list. my question is how to perform this in GenABEL. I want to use the lm function, but don't know how to use the SNP information. for example: result - (lm(y~SNP1+SNP2+SNP1*SNP2)) the problem here is the SNP1,SNP2 are not working in this place, because it's not a right format to use the SNP information stored in the GenABEL library. Someone said I could first import the GenABEL format genetic data to the format used by genetics library by using as.genotype. I tried, but seems it does take a long time, and the transformation has been running for about 18hs, but it is still running, I don't even know if the transformation is doable. anyone has any idea about how to deal with this problem. thank you very much! karena -- View this message in context: http://r.789695.n4.nabble.com/how-to-use-GenABEL-genetic-information-tp2234760p2234760.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Re : help to replace variable value
Do you mean replace values of a column? df - data.frame(Jan = 1:3,Feb = 11:13) df Jan Feb 1 1 11 2 2 12 3 3 13 df$Jan - 21:23 df Jan Feb 1 21 11 2 22 12 3 23 13 - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Re-help-to-replace-variable-value-tp2234317p2234775.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] Wait for keystroke or timeout
This is really a user interface issue and the standard user interface is different between platforms. Would tcltk (or RGTK or ...) be a possible solution for you? tcltk is fairly consistent across platforms and does provide for this type of thing (you can have a button to press to continue and use the after function to send an automatic push if the user does not push it before a given time). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Prof. John C Nash Sent: Thursday, May 27, 2010 5:09 PM To: r-help@r-project.org Subject: [R] Wait for keystroke or timeout I would like to have a function that would wait either until a specified timeout (in seconds preferably) or until a key is pressed. I've found such a function quite useful in other programming environments in setting up dialogs with users or displaying results, rather like a timed slideshow that can be speeded up by hitting a key. Searching R-seek has led to wait() in the package 'audio', but when I try, for example, joe-wait(readline(hit a key to continue), timeout=6) I am forced to wait the full timeout. Probably someone has done this before and I'm just not using the right search terms. Suggestions welcome. Thanks in advance. JN __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if negative value, make zero
temp2 = tempr temp2[temp20] = 0 HTH On Fri, May 28, 2010 at 8:37 AM, ecvet...@uwaterloo.ca wrote: I have a data frame with both positive and negative values, and I want to make all the negative values equal zero, so i can eventually take an average. I've tried temp2 - ifelse(tempr0, 0, tempr) but it doesn't seem to work. Any suggestions? Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2.11.0 on ubuntu (hardy) inadvertently installed
You might want to ask on R-SIG-Debian https://stat.ethz.ch/mailman/listinfo/r-sig-debian Cedrick W. Johnson wrote: Hi- Looks like this morning, I did the ultimate in foobar to a main prod box. I was using apt-get upgrade on the box and totally missed the fact that my entire R installation went from 2.10.0 to 2.11.0. I now have a bunch of pkgs that aren't loading due to the fact that they were built before 2.10.0 -- There's some *ancient* packages, like (sma) that I was able to figure out what we were using, and pull out the relevant functions and just temporarily do a source('xxx.r') until I can re-build those things into new 2.11 packages. Am I totally SOL today or is there a way to reverse what the heck I did this morning to the entire R installation? thx,c __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Wait for keystroke or timeout
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Prof. John C Nash Sent: Friday, May 28, 2010 7:46 AM Cc: r-help@r-project.org Subject: Re: [R] Wait for keystroke or timeout Matt's suggestion works in Linux (I use Ubuntu and Debian variants), but I haven't yet been able to get it to work in Windows. Another sort of solution would be a timeout() function. timeout(expr, seconds=5), where expr is an expression to be evaluated, would return the value of expr if if could be evaluated in the given number of seconds. If the evaluation of expr were not done in a given number of seconds timeout() would do something else: throw an error or return something of class timedOut or ???. I wrote one for S+ a long time ago when our QA department wanted a way to check that an infinite-loop bug was gone. Here is an R verion of that code which works only on Unix, as it relies on have a shell available and on being able to use Unix signals. It throws an error if there is a timeout. You can catch the error with try or tryCatch or withCallingHandlers. I don't know if there is a similar thing in R now. There is a setTimeLimit function but I haven't played with enough to know if it can do this. timeout function(expr, seconds = 60) { # Set up a background process that will send a signal # to the current R process after 'seconds' seconds. # Evaluate expr with an interrupt handler installed # to catch the interrupt. # If expr finishes before that time it will kill the killer. killer.pid - system(intern = TRUE, paste( (sleep, seconds, ; kill -INT, Sys.getpid(), )/dev/null\n echo $!)) on.exit(system(paste(kill, killer.pid, /dev/null 21))) withCallingHandlers(expr, interrupt=function(...)stop(Timed out, call.=FALSE)) } Try it on Linux with z - try(silent=TRUE, timeout(readline(prompt=Hit me: ), seconds=5)) Hit me: 34 z [1] 34 z - try(silent=TRUE, timeout(readline(prompt=Hit me: ), seconds=5)) Hit me: z [1] Error : Timed out\n attr(,class) [1] try-error I don't know if this sort of user-interface stuff belongs in R itself, but killing jobs that go on for too long can be useful. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com In a DOS terminal, I can run Cygwin's blas.exe via blas -c read -t 1 -n 1 and get the right functioning, but when embedded in R in various ways, I get several error messages that imply R is not finding or interpreting the command correctly. As the details are arcane, please contact me off-line, and I'll report back to the list when we have a solution. However, if someone could try Matt's suggestion on a Mac and let me know outcome, that would be helpful. Since .Platform allows me to determine OS type, I should be able to work out a more or less platform-independent function. JN biostatmatt wrote: On Thu, 2010-05-27 at 19:08 -0400, Prof. John C Nash wrote: I would like to have a function that would wait either until a specified timeout (in seconds preferably) or until a key is pressed. If you are using Linux you can use try this system(read -t 1 -n 1) where -n indicates the number of characters to read and -t specifies the timeout in seconds. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if negative value, make zero
Hi, It did not return the results you wanted because you tried to feed the entire data frame to ifelse(). Does something like this do what you want? apply(tempr, 2, function(x) {ifelse(x 0, 0, x)}) Josh On Fri, May 28, 2010 at 8:37 AM, ecvet...@uwaterloo.ca wrote: I have a data frame with both positive and negative values, and I want to make all the negative values equal zero, so i can eventually take an average. I've tried temp2 - ifelse(tempr0, 0, tempr) but it doesn't seem to work. Any suggestions? Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lm.ridge in library(MASS) produces inconsistent parameter estimates as compared to matrix algebra
Dear all, using the hkb estimator obtained from lm.ridge in the below equation (Formula 6 from this article: http://www3.interscience.wiley.com/cgi-bin/fulltext/122484280/PDFSTART beta^hat(k) = ((x'x + kI)^-1)x'y, where x matrix of independent variables y vector of dependent variables k hkb estimator I identity then I am getting smaller coefficient estimates than from within lm.ridge. The difference is not due to lm.ridge$scales. Any hints as to this? Thank you and kind regards. Georg __ Georg Blind M.Sc. (Econ.), M.A. (Japanese Studies) Email: georg.bl...@gmx.net __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Matrix interesting question!
hi, I have been trying to do this in R (have implemented it in Excel) but I have been using a very inefficent way (loops etc.). I have matrix A (columns are years and ages are rows) and matrix B (columns are birth yrs and rows are ages) I would like to first turn matrix A into matrix B And then I would like to convert matrix B back again to the original matrix A. (I have left out details of steps) but this is the gist of what I want to do. Can anyone please give any insights? Thanks http://r.789695.n4.nabble.com/file/n2234852/untitled.bmp -- View this message in context: http://r.789695.n4.nabble.com/Matrix-interesting-question-tp2234852p2234852.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with a function
On May 28, 2010, at 12:03 PM, Sarah Goslee wrote: From your code: mean - c(rep(mu0, mzero), rep(mu1,m-mzero)) mean() is a function. If you overwrite it with data, you may mess other things up - any function you call that calls mean will now fail (at best). Actually, it's bad but not quite that bad. mean - c(1,2,3,4) mean(1:10) [1] 5.5 mean(mean) [1] 2.5 mean[3] [1] 3 mean [1] 1 2 3 4 apply(matrix(1:100, ncol=10),1, mean) [1] 46 47 48 49 50 51 52 53 54 55 rm(mean) # the interpreter knows to only remove the vector object mean function (x, ...) UseMethod(mean) environment: namespace:base rm(mean) # and will refuse to remove the base function Warning message: In rm(mean) : object 'mean' not found Generally the interpreter can tell when a name is being intended as a function. Certainly when () follows the name, a function will be sought and other objects with identical names ignored.There are exceptions to that statement and your point is very well taken, but the main level of confusion is in the human brain rather than the R- interpreter. There used to be more partial name matching, but my reading of the NEWS items makes me think there is a shift away from that facility. Other functions that people often mis-use as object names, generally without obvious deleterious effects: df # the density of the F distribution c data sd var names var.f - function(rho) { (1-rho)*diag(m)+rho*J%*%t(J) } var.f() is a complete function, except that m and J are not passed as arguments. Instead, you rely on them being present in the calling environment, and that is both dangerous and bad practice. Sarah On Fri, May 28, 2010 at 12:00 PM, li li hannah@gmail.com wrote: I am not sure about overwrite mean() with data. My purpose was to generate random numbers that are from a multivariate normal distribution with the mean vector. For the var.f function, since I already specify m and J, so the only variable is really rho, so I wrote it as a function of rho only. Could you be a little more specific? Thanks a lot again. 2010/5/28 Sarah Goslee sarah.gos...@gmail.com There are a bunch of problems in your code: you overwrite mean() with data, and that could screw things up. you have a function var.f that isn't passed all the arguments it needs. est.4 is defined several times, each overwriting the previous. First you need to clean up these sorts of problems since they can lead to all kinds of bizarre results. Then, if you are still getting unexpected results, please send the list a minimal example so that we can take a look. Sarah -- 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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] median test
Linda, There are different views about whether someone doing statistical analysis should first take a certain number of statistics course. I think for your issue some background information would certainly help. You have not correctly interpreted the paper. The main point is that for most cases likely to be seen in practice, the median test is tantamount to discarding about 1/3 of your animals. The Wilcoxon test is a good choice for a huge variety of situations. Even if the data are Gaussian it has efficiency 3/pi whereas the median test has efficiency 2/pi in that case. Frank On 05/28/2010 08:58 AM, linda Porz wrote: Hello, I can't have different data these data came from mice that have lived under certain condition in the lab! I have just read the mentioned publication Should the median test be retired from general use? It says in the conclusion If one felt that the data could not come from a Cauchy or slash distribution, the Wilcoxon should be used.! What is this? Is there is any test in R for a Cauchy or slash distribution? Can I used the unpaired Wilcoxon, or I have a Cauchy distributed data? Many thanks, Linda 2010/5/27 Joshua Wileyjwiley.ps...@gmail.com Hello Linda, The problem is actually the median of your data. What the function median.test() does first is combine both groups. Look at this: median(c(group1, group2)) the median is 1, but the lowest value of the groups is also 1. So when the function does the logical check z m where z = c(group1, group2) and m is the median, there are no values that are less than the median value. Therefore there is only 1 level, and the fisher test fails. You would either need different data or adjust the function to be: fisher.test(z= m, g)$p.value that way it's less than or equal to the median. Hope that helps, Josh On Thu, May 27, 2010 at 7:24 AM, linda Porzlinda.p...@gmail.com wrote: Hi all, I have found the following function online median.test-function(y1,y2){ z-c(y1,y2) g- rep(1:2, c(length(y1),length(y2))) m-median(z) fisher.test(zm,g)$p.value } in http://www.mail-archive.com/r-help@r-project.org/msg95278.html I have the following data group1- c(2, 2, 2, 1, 4, 3, 1, 1) group2- c(3, 1, 3, 1, 4, 1, 1, 1, 7, 1, 1, 1, 1, 1, 2) median.test(w1,group1) [1] 1 median.test(group1,group2) Error in fisher.test(z m, g) : 'x' and 'y' must have at least 2 levels I am very thankful in advance for any suggestion and help. Regards, Linda [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.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. -- Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 plotting survival predictions from cph model
Josh, Good point. And it actually accidentally solved my problem. Previously I attached .Rdata files. After your email I exported this dataset into a csv file and then re-loaded it to see if the problem persists, and... the problem disappeared. Nevertheless, if I load the original .Rdata file, the problem is back again. This makes no sense to me - there must be a bug in R, or in the survival package. Regards to all, -- Michal J. Figurski, PhD HUP, Pathology Laboratory Medicine Biomarker Research Laboratory 3400 Spruce St. 7 Maloney Philadelphia, PA 19104 tel. (215) 662-3413 On 2010-05-27 13:39, Joshua Wiley wrote: On Thu, May 27, 2010 at 10:32 AM, Michal Figurski figur...@mail.med.upenn.edu wrote: Actually, I have another problem with the same data - this time with plotting simple KM lines. The dataset is attached. Michal, Just as a heads up, only certain types of files can be attached, others get scrubbed. At least I did not see any data attached from your last two emails. Josh -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Matrix interesting question!
Provide a minimal example to start with. This sounds more like voodoo than anything else. Cheers Joris On Fri, May 28, 2010 at 6:30 PM, UM usman.muni...@imperial.ac.uk wrote: hi, I have been trying to do this in R (have implemented it in Excel) but I have been using a very inefficent way (loops etc.). I have matrix A (columns are years and ages are rows) and matrix B (columns are birth yrs and rows are ages) I would like to first turn matrix A into matrix B And then I would like to convert matrix B back again to the original matrix A. (I have left out details of steps) but this is the gist of what I want to do. Can anyone please give any insights? Thanks http://r.789695.n4.nabble.com/file/n2234852/untitled.bmp -- View this message in context: http://r.789695.n4.nabble.com/Matrix-interesting-question-tp2234852p2234852.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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] Matrix interesting question!
Hi, Can you provide sample data? It seems like in both matrices, you have ages in the rows. Do you just want to calculate birth years in matrix B from ages and years in matrix A? It may also help to give us some of the details of what you are doing once you have transformed it prior to transforming back (e.g., are there changes that would impact what the code to convert back needs to be?). Josh On Fri, May 28, 2010 at 9:30 AM, UM usman.muni...@imperial.ac.uk wrote: hi, I have been trying to do this in R (have implemented it in Excel) but I have been using a very inefficent way (loops etc.). I have matrix A (columns are years and ages are rows) and matrix B (columns are birth yrs and rows are ages) I would like to first turn matrix A into matrix B And then I would like to convert matrix B back again to the original matrix A. (I have left out details of steps) but this is the gist of what I want to do. Can anyone please give any insights? Thanks http://r.789695.n4.nabble.com/file/n2234852/untitled.bmp -- View this message in context: http://r.789695.n4.nabble.com/Matrix-interesting-question-tp2234852p2234852.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. -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 2.11.0 on ubuntu (hardy) inadvertently installed
Am 28.05.2010 17:25, schrieb Cedrick W. Johnson: I now have a bunch of pkgs that aren't loading due to the fact that they were built before 2.10.0 -- There's some *ancient* packages, like (sma) that I was able to figure out what we were using, and pull out the relevant functions and just temporarily do a source('xxx.r') until I can re-build those things into new 2.11 packages. Am I misssing something or what speaks against update.packages(checkBuilt=TRUE) ? Stefan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 a function
I modified my codes. However it looks like it still has the same problem. Again, rho.f(0.3) gives the right answer. rho.f(corr[4]) gives wrong answer even though corr[4]==0.3. The codes are attached. Thank you very much!!! rho.f(0.3) $est.1 [1] 0.000 0.000 0.000 0.000 0.833 0.000 0.000 [8] 0.000 1.667 0.000 $est.2 [1] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 [9] 1.198658 0.00 $est.3 [1] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 [9] 0.862069 0.00 $est.4 [1] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 [9] 12.93103 0.0 $est.5 [1] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 [9] 12.93103 0.0 corr - seq(0,0.9, by=0.1) corr[4] [1] 0.3 rho.f(corr[4]) $est.1 [1] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 [8] 0.000 0.833 0.000 $est.2 [1] 0 0 0 0 0 0 0 0 0 0 $est.3 [1] 0 0 0 0 0 0 0 0 0 0 $est.4 [1] 0 0 0 0 0 0 0 0 0 0 $est.5 [1] 0 0 0 0 0 0 0 0 0 0 2010/5/28 David Winsemius dwinsem...@comcast.net On May 28, 2010, at 12:03 PM, Sarah Goslee wrote: From your code: mean - c(rep(mu0, mzero), rep(mu1,m-mzero)) mean() is a function. If you overwrite it with data, you may mess other things up - any function you call that calls mean will now fail (at best). Actually, it's bad but not quite that bad. mean - c(1,2,3,4) mean(1:10) [1] 5.5 mean(mean) [1] 2.5 mean[3] [1] 3 mean [1] 1 2 3 4 apply(matrix(1:100, ncol=10),1, mean) [1] 46 47 48 49 50 51 52 53 54 55 rm(mean) # the interpreter knows to only remove the vector object mean function (x, ...) UseMethod(mean) environment: namespace:base rm(mean) # and will refuse to remove the base function Warning message: In rm(mean) : object 'mean' not found Generally the interpreter can tell when a name is being intended as a function. Certainly when () follows the name, a function will be sought and other objects with identical names ignored.There are exceptions to that statement and your point is very well taken, but the main level of confusion is in the human brain rather than the R-interpreter. There used to be more partial name matching, but my reading of the NEWS items makes me think there is a shift away from that facility. Other functions that people often mis-use as object names, generally without obvious deleterious effects: df # the density of the F distribution c data sd var names var.f - function(rho) { (1-rho)*diag(m)+rho*J%*%t(J) } var.f() is a complete function, except that m and J are not passed as arguments. Instead, you rely on them being present in the calling environment, and that is both dangerous and bad practice. Sarah On Fri, May 28, 2010 at 12:00 PM, li li hannah@gmail.com wrote: I am not sure about overwrite mean() with data. My purpose was to generate random numbers that are from a multivariate normal distribution with the mean vector. For the var.f function, since I already specify m and J, so the only variable is really rho, so I wrote it as a function of rho only. Could you be a little more specific? Thanks a lot again. 2010/5/28 Sarah Goslee sarah.gos...@gmail.com There are a bunch of problems in your code: you overwrite mean() with data, and that could screw things up. you have a function var.f that isn't passed all the arguments it needs. est.4 is defined several times, each overwriting the previous. First you need to clean up these sorts of problems since they can lead to all kinds of bizarre results. Then, if you are still getting unexpected results, please send the list a minimal example so that we can take a look. Sarah -- 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT rdata1.mnorm-function(m,n,mzero,mu0, mu1,rho ) { ## ARGUEMENTS # n: sample size # m: dimension of multivariate normal library(MASS) mean1 - c(rep(mu0, mzero), rep(mu1,m-mzero)) var.f - function(rho, x,y) { (1-rho)*diag(x)+rho*y%*%t(y) } J - rep(1, m) set.seed(103) x - mvrnorm(n,mean1, var.f(rho,x=m, y=J)) theta - matrix(0, nrow=n, ncol=m) for (i in 1:m){theta[,i]- mean1[i]1} data-list(s=theta, o=x) return(data) } rho.f - function(rho){ ###generate data result - rdata1.mnorm(m=30,n=10,mzero=5,mu0=0,mu1=2,rho=rho) o - result$o s - result$s ### the p-values pv-1-pnorm(o, 0, 1) m - dim(pv)[2] n - dim(pv)[1] lambda - 0.96 w1 - apply(pvlambda, 1, sum) est.1 - w1/((1-lambda)*m) w2 - numeric(n) for (i
Re: [R] median test
**Disclaimer: I have no idea what your data represents or how (in)appropriate any of these tests may be** R can do the tests you mentioned (and many more). Wilcoxon test: wilcox.test(x=group1, y=group2, paired=FALSE) see ?wilcox.test I am not sure whether it is still valid but in case of ties (equal values in the same group) like in your example data you should use the wilcox_test from the coin package. That one has a correction for ties. But as Joshua told correctly as far as we do not know your data, Linda, it is hard to tell what might be approproate... Stefan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Does Sweave run in the global environment ?
Hello It seems that sweave always runs in the global environment. I want to run sweave from within a function, and pass a variable into sweave, however when I do this, sweave doesn't see the variable. Here's my example test_sweave.Rnw file |% \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{Sweave} \begin{document} \title{Test Sweave Document} \author{Paul Hurley} \maketitle = if(exists(foo)){print(foo)} ls() Sys.time() @ \end{document} | If I run this code; |testFoo-function(){ foo-My Test String Sweave(test_sweave.Rnw) require(tools) texi2dvi(file = test_sweave.tex, pdf = TRUE) } rm(foo) testFoo() | my resulting file does NOT contain the contents of the string foo. | if (exists(foo)) { + print(foo) + } ls() [1] testFoo | If I run this code (i.e, the same thing, just run directly) |rm(foo) foo-My Test String Sweave(test_sweave.Rnw) require(tools) texi2dvi(file = test_sweave.tex, pdf = TRUE) | my resulting file does contain the foo string | if (exists(foo)) { + print(foo) + } [1] My Test String ls() [1] foo testFoo | and if I run this code |testBar-function(){ foo-My Test String Sweave(test_sweave.Rnw) require(tools) texi2dvi(file = test_sweave.tex, pdf = TRUE) } rm(foo) testBar() | My resulting file also contains the foo string | if (exists(foo)) { + print(foo) + } [1] My Test String ls() [1] foo testBar testFoo | So, it seems that sweave runs in the global environment, not in the environment it was called from. This means the only way to pass variables to sweave when sweave is run from a function is to use the - operator to put the variable in the global environment. (I think). Anyone else want to comment who knows more about environments ? Thanks Paul. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with a function
My initial guess appears to be right: you're working with something exceedingly sensitive to floating point precision. You may have to reconsider your methods. Your problem is: rho.f(rho = 0.3) gives a different answer than rho.f(seq(0, 1, by=.1)[4]) even though all.equal(0.3, seq(0, 1, by=.1)[4]) == TRUE The only thing rho.f does with rho is passes it to rdata1.mnorm so the rest of the function is irrelevant for this question. The only thing rdata1.mnorm does with rho is passes it to var.f So we've already ruled out most of your code and narrowed the problem down to one small section. Take a look at this example and run it for yourself: # starting parameters m=30;n=10;mzero=5;mu0=0;mu1=2 mean1 - c(rep(mu0, mzero), rep(mu1, m-mzero)) ## make two different var.f() results varf1 - var.f(0.3, m, rep(1, m)) varf2 - var.f(seq(0, 1, by=0.1)[4], m, rep(1, m)) ## compare them all.equal(varf1, varf2) all(varf1 == varf2) ## here's where the problem is ## The function you're calling is extremely sensitive, and 0.3 ## cannot be represented exactly. set.seed(103) mvrnorm(n, mean1, varf1) set.seed(103) mvrnorm(n, mean1, varf2) ## Here's a check on that idea: set.seed(103) mvrnorm(n, mean1, round(varf1, 1)) set.seed(103) mvrnorm(n, mean1, round(varf2, 1)) and compare to this ## make two different var.f() results varf1 - var.f(0.2, m, rep(1, m)) varf2 - var.f(seq(0, 1, by=0.1)[3], m, rep(1, m)) ## compare them all.equal(varf1, varf2) all(varf1 == varf2) ## Look: 0.2 can be represented exactly. set.seed(103) mvrnorm(n, mean1, varf1) set.seed(103) mvrnorm(n, mean1, varf2) -- 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] clustering in R
Thanks Tal Joris! I created my distance matrix distA by using the dist() function in R manipulating my output in order to get a matrix. distA =as.matrix(dist(t(x2))) # x2 being my original dataset as according to the documentaion on dist() For the default method, a dist object, or a matrix (of distances) or an object which can be coerced to such a matrix using as.matrix() On Fri, May 28, 2010 at 6:34 AM, Joris Meys jorism...@gmail.com wrote: As Tal said. Next to that, I read that column1 (and column2?) are supposed to be seen as factors, not as numerical variables. Did you take that into account somehow? It's easy to reproduce the error code : n - NULL if(n2)print(This is OK) Error in if (n 2) print(This is OK) : argument is of length zero In the hclust code, you find following line : n - as.integer(attr(d, Size)) where d is the distance object entered in the hclust function. Looking at the error you get, this means that the size attribute of your distance is NULL. Which tells me that distA is not a dist-object. A - matrix(1:4,ncol=2) A [,1] [,2] [1,]13 [2,]24 hclust(A,method=single) Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero Did you actually put in a distance object? see also ?dist or ?as.dist. Cheers Joris On Fri, May 28, 2010 at 1:41 AM, Ayesha Khan ayesha.diamond...@gmail.com wrote: i have a matrix with the following dimensions 136 3 and it looks something like [,1] [,2] [,3] [1,] 402 675 1.802758 [2,] 402 696 1.938902 [3,] 402 699 1.994253 [4,] 402 945 1.898619 [5,] 424 470 1.812857 [6,] 424 905 1.816345 [7,] 470 905 1.871252 [8,] 504 780 1.958191 [9,] 504 848 1.997111... so you get the idea. I want to group similar items in one group/cluster following the friends of friends approach. I tried doing distclust - hclust(distA,method=single) However, I got the following error. Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero which probably means there's something wrong with my input here. Is there another way of doing this kind of clustering without getting into all the looping and ifelse etc. Basically, if 402 is close to 675,696,and699 and thus fall in cluster A then all items close to 675,696,and 699 should also fall into the same cluster A following a friends of friedns strategy. Any help would be highly appreciated. -- Ayesha Khan MS Bioengineering Dept. of Bioengineering Rice University, TX [[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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php -- Ayesha Khan MS Bioengineering Dept. of Bioengineering Rice University, TX [[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] Matrix interesting question!
On May 28, 2010, at 12:30 PM, UM wrote: hi, I have been trying to do this in R (have implemented it in Excel) but I have been using a very inefficent way (loops etc.). I have matrix A (columns are years and ages are rows) and matrix B (columns are birth yrs and rows are ages) I would like to first turn matrix A into matrix B catrow - function(A, rn) c(rep(0, 3-rn), A[rn,],rep(0, (2+rn)-3) ) matrix(sapply(1:3, function(x) catrow(A, x)) , ncol=2*ncol(A)-1, byrow=TRUE) [,1] [,2] [,3] [,4] [,5] [1,] 0 0 a b c [2,] 0 d e f 0 [3,] g h i 0 0 And then I would like to convert matrix B back again to the original matrix A. Left as an exercise for the reader. (I have left out details of steps) but this is the gist of what I want to do. Can anyone please give any insights? David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] create new variable: percentile value of variable in data frame
Hello all, Thanks in advance for you attention. I would like to generate a third value that represents the quantile value of a variable in a data frame. # generating data x - as.matrix(seq(1:30)) y - as.matrix(rnorm(30, 20, 7)) tmp1 - cbind(x,y) dat - as.data.frame(tmp1) colnames(dat) - c(id, score) dat # finding percentiles of score qs - as.matrix(quantile(dat$score, type=3, probs = seq(0,1,.1))) colnames(qs) - c( score) qs # is there a way to put the quantile value for a value of 'score' into a new variable, # such that the new data frame would have three variables: id, score and q.score? ## running R version 2.8.1 (2008-12-22) on Vista Thanks so much! -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] problem with a function
Hi Sarah, Thanks for your kind help. I now know where the problem is. Hannah 2010/5/28 Sarah Goslee sarah.gos...@gmail.com My initial guess appears to be right: you're working with something exceedingly sensitive to floating point precision. You may have to reconsider your methods. Your problem is: rho.f(rho = 0.3) gives a different answer than rho.f(seq(0, 1, by=.1)[4]) even though all.equal(0.3, seq(0, 1, by=.1)[4]) == TRUE The only thing rho.f does with rho is passes it to rdata1.mnorm so the rest of the function is irrelevant for this question. The only thing rdata1.mnorm does with rho is passes it to var.f So we've already ruled out most of your code and narrowed the problem down to one small section. Take a look at this example and run it for yourself: # starting parameters m=30;n=10;mzero=5;mu0=0;mu1=2 mean1 - c(rep(mu0, mzero), rep(mu1, m-mzero)) ## make two different var.f() results varf1 - var.f(0.3, m, rep(1, m)) varf2 - var.f(seq(0, 1, by=0.1)[4], m, rep(1, m)) ## compare them all.equal(varf1, varf2) all(varf1 == varf2) ## here's where the problem is ## The function you're calling is extremely sensitive, and 0.3 ## cannot be represented exactly. set.seed(103) mvrnorm(n, mean1, varf1) set.seed(103) mvrnorm(n, mean1, varf2) ## Here's a check on that idea: set.seed(103) mvrnorm(n, mean1, round(varf1, 1)) set.seed(103) mvrnorm(n, mean1, round(varf2, 1)) and compare to this ## make two different var.f() results varf1 - var.f(0.2, m, rep(1, m)) varf2 - var.f(seq(0, 1, by=0.1)[3], m, rep(1, m)) ## compare them all.equal(varf1, varf2) all(varf1 == varf2) ## Look: 0.2 can be represented exactly. set.seed(103) mvrnorm(n, mean1, varf1) set.seed(103) mvrnorm(n, mean1, varf2) -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] clustering in R
Hi Ayesha, I wish to help you, but without a simple self contained example that shows your issue, I will not be able to help. Try using the ?dput command to create some simple data, and let us see what you are doing. Best, Tal 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 Fri, May 28, 2010 at 9:04 PM, Ayesha Khan ayesha.diamond...@gmail.comwrote: Thanks Tal Joris! I created my distance matrix distA by using the dist() function in R manipulating my output in order to get a matrix. distA =as.matrix(dist(t(x2))) # x2 being my original dataset as according to the documentaion on dist() For the default method, a dist object, or a matrix (of distances) or an object which can be coerced to such a matrix using as.matrix() On Fri, May 28, 2010 at 6:34 AM, Joris Meys jorism...@gmail.com wrote: As Tal said. Next to that, I read that column1 (and column2?) are supposed to be seen as factors, not as numerical variables. Did you take that into account somehow? It's easy to reproduce the error code : n - NULL if(n2)print(This is OK) Error in if (n 2) print(This is OK) : argument is of length zero In the hclust code, you find following line : n - as.integer(attr(d, Size)) where d is the distance object entered in the hclust function. Looking at the error you get, this means that the size attribute of your distance is NULL. Which tells me that distA is not a dist-object. A - matrix(1:4,ncol=2) A [,1] [,2] [1,]13 [2,]24 hclust(A,method=single) Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero Did you actually put in a distance object? see also ?dist or ?as.dist. Cheers Joris On Fri, May 28, 2010 at 1:41 AM, Ayesha Khan ayesha.diamond...@gmail.com wrote: i have a matrix with the following dimensions 136 3 and it looks something like [,1] [,2] [,3] [1,] 402 675 1.802758 [2,] 402 696 1.938902 [3,] 402 699 1.994253 [4,] 402 945 1.898619 [5,] 424 470 1.812857 [6,] 424 905 1.816345 [7,] 470 905 1.871252 [8,] 504 780 1.958191 [9,] 504 848 1.997111... so you get the idea. I want to group similar items in one group/cluster following the friends of friends approach. I tried doing distclust - hclust(distA,method=single) However, I got the following error. Error in if (n 2) stop(must have n = 2 objects to cluster) : argument is of length zero which probably means there's something wrong with my input here. Is there another way of doing this kind of clustering without getting into all the looping and ifelse etc. Basically, if 402 is close to 675,696,and699 and thus fall in cluster A then all items close to 675,696,and 699 should also fall into the same cluster A following a friends of friedns strategy. Any help would be highly appreciated. -- Ayesha Khan MS Bioengineering Dept. of Bioengineering Rice University, TX [[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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php -- Ayesha Khan MS Bioengineering Dept. of Bioengineering Rice University, TX [[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 a function
Hi all, Sorry I have too many questions. I could not think of a way to fix problem. Can anyone give some suggestions on fixing this? Hannah 2010/5/28 li li hannah@gmail.com Hi Sarah, Thanks for your kind help. I now know where the problem is. Hannah 2010/5/28 Sarah Goslee sarah.gos...@gmail.com My initial guess appears to be right: you're working with something exceedingly sensitive to floating point precision. You may have to reconsider your methods. Your problem is: rho.f(rho = 0.3) gives a different answer than rho.f(seq(0, 1, by=.1)[4]) even though all.equal(0.3, seq(0, 1, by=.1)[4]) == TRUE The only thing rho.f does with rho is passes it to rdata1.mnorm so the rest of the function is irrelevant for this question. The only thing rdata1.mnorm does with rho is passes it to var.f So we've already ruled out most of your code and narrowed the problem down to one small section. Take a look at this example and run it for yourself: # starting parameters m=30;n=10;mzero=5;mu0=0;mu1=2 mean1 - c(rep(mu0, mzero), rep(mu1, m-mzero)) ## make two different var.f() results varf1 - var.f(0.3, m, rep(1, m)) varf2 - var.f(seq(0, 1, by=0.1)[4], m, rep(1, m)) ## compare them all.equal(varf1, varf2) all(varf1 == varf2) ## here's where the problem is ## The function you're calling is extremely sensitive, and 0.3 ## cannot be represented exactly. set.seed(103) mvrnorm(n, mean1, varf1) set.seed(103) mvrnorm(n, mean1, varf2) ## Here's a check on that idea: set.seed(103) mvrnorm(n, mean1, round(varf1, 1)) set.seed(103) mvrnorm(n, mean1, round(varf2, 1)) and compare to this ## make two different var.f() results varf1 - var.f(0.2, m, rep(1, m)) varf2 - var.f(seq(0, 1, by=0.1)[3], m, rep(1, m)) ## compare them all.equal(varf1, varf2) all(varf1 == varf2) ## Look: 0.2 can be represented exactly. set.seed(103) mvrnorm(n, mean1, varf1) set.seed(103) mvrnorm(n, mean1, varf2) -- Sarah Goslee http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Does Sweave run in the global environment ?
On 28/05/2010 1:58 PM, Paul wrote: Hello It seems that sweave always runs in the global environment. By default it uses the RweaveEvalWithOpt function to evaluate expressions, and they are evaluated in the global environment. It's possible to change that. You need to make your own driver. I'd start with the default one via mydriver - RweaveLatex() then replace the code running part with your own, e.g. myenvironment - environment() # This will make the current environment is the default, rather than globalenv() myEvalWithOpt - function (expr, options){ if(options$eval){ res - try(withVisible(eval(expr, myenvironment)), silent=TRUE) if(inherits(res, try-error)) return(res) if(options$print | (options$term res$visible)) print(res$value) } return(res) } mydriver$runcode - makeRweaveLatexCodeRunner(evalFunc = myEvalWithOpt) and then run Sweave with your driver: Sweave(file, driver=mydriver) I haven't tried any of this, and it's possible some of the functions I used above are not exported from the utils package. But this should get you started if you (sensibly) want to avoid setting your variable as a global. Another approach (which I use) is to never run Sweave() from within R; always use R CMD Sweave (or some equivalent), and define all the local variables in the Sweave file. But this doesn't work if you want to generate lots of Sweave output files. Duncan Murdoch I want to run sweave from within a function, and pass a variable into sweave, however when I do this, sweave doesn't see the variable. Here's my example test_sweave.Rnw file |% \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{Sweave} \begin{document} \title{Test Sweave Document} \author{Paul Hurley} \maketitle = if(exists(foo)){print(foo)} ls() Sys.time() @ \end{document} | If I run this code; |testFoo-function(){ foo-My Test String Sweave(test_sweave.Rnw) require(tools) texi2dvi(file = test_sweave.tex, pdf = TRUE) } rm(foo) testFoo() | my resulting file does NOT contain the contents of the string foo. | if (exists(foo)) { + print(foo) + } ls() [1] testFoo | If I run this code (i.e, the same thing, just run directly) |rm(foo) foo-My Test String Sweave(test_sweave.Rnw) require(tools) texi2dvi(file = test_sweave.tex, pdf = TRUE) | my resulting file does contain the foo string | if (exists(foo)) { + print(foo) + } [1] My Test String ls() [1] foo testFoo | and if I run this code |testBar-function(){ foo-My Test String Sweave(test_sweave.Rnw) require(tools) texi2dvi(file = test_sweave.tex, pdf = TRUE) } rm(foo) testBar() | My resulting file also contains the foo string | if (exists(foo)) { + print(foo) + } [1] My Test String ls() [1] foo testBar testFoo | So, it seems that sweave runs in the global environment, not in the environment it was called from. This means the only way to pass variables to sweave when sweave is run from a function is to use the - operator to put the variable in the global environment. (I think). Anyone else want to comment who knows more about environments ? Thanks Paul. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 new variable: percentile value of variable in data frame
Hi Jon, does the empirical cumulative distribution function do what you want? dat$q.score - ecdf(dat$score)(dat$score) ?ecdf HTH Stephan Jonathan Beard schrieb: Hello all, Thanks in advance for you attention. I would like to generate a third value that represents the quantile value of a variable in a data frame. # generating data x - as.matrix(seq(1:30)) y - as.matrix(rnorm(30, 20, 7)) tmp1 - cbind(x,y) dat - as.data.frame(tmp1) colnames(dat) - c(id, score) dat # finding percentiles of score qs - as.matrix(quantile(dat$score, type=3, probs = seq(0,1,.1))) colnames(qs) - c( score) qs # is there a way to put the quantile value for a value of 'score' into a new variable, # such that the new data frame would have three variables: id, score and q.score? ## running R version 2.8.1 (2008-12-22) on Vista Thanks so much! -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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 sort order linux/Windows (R.2.11.0)
On 28-May-10 14:37:39, Duncan Murdoch wrote: On 28/05/2010 9:24 AM, (Ted Harding) wrote: An experiment: sort(c(AACD,A CD)) # [1] AACD A CD sort(c(ABCD,A CD)) # [1] ABCD A CD sort(c(ACCD,A CD)) # [1] ACCD A CD sort(c(ADCD,A CD)) # [1] A CD ADCD sort(c(AECD,A CD)) # [1] A CD AECD ## (with results for AFCD, ... AZCD similar to the last two). LC_COLLATE=en_GB.UTF-8 (R version 2.11.0 (2010-04-22) on Linux). So this behaves, in en_GB.UTF-8, as though (SPACE) is between C and D. This is nuts!!! Curable if I set (e.g.) LC_LOCALE=C on startup. But what else might break if I do so? You have to realize that to a large extent this is not under our control. Your system will have linked to some library (outside of R) to do string collation, and the problem lies in that library. You should determine which system library is handling your collations. I'd like to tell you how to do that, but I don't know for your build. You can find out if you're using the recommended ICU library by running example(icuSetCollate); that gives a number of warnings like In icuSetCollate(locale = da_DK, case_first = default) : ICU is not supported on this build in Windows. If you don't see those, then you want to talk to the ICU people. If you do, then you'll need to look deeper to find out what you're actually using. Duncan Murdoch Thanks for the further guidance, Duncan. I indeed get 4 such warnings from example(icuSetCollate), indicating that ICU is not being used. I have now thrown the above experiment straight at Linux, entering command-line commands as follows (with the results shown on the lines starting with #): sort EOT AACD A CD EOT # AACD # A CD sort EOT ABCD A CD EOT # ABCD # A CD sort EOT ACCD A CD EOT # ACCD # A CD sort EOT ADCD A CD EOT # A CD # ADCD This clearly shows that the Linux collating order sees (SPACE) as coming between C and D, as when I tried it in R. I am now spamming my Linux contacts about it! The result of the locale command in Linux includes: LC_COLLATE=en_GB.UTF-8 This happens consistently on a Debian Lenny and a Debian Etch system. Thanks, Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-May-10 Time: 21:14:54 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] leave-one-out cross validation
Hi Finally, I did leave-one-out cross validation in R for prediction error of logistic regression by cv.glm. But I don't know what are the produced data(almost 700)? does delta show me error estimation? cost-function(a,b)mean(abs(a-b)) #SALIC=binary response salic.lr-glm(profilesample$SALIC~profilesample$wetnessindex , profilesample, family=binomial('logit')) loadpackage(boot) cv.err-cv.glm(profilesample, salic.lr, cost, K=100) cv.err $call cv.glm(data = profilesample, glmfit = salic.lr, cost = cost, K = 100) $K [1] 100 $delta 1 1 0.4278 0.4278 $seed [1] 403 133 1654269195 -1877109783 -961256264 1403523942 [7] 124639233 261424787 1836448066 1034917620 -13630729 468718317 [13] 1694379396 1559298986 1935866133 -1450855505 2105396150 1802260960 [19] 1077391651 539731521 122505520 230898510 -1940184647 1223031755 [25] -1597886342 -1854140036 -1783225921 1484611221 1365746860 -346485118 [31] 1206044253 1201793367 956757054 350214264 -1324711077 . . . please help me Thanks alot --- On Wed, 5/26/10, Joris Meys jorism...@gmail.com wrote: From: Joris Meys jorism...@gmail.com Subject: Re: [R] validation logistic regression To: azam jaafari azamjaaf...@yahoo.com Cc: r-help@r-project.org Date: Wednesday, May 26, 2010, 5:00 AM Hi, first of all, you shouldn't backtransform your prediction, use the option type=response instead : salichpred-predict(salic.lr, newdata=profilevalidation,type=response) limit - 0.5 salichpredcat - ifelse(salichpredlimit,0,1) # prediction of categories. Read in on sensitivity, specificity and ROC-curves. With changing the limit, you can calculate sensitivity and specificity, and you can construct a ROC curve that will tell you how well your predictions are. It all depends on how much error you allow on the predictions. Cheers Joris On Wed, May 26, 2010 at 10:04 AM, azam jaafari azamjaaf...@yahoo.com wrote: Hi I did validation for prediction by logistic regression according to following: validationsize - 23 set.seed(1) random-runif(123) order(random) nrprofilesinsample-sort(order(random)[1:100]) profilesample - data[nrprofilesinsample,] profilevalidation - data[-nrprofilesinsample,] salich-profilesample$SALIC.H.1 salic.lr-glm(salich~wetnessindex, profilesample, family=binomial('logit')) summary(salic.lr) salichpred-predict(salic.lr, newdata=profilevalidation) expsalichpred-exp(salichpred) salichprediction-(expsalichpred/(1+expsalichpred)) So, table(salichprediction, profilevalidation$SALIC.H.1) in result: salichprediction 0 1 0.0408806327422231 1 0 0.094509645033899 1 0 0.118665480273383 1 0 0.129685441514168 1 0 0.13545295569511 1 0 0.137580612201769 1 0 0.197265822234215 1 0 0.199278585548248 0 1 0.202436276322278 1 0 0.211278767985746 1 0 0.261036846823867 1 0 0.283792703256058 1 0 0.362229486187581 0 1 0.362795636267779 1 0 0.409067386115694 1 0 0.410860613509484 0 1 0.423960962956254 1 0 0.428164288793652 1 0 0.448509687866763 0 1 0.538401659478058 0 1 0.557282539294224 1 0 0.603881788227797 0 1 0.63633478460736 0 1 So, I have salichprediction between 0 to 1 and binary variable(observed values) 0 or 1. I want to compare these data together and I want to know is ok this model(logistic regression) for prediction or no? please help me? Thanks alot Azam [[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. -- Joris Meys Statistical Consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control Coupure Links 653 B-9000 Gent tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[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] R: why biomaRt cannot extract 3UTR sequences for 1941 ENSGxxxxx ?
-Messaggio originale- Da: Steve Lianoglou [mailto:mailinglist.honey...@gmail.com] Inviato: ven 28/05/2010 17.06 A: mau...@alice.it Cc: r-h...@stat.math.ethz.ch Oggetto: Re: [R] why biomaRt cannot extract 3UTR sequences for 1941 ENSGx ? Hi, Two things: 1. You mistakenly posted this to the R-help list, when you should have (and probably meant to) send to the bioconductor list. You might want to repost there if you can't figure out the problem. That's right. I apologize for my mistake. I will repost to the right list 2. I just tried your query with 4 transcript IDs (one of them was a duplicate) and it worked fine. Maybe the error you are receiving is actually informative of what your problem is: Error in value[[3L]](cond) : Request to BioMart web service failed. Verify if you are still connected to the internet. Alternatively the BioMart web service is temporarily down. and for some reason you're just having a problem talking to the biomart service itself ... Why not try your query with a small number of ensemble transcript id's to see if that'll work? Actually, the same query has worked with a smaller number of ENST...many times. But if the length of the filtering vector is really the problem then I feel confused. Some months ago I was extracting one UTR sequence at a time, thus keeping the connection to biomaRt opened for several hours. At that time biomaRt was cutting me off after some time (of variable length). I posted my question to Bioconductor asking why biomaRt was kicking me out. I was strongly adviced to downloasd all needed data all together with one single query and then parse the downloaded stuff off-line. If I got it right now you suggest downloading a few data at a time. I'd really appreciate knowing whether there are limits in the amount of data that can be requested in a query and, if so, the upper boud. Thank you, Maura -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 tutti i telefonini TIM! [[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.