|
|
|
Gaurav Kumar-7
|
Hi,
I'm new to R and would like to know, how one can populate the list with array data. I'm reading a tab separated table in R. The data in the table looks something like this. #Table Data Comp   A   B   C Extracellular   103   268   535759 Nucleus   45603   47783   442744 #R code myData <- read.table("table.data",             header=T,             sep="\t",             comment.char = "#"             ); inp <- scan("table.data", what=list(comp=" ", A="", B="", C="")); n <- c(0:length(inp$comp)); myList=list(); for(i in n-1) {    obj <-c(as.numeric(myData$A[i]),as.numeric(myData$B[i]),as.numeric(myData$C[i]));    } Need help to know if there is any function in R to push obj to myList    Thanks in advance for your help.    regards Gaurav Kumar www.gauravkumar.org PhD Student, Chemistry and Biomolecular Sciences, Macquarie , Sydney, Australia. MS (Computational Biology), NCBS-TIFR, Bangalore, India. --- On Thu, 9/7/09, [hidden email] <[hidden email]> wrote: From: [hidden email] <[hidden email]> Subject: R-help Digest, Vol 77, Issue 9 To: [hidden email] Date: Thursday, 9 July, 2009, 3:30 PM Send R-help mailing list submissions to    [hidden email] To subscribe or unsubscribe via the World Wide Web, visit    https://stat.ethz.ch/mailman/listinfo/r-help or, via email, send a message with subject or body 'help' to    [hidden email] You can reach the person managing the list at    [hidden email] When replying, please edit your Subject line so it is more specific than "Re: Contents of R-help digest..." Today's Topics:    1. system() how to make a program run a specific file    (Paulo E. Cardoso)    2. RODBC and sqlSave issue (wapita wapita)    3. Re: Dump plots to powerpoint? (Gabor Grothendieck)    4. Re: Dump plots to powerpoint?    (Bengoechea Bartolom? Enrique (SIES 73))    5. Re: system() how to make a program run a specific file    (Paulo E. Cardoso)    6. Re: Fitting a trend-line (Jim Lemon)    7. stats::decompose - Problem finding seasonal component without    trend (Mike HC)    8. Import xlsx file in Ubuntu 9.04 (Rodrigo Aluizio)    9. Re: R 2.9.0 plot still forcing current time zone (jim holtman)  10. Re: How to re-order panels and y-axis values in trellis    display   using lattice (Deepayan Sarkar)  11. linear regression and testing the slope (evrim akar)  12. transform multi skew-t to uniform distribution (Adelchi Azzalini)  13. Re: ReShape to create Time from Observations? (Mark Knecht)  14. R regular expression to extract words with the query string.    (Praveen Surendran)  15. system() how to make a program run a specific file - RUN and    Output directory issues (Paulo E. Cardoso)  16. RDCOMClient: how to close Excel process? (Lauri Nikkinen)  17. Re: RDCOMClient: how to close Excel process?    (Henrique Dallazuanna)  18. Re: linear regression and testing the slope ( (Ted Harding))  19. Re: R regular expression to extract words with the query    string. (Henrique Dallazuanna)  20. Re: RDCOMClient: how to close Excel process? (Lauri Nikkinen)  21. Re: RDCOMClient: how to close Excel process?    (Henrique Dallazuanna)  22. R regular expression to extract words with the query string.    (Praveen Surendran)  23. Re: error: no such index at level 2 (Godmar Back)  24. Re: error: no such index at level 2 (Henrique Dallazuanna)  25. functions to calculate t-stats, etc. for lm.fit objects?    (Whit Armstrong)  26. Re: Import xlsx file in Ubuntu 9.04 (Marc Schwartz)  27. Re: error: no such index at level 2 (Godmar Back)  28. Re: Reading from Google Docs (Farrel Buchinsky)  29. Re: R regular expression to extract words with the query    string. (Jorge Ivan Velez)  30. Re: R regular expression to extract words with the query    string. (Gabor Grothendieck)  31. Re: Reading from Google Docs (Duncan Murdoch)  32. Re: Reading from Google Docs (Farrel Buchinsky)  33. Re: Fitting a trend-line (anupam sinha)  34. truncated regression out-of-sample predictions    (Wouterse, Fleur (IFPRI-Senegal))  35. recoding strings containing colons (Donald Braman)  36. Re: error: no such index at level 2 (Godmar Back)  37. please remove me from this list (Curley, Jane)  38. Re: functions to calculate t-stats, etc. for lm.fit objects?    (Marc Schwartz)  39. Formatting a Table (cvandy)  40. Two-way ANOVA gives different results using anova(lm()) than    doing it by hand (Lars Bergemann)  41. Passing arguments to with() (Tymek Wo?od?ko)  42. Re: functions to calculate t-stats, etc. for lm.fit objects?    (Whit Armstrong)  43. #INCLUDE (Idgarad)  44. Re: Reading from Google Docs (Duncan Murdoch)  45. Re: #INCLUDE (Godmar Back)  46. Comparing GAMMs (Paul Simonin)  47. Re: Passing arguments to with() (Duncan Murdoch)  48. Re: Formatting a Table (Godmar Back)  49. Re: Formatting a Table (David Huffer)  50. Re: Comparing GAMMs (Gavin Simpson)  51. Randomizing a dataframe (Mark Na)  52. Re: error: no such index at level 2 (David Huffer)  53. Re: error: no such index at level 2 (Godmar Back)  54. Re: Reading from Google Docs (Gabor Grothendieck)  55. Re: Uncorrelated random vectors (Greg Snow)  56. Re: #INCLUDE (Andy Zhu)  57. Re: Import xlsx file in Ubuntu 9.04 (Duncan Temple Lang)  58. Re: Randomizing a dataframe (Mark Knecht)  59. Re: Reading from Google Docs (William Dunlap)  60. Re: bigglm() results different from glm()+Another question    (Greg Snow)  61. matching each row (tathta)  62. Extracting a column name in loop? (mister_bluesman)  63. Re: Extracting a column name in loop? (Mark Knecht)  64. Re: Reading from Google Docs (Duncan Murdoch)  65. Simple monovariate classification? ([hidden email])  66. Re: Reading from Google Docs (Farrel Buchinsky)  67. Re: Two-way ANOVA gives different results using anova(lm())    than doing it by hand (Greg Snow)  68. Re: #INCLUDE (John Kane)  69. Re: Two-way ANOVA gives different results using anova(lm())    than doing it by hand (Marc Schwartz)  70. Re: matching each row (David Huffer)  71. Re: Randomizing a dataframe (Greg Snow)  72. Re: Simple monovariate classification? (Greg Hirson)  73. Re: Simple monovariate classification? (Greg Hirson)  74. Re: matching each row (tathta)  75. Re: OK - I got the data - now what? :-) (Michael A. Miller)  76. typo in ts detrending implementation in spec.pgram?    (Mikhail Titov)  77. Re: Reading from Google Docs (Farrel Buchinsky)  78. Re: matching each row (Marc Schwartz)  79. Re: OK - I got the data - now what? :-) (Mark Knecht)  80. \dQuote in packages (Rebecca Sela)  81. Re: truncated regression out-of-sample predictions    (Wouterse, Fleur (IFPRI-Senegal))  82. heatmap.2: question regarding the "raw z-score" (Chrysanthi A.)  83. print() to file? (Steve Jaffe)  84. Re: print() to file? (Greg Snow)  85. Re: Reading from Google Docs (Gabor Grothendieck)  86. Re: matching each row (tathta)  87. bootstrapping error message "Error in t.star[r, ] <-    statistic(data, i[r, ], ...) : number of items to replace is not    a multiple of replacement length" (Karina Boege)  88. Re: Reading from Google Docs (Duncan Murdoch)  89. Re: Reading from Google Docs (Gabor Grothendieck)  90. nested model with random factors (Jeff DaCosta)  91. What is cast telling me? (Mark Knecht)  92. Re: Reading from Google Docs (Duncan Murdoch)  93. Re: matching each row (Marc Schwartz)  94. Re: What is cast telling me? ([hidden email])  95. Re: heatmap.2: question regarding the "raw z-score"    (James W. MacDonald)  96. Re: What is cast telling me? (Mark Knecht)  97. Re: Reading from Google Docs (Gabor Grothendieck)  98. Unix commands on R (suman Duvvuru)  99. rgtk2 colorbutton (Justin Donaldson)  100. Re: R2WinBUGS under Linux/WINE fails (Uwe Ligges)  101. Re: Unix commands on R (Godmar Back)  102. Re: Unix commands on R (Emmanuel Charpentier)  103. Re: system() how to make a program run a specific file - RUN    and   Output directory issues (Uwe Ligges)  104. Re: how to read point shp file to R? (Rolf Turner)  105. truncated regression out-of-sample predictions    (Wouterse, Fleur (IFPRI-Senegal))  106. Re: R2WinBUGS under Linux/WINE fails (Harlan Harris)  107. Re: R2WinBUGS under Linux/WINE fails (Uwe Ligges)  108. Re: \dQuote in packages (Uwe Ligges)  109. R Help Question (Amy Wesolowski)  110. A Lattice Question (Haoda Fu)  111. subsetting a dataframe with a string logical expression    (Tracey Frescino)  112. Substituting numerical values using `apply' (Olivella)  113. Re: Tex fonts in R plots (Paul Murrell)  114. Re: Unix commands on R (Emmanuel Charpentier)  115. Re: Unix commands on R (Zhiliang Ma)  116. Re: Two-way ANOVA gives different results using anova(lm())    than doing it by hand (Zhiliang Ma)  117. How to deploy statistical models built in R in real-time?    (Guazzelli, Alex)  118. Getting value rather than formula in RGoogleDocs    (Farrel Buchinsky)  119. Re: Substituting numerical values using `apply'    (Jorge Ivan Velez)  120. Re: Substituting numerical values using `apply'    (Jorge Ivan Velez)  121. Re: Getting value rather than formula in RGoogleDocs    (Duncan Temple Lang)  122. Re: subsetting a dataframe with a string logical expression    (Henrique Dallazuanna)  123. Re: nested model with random factors (Ben Bolker)  124. Re: R Help Question (jim holtman)  125. tkrplot installation problems (Jason Lessels)  126. Best way to export values from a function? (Jason Rupert)  127. Re: Best way to export values from a function? (jim holtman)  128. Re: Best way to export values from a function? (Daniel Nordlund)  129. Re: Best way to export values from a function? (Mark Knecht)  130. Re: Best way to export values from a function? (Godmar Back)  131. Dantzig Selector (tzygmund mcfarlane)  132. Picante package 0.7 on mac (Alfonso Rojas)  133. Sampling a dataframe based on the length of a subset of    observations within (Eric Vander Wal)  134. Re: \dQuote in packages (Rebecca Sela)  135. Mysteriously vanishing LD_LIBRARY_PATH    ([hidden email])  136. Re: Best way to export values from a function? (Mark Knecht)  137. Re: Mysteriously vanishing LD_LIBRARY_PATH (Godmar Back)  138. Re: Mysteriously vanishing LD_LIBRARY_PATH (Marc Schwartz)  139. Re: Mysteriously vanishing LD_LIBRARY_PATH    ([hidden email])  140. Re: Substituting numerical values using `apply'    (Henrique Dallazuanna)  141. Re: Reading from Google Docs (Duncan Temple Lang)  142. Re: Best way to export values from a function? (William Revelle)  143. Re: Best way to export values from a function? (Steve Lianoglou)  144. change capital to small letters? (wapita wapita)  145. Re: change capital to small letters? (wapita wapita)  146. Re: R regular expression to extract words with the query    string. (Gabor Grothendieck)  147. splint (jlfmssm)  148. Re: R Help Question (Gabor Grothendieck)  149. Re: Reading from Google Docs (Farrel Buchinsky)  150. Save rgl plot3d Graph as Image (Patrick Gedeon)  151. Population pyramids (Victor Manuel Garcia Guerrero)  152. Re: Population pyramids (Jorge Ivan Velez)  153. Re: Population pyramids (Daniel Malter)  154. Re: Population pyramids (Victor Manuel Garcia Guerrero)  155. Converting indices of a matrix subset (Nathan S. Watson-Haigh)  156. Re: Population pyramids (Victor Manuel Garcia Guerrero)  157. Re: Population pyramids (Daniel Malter)  158. Re: RDCOMClient: how to close Excel process? (Lauri Nikkinen)  159. Re: Population pyramids (Victor Manuel Garcia Guerrero)  160. Re: bigglm() results different from glm()+Another question    (utkarshsinghal)  161. Re: Extracting a column name in loop? (Moshe Olshansky)  162. Cuminc Plot (kende jan)  163. Node colors in pvclust (nyk)  164. Re: print() to file? (Moshe Olshansky)  165. Re: error: no such index at level 2 (Petr PIKAL)  166. Re: Mysteriously vanishing LD_LIBRARY_PATH (Patrick Connolly)  167. ggplot2: geom_errorbarh() (Benoit Boulinguiez)  168. Re: Best way to export values from a function? (Petr PIKAL)  169. IIA test (justin bem)  170. Re: heatmap.2: question regarding the "raw z-score"    (Chrysanthi A.)  171. r bug (?) display of data (Marc Jekel)  172. Ordering zoo-object by its index (Sergey Goriatchev)  173. Re: r bug (?) display of data (Peter Dalgaard)  174. Re: r bug (?) display of data (Uwe Ligges) ---------------------------------------------------------------------- Message: 1 Date: Wed, 8 Jul 2009 10:59:08 +0100 From: "Paulo E. Cardoso" <[hidden email]> Subject: [R] system() how to make a program run a specific file To: <[hidden email]> Cc: [hidden email] Message-ID:    <!&![hidden email]>    Content-Type: text/plain I'd like to know how to call a program to run or open a specific file.. something like this: system('"C:\\Program Files (x86)\\IrfanView\\i_view32.exe"','-A:\\ teste.jpg') is not working. any help will be appreciated ____________ Paulo E. Cardoso    [[alternative HTML version deleted]] ------------------------------ Message: 2 Date: Wed, 8 Jul 2009 10:16:50 +0000 From: wapita wapita <[hidden email]> Subject: [R] RODBC and sqlSave issue To: <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain Hello, I contact you after having unsuccessfully asked my question to R mailing list. I use the package RODBC to connect to a MS-SQL server. I am able to getQuery from the database. I am now studying the sqlSave some data into the database. Unfortunetly, I meet some issues relating to the format of the data that arrives into the database. I have three columns. The first one should be in the MS-SQL format "datetime". The second one in the MS-SQL format "varchar(50)", and the third one in the MS-SQl format "numeric(20,8)". I use the following command line: > sqlSave(channel, DF, tablename="essai_global", rownames=FALSE, oldstyle=FALSE) The data is indeed send to the database. But the types are wrong (varchar(255) pour les trois colonnes.) I have then tried to use the varTypes argument, but I do not manage to use it. If I use the following command lines: > varTypes=c("datetime","varchar(50)","numeric(20,8)") > sqlSave(channel, DF, tablename="essai_global", rownames=FALSE, oldstyle=FALSE) I have the following resturn: Warning message: In sqlSave(channel, DF, tablename = "essai_global", rownames = FALSE, :  argument 'varTypes' has no names and will be ignored and the types are still wrong.. How can I use the varTypes??? I have read the documentation, but I dd not manage to find out. Thank you very much Wapita _________________________________________________________________ r ! Téléchargez-le maintenant !    [[alternative HTML version deleted]] ------------------------------ Message: 3 Date: Wed, 8 Jul 2009 06:21:50 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] Dump plots to powerpoint? To: Thomas <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Check out the R2PPT package on CRAN. On Tue, Jul 7, 2009 at 4:38 PM, Thomas<[hidden email]> wrote: > Hi, > > Is it possible to dump a series of plots directly into a powerpoint presentation (as is possible in Splus)? > > Thank you, > Thomas > > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 4 Date: Wed, 8 Jul 2009 12:39:40 +0200 From: Bengoechea Bartolom? Enrique (SIES 73)    <[hidden email]> Subject: Re: [R] Dump plots to powerpoint? To: <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Hi, On windows, you can use a COM client (with packages like rcom or RDCOMClient) to control powerpoint from R and insert the generated image using powerpoint's object model. You can either use the clipboard or an intermediate image file saved to disk. Not hard to do, but this seems to be already implemented in package RPPT recently released to CRAN, so have a look at it: http://stat.ethz.ch/CRAN/web/packages/R2PPT/index.html About the image format, using windows metafiles allows you to double-click the image in powerpoint, "ungroup", and then edit each of its components (text, lines, etc.) Regards, Enrique ------------------------------ Date: Tue, 7 Jul 2009 13:38:48 -0700 (PDT) From: Thomas <[hidden email]> Subject: [R] Dump plots to powerpoint? To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain Hi, Is it possible to dump a series of plots directly into a powerpoint presentation (as is possible in Splus)? Thank you, Thomas       [[alternative HTML version deleted]] ------------------------------ Message: 5 Date: Wed, 8 Jul 2009 12:08:07 +0100 From: "Paulo E. Cardoso" <[hidden email]> Subject: Re: [R] system() how to make a program run a specific file To: <[hidden email]> Cc: [hidden email] Message-ID:    <!&![hidden email]>    Content-Type: text/plain;   charset="us-ascii" After all it's very easy: system(paste('"C:\\Program Files (x86)\\IrfanView\\i_view32.exe"','A:\\test.jpg')) ____________ Paulo E. Cardoso > -----Mensagem original----- > De: [hidden email] [mailto:[hidden email]] > Em nome de Paulo E. Cardoso > Enviada: quarta-feira, 8 de Julho de 2009 10:59 > Para: [hidden email] > Cc: [hidden email] > Assunto: [R] system() how to make a program run a specific file > > I'd like to know how to call a program to run or open a specific file. > > > > something like this: > > system('"C:\\Program Files (x86)\\IrfanView\\i_view32.exe"','-A:\\ > teste.jpg') is not working. > > > > any help will be appreciated > > ____________ > > Paulo E. Cardoso > > > > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.8/2223 - Release Date: > 07/07/09 17:54:00 ------------------------------ Message: 6 Date: Wed, 08 Jul 2009 21:28:07 +1000 From: Jim Lemon <[hidden email]> Subject: Re: [R] Fitting a trend-line To: anupam sinha <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed anupam sinha wrote: > Hi all, >     I am new to R. How does one go about fitting a trend-line to a > scatter plot? Any help is appreciated. > >   Hi Anupam, Have a look at the help page for the abline function in the graphics package. Jim ------------------------------ Message: 7 Date: Wed, 8 Jul 2009 04:31:04 -0700 (PDT) From: Mike HC <[hidden email]> Subject: [R] stats::decompose - Problem finding seasonal component    without trend To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii Hi R-help, I'd like to extract the seasonal component of a short timeseries, and was hoping to use stats::decompose. I don't want to decompose the 'trend' component so I thought I should call decompose(x,filter=0). I think I've either misunderstood the filter argument or come upon a bug/feature in decompose. # EXAMPLE x<-ts(c(2:12,rep(1,12),1:12),start=c(2009,2),frequency=12);x # Starts in Feb #    Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec #2009     2   3   4   5   6   7   8   9 10 11 12 #2010   1   1   1   1   1   1   1   1   1   1   1   1 #2011   1   2   3   4   5   6   7   8   9 10 11 12 decompose(x) #ok, got some answer for seasonal component, but I don't want to split the residual into trend and random. decompose(x,filter=0) #this seems broken, ignoring some of the data in seasonal calculation, and losing some points in the random component # END EXAMPLE I've debug-stepped through decompose and, as far as I can understand the manipulation, it appears to ignore the first and last period. And only the middle 12 points (all 1 in my example) are used in the calculation of the seasonal averages. Unrelated, but it also seems to duplicate one value during the calculation, and throw a warning due to a seemingly unnecessary 'end' argument to window. I can probably get away with using some function like sweep or scale instead, but please let me know if I'm just misusing decompose. If it's a bug, I hope the above helps.. Regards, Mike P.S. I see this comment in the R 2.8.0 release notes: o   HoltWinters() and decompose() use a (statistically) more     efficient computation for seasonal fits (they used to waste     one period). I'm on R 2.80:          _               platform     i386-pc-mingw32        arch       i386            os        mingw32            system      i386, mingw32         status                    major     2               minor     8.0              year       2008            month     10             day      20             svn rev    46754             language     R               version.string R version 2.8.0 (2008-10-20) -- View this message in context: http://www.nabble.com/stats%3A%3Adecompose----Problem-finding-seasonal-component-without-trend-tp24389771p24389771.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 8 Date: Wed, 8 Jul 2009 08:56:48 -0300 From: Rodrigo Aluizio <[hidden email]> Subject: [R] Import xlsx file in Ubuntu 9.04 To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hi list, By the entire last 2 weeks I was looking for a way to directly import xlsx files to R in a Linux OS (Ubuntu 9.04). I already read the R Import/Export guide, and I know how to use gdata to import xls files and read.table to import .csv. My problem is that all data that I receive is in the xlsx format, and I have to convert all the files to xls. Well, when I was using Windows Vista OS, RODBC did the trick with the odbcConnectExcel2007 function (which I know is not present in the Linux RODBC package, probably due to drivers issue). Isn't there a way to import this xlsx files directly to R without any previous conversion (.csv or ..xls)? Thank you for the attention, it's probable that some one already asked it. I even remember seen that somewhere, but without a definitive answer. Rodrigo.    [[alternative HTML version deleted]] ------------------------------ Message: 9 Date: Wed, 8 Jul 2009 08:08:55 -0400 From: jim holtman <[hidden email]> Subject: Re: [R] R 2.9.0 plot still forcing current time zone To: Britton Stephens <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Try this: set the timezone to what you want before plotting: > tzsave <- Sys.getenv("TZ") # save current > Sys.setenv(TZ="GMT") # set to whatever > plot(x,rep(1,11)) # plot > Sys.setenv(TZ=tzsave) # restore > plot(x,rep(1,11)) # plot in original time zone On Wed, Jul 8, 2009 at 2:21 AM, Britton Stephens<[hidden email]> wrote: > the help page for plot.POSIXct says > > "As from R 2.9.0 the date-times for a '"POSIXct"' input are > ? ?interpreted in the timwzonw give by the '"tzone"' attribute it > ? ?there is one, otherwise the current timezone. ?(Earlier vrsions > ? ?always used the current timezone.)" > > however I am using 2.9.0 on linux and the following still happily produces > an x-axis in local (MDT) time > >> x=strptime(paste('09-01-01 00:00:00',sep=''),format='%y-%m-%d >> %H:%M:%S',tz="GMT")+60*60*24*(seq(0.5,1.5,.1)) >> x > [1] "2009-01-01 12:00:00 GMT" "2009-01-01 14:24:00 GMT" > [3] "2009-01-01 16:48:00 GMT" "2009-01-01 19:12:00 GMT" > [5] "2009-01-01 21:36:00 GMT" "2009-01-02 00:00:00 GMT" > [7] "2009-01-02 02:24:00 GMT" "2009-01-02 04:48:00 GMT" > [9] "2009-01-02 07:12:00 GMT" "2009-01-02 09:36:00 GMT" > [11] "2009-01-02 12:00:00 GMT" >> attributes(x) > $class > [1] "POSIXt" ?"POSIXct" > > $tzone > [1] "GMT" > >> plot(x,rep(1,11)) > > Britt > > -- > Britton B. Stephens > National Center for Atmospheric Research > P.O. Box 3000, 1850 Table Mesa Drive > Boulder, CO ?80307-3000 > Phone: (303) 497-1018 > Fax: (303) 497-1092 > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/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? ------------------------------ Message: 10 Date: Wed, 8 Jul 2009 05:20:49 -0700 From: Deepayan Sarkar <[hidden email]> Subject: Re: [R] How to re-order panels and y-axis values in trellis    display   using lattice To: [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Tue, Jul 7, 2009 at 3:03 PM, <[hidden email]> wrote: > Hi, > > I have been trying to re-order several items in a trellised barchart > display in lattice, but can't seem to figure it out. > > ###sample code, Stage and Colony have 2 and 3 levels respectively. > > barchart(Activity ~ Percent | Stage + Colony, data = Percent.df, > ?horizontal = TRUE, layout = c(2,3), > ?xlab = "Percent Time Engaged in Activity", > ?ylab = "Activity") > > This essentially produces the display I would like, only I would like to > have the second column first and the first and third panels switched. ?In > addition, I would like to re-order the y-axis labels ("Activities") so > that they are in alphabetical order starting with A at the top...currently > A is at the bottom. ?I have been able to switch the actual data in the > panels useing barchart(rev(Activity~ Percent...but cannot get the actual > labels to switch. ?Thanks in advance. ordering is determined by the levels, which are by default ordered lexically for character vectors, but can be specified manually, e.g. factor(Activity, levels = rev(sort(unique(Activity))) For the first question, there is a shortcut to reorder levels of conditioning variables: p <- barchart(Activity ~ Percent | Stage + Colony, data = Percent.df, ...) p[, c(2, 3, 1)] -Deepayan ------------------------------ Message: 11 Date: Wed, 8 Jul 2009 14:29:40 +0200 From: evrim akar <[hidden email]> Subject: [R] linear regression and testing the slope To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Dear All, First of all I would like to say I do not have much knowledge about this subject, so most of you can find it really easy. I am doing a linear regression and I want to test if the slope of the curve is 0. R gives the summary statistics: Call: lm(formula = x ~ s) Residuals:    Min    1Q  Median    3Q     Max -0.025096 -0.020316 -0.001203 0.011658 0.044970 Coefficients:         Estimate Std. Error t value Pr(>|t|) (Intercept) 0.005567   0.016950   0.328  0.750 s       -0.001599   0..002499 -0.640  0.538 Residual standard error: 0.02621 on 9 degrees of freedom Multiple R-squared: 0.04352,  Adjusted R-squared: -0.06276 F-statistic: 0.4095 on 1 and 9 DF, p-value: 0.5382 what is this t-value for? The explanation in the help file was unfortunately not clear to me. How can I test my hypotheses that if the slope is 0? Thank you in advance, regards, Evrim    [[alternative HTML version deleted]] ------------------------------ Message: 12 Date: Wed, 8 Jul 2009 14:40:39 +0200 From: Adelchi Azzalini <[hidden email]> Subject: [R] transform multi skew-t to uniform distribution Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 RHRPO> RHRPO> Hi R-users, RHRPO> _I have a data from multi skew t and would like to transform each of the data to uniform data._ I tried using 'pmst' but only got one output: RHRPO> _ RHRPO> > rr1 <- as.vector(r1);rr1 RHRPO> _[1]_ 0.7207582_ 5.2250906_ 1.7422237_ 0.5677233_ 0.7473555 -0.6020626 -2.1947872 -1.1128313 -0.6587316 -1.1409261 RHRPO> _ RHRPO> _ RHRPO> > pmst(rr1, xi=rep(0,10), Omega=diag(10), alpha=rep(1,10), df=5) RHRPO> [1] 3.676525e-09 you are computing a 10-dimensional distribution function at a a 10-dimensional point; so you get a single number out -- this is as expected. I presume that actually you want to compute a 1-dimensional distribution at 10 different points, which is achieved by    pst(rr1, dp=c(0,1,1,5)) [1] 0.564580 0.996707 0.867177 0.497123 0.575915 0.085922 0.004127 0.030807 [9] 0.076839 0.029117 Best regards, Adelchi Azzalini -- Adelchi Azzalini <[hidden email]> Dipart.Scienze Statistiche, Universit? di Padova, Italia tel. +39 049 8274147, http://azzalini.stat.unipd.it/ ------------------------------ Message: 13 Date: Wed, 8 Jul 2009 06:02:04 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] ReShape to create Time from Observations? To: jim holtman <[hidden email]> Cc: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Tue, Jul 7, 2009 at 4:22 PM, jim holtman<[hidden email]> wrote: > Does something like this work for you; ?it uses the reshape package: > >> X<-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12, > + Ob4=4:13, Ob5=3:12, Ob6=2:11) >> Y<-data.frame(A=1:20, B=0, C=1, D=5, Ob1=1:10, Ob2=2:11, Ob3=3:12, > + Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=5:9) >> Z<-data.frame(A=1:30, B=0, C=1, D=6, E=1:2, Ob1=1:10, Ob2=2:11, > + Ob3=3:12, Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=1:10, Ob8=3:12) >> >> f.melt <- > + function(df) > + { > + ? ? # get the starting column number of "Ob1", then extend for rest of columns > + ? ? require(reshape) > + ? ? melt(df, measure=seq(match("Ob1", names(df)), ncol(df))) > + } >> x.m <- f.melt(X) >> y.m <- f.melt(Y) >> z.m <- f.melt(Z) >> >> # sample data >> head(x.m, 20) > ? ?A B C variable value > 1 ? 1 0 1 ? ? ?Ob1 ? ? 1 > 2 ? 2 0 1 ? ? ?Ob1 ? ? 2 > 3 ? 3 0 1 ? ? ?Ob1 ? ? 3 > 4 ? 4 0 1 ? ? ?Ob1 ? ? 4 > 5 ? 5 0 1 ? ? ?Ob1 ? ? 5 > 6 ? 6 0 1 ? ? ?Ob1 ? ? 6 > 7 ? 7 0 1 ? ? ?Ob1 ? ? 7 > 8 ? 8 0 1 ? ? ?Ob1 ? ? 8 > 9 ? 9 0 1 ? ? ?Ob1 ? ? 9 > 10 10 0 1 ? ? ?Ob1 ? ?10 > 11 ?1 0 1 ? ? ?Ob2 ? ? 2 > 12 ?2 0 1 ? ? ?Ob2 ? ? 3 > 13 ?3 0 1 ? ? ?Ob2 ? ? 4 > 14 ?4 0 1 ? ? ?Ob2 ? ? 5 > 15 ?5 0 1 ? ? ?Ob2 ? ? 6 > 16 ?6 0 1 ? ? ?Ob2 ? ? 7 > 17 ?7 0 1 ? ? ?Ob2 ? ? 8 > 18 ?8 0 1 ? ? ?Ob2 ? ? 9 > 19 ?9 0 1 ? ? ?Ob2 ? ?10 > 20 10 0 1 ? ? ?Ob2 ? ?11 >> Jim,    It wasn't exactly what I was looking for but I think the ideas plus a bit of off-list help from another member helped me get much closer. The idea of using match is very helpful in my case because I'm able to leverage the fact that in my data files everything to the right is also an observation to easily create list to the end of the row. Try the following: X<-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12,Ob4=4:13, Ob5=3:12, Ob6=2:11) BrkPnt<-match("Ob1",names(X)) Ob_Group <- list(names(X)[BrkPnt:ncol(X)]) # Give to reshape to turn ObX into time answerX1<- reshape(X, varying=Ob_Group, direction='long') and at this point I can subset based on id or some other variable: subset(answerX1, A==1)   A B C time Ob1 id 1.1 1 0 1  1   1 1 1.2 1 0 1  2   2 1 1.3 1 0 1  3   3 1 1.4 1 0 1  4   4 1 1.5 1 0 1  5   3 1 1.6 1 0 1  6   2 1    I *think* this is data that I can sent to matplot/qplot and get charts that I'm interested in. I'll work on that today to verify but it looks about right to me using this simple case: PlotData<-subset(answerX1, A==1) matplot(PlotData$time,PlotData$Ob1)    I really like the match idea. The first observation should generally be in about the first 20 columns of my files which can potentially be thousands of columns wide. There's no reason in my case to match every other column to the right as I already know they will match. I can get a list of all the observations with BrkPnt:ncol(X) or all the independent variables using 1:BrkPnt-1. I could also, if I chose, extract a specific group of observations by matching Ob20 and Ob40 to potentially find observations taken in a certain time period [[elided Yahoo spam]]    I'll put it back in a function as you did for use in my actual code. Cheers, Mark > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > ------------------------------ Message: 14 Date: Wed, 08 Jul 2009 14:04:41 +0100 From: Praveen Surendran <[hidden email]> Subject: [R] R regular expression to extract words with the query    string. To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain Hi, Is there a way in R to get the string which matches the expression, where the expression is a substring of the parent string. Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" What I need is the string "pid:ENSP000012345" from $i using the query "ENSP". Appreciate your comments. Praveen Surendran School of Medicine and Medical Sciences University College Dublin Belfiled, Dublin 4 Ireland.    [[alternative HTML version deleted]] ------------------------------ Message: 15 Date: Wed, 8 Jul 2009 14:06:25 +0100 From: "Paulo E. Cardoso" <[hidden email]> Subject: [R] system() how to make a program run a specific file - RUN    and   Output directory issues To: <[hidden email]> Cc: [hidden email] Message-ID:    <!&![hidden email]>    Content-Type: text/plain;   charset="us-ascii" I have a particular case where the program I'm calling needs a additional instructions, to click a RUN button and set a output directory. Could these options be controlled with system() function? ____________ Paulo E. Cardoso > -----Mensagem original----- > De: [hidden email] [mailto:[hidden email]] > Em nome de Paulo E. Cardoso > Enviada: quarta-feira, 8 de Julho de 2009 12:08 > Para: [hidden email] > Cc: [hidden email] > Assunto: Re: [R] system() how to make a program run a specific file > > After all it's very easy: > > system(paste('"C:\\Program Files > (x86)\\IrfanView\\i_view32.exe"','A:\\test.jpg')) > > ____________ > Paulo E. Cardoso > > > > -----Mensagem original----- > > De: [hidden email] [mailto:r-help-bounces@r- > project.org] > > Em nome de Paulo E. Cardoso > > Enviada: quarta-feira, 8 de Julho de 2009 10:59 > > Para: [hidden email] > > Cc: [hidden email] > > Assunto: [R] system() how to make a program run a specific file > > > > I'd like to know how to call a program to run or open a specific > file. > > > > > > > > something like this: > > > > system('"C:\\Program Files (x86)\\IrfanView\\i_view32.exe"','-A:\\ > > teste.jpg') is not working. > > > > > > > > any help will be appreciated > > > > ____________ > > > > Paulo E. Cardoso > > > > > > > > > >    [[alternative HTML version deleted]] > > > > ______________________________________________ > > [hidden email] mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > > guide.html > > and provide commented, minimal, self-contained, reproducible code. > > Checked by AVG - www.avg.com > > Version: 8.5.375 / Virus Database: 270.13.8/2223 - Release Date: > > 07/07/09 17:54:00 > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.8/2223 - Release Date: > 07/07/09 17:54:00 ------------------------------ Message: 16 Date: Wed, 8 Jul 2009 16:06:57 +0300 From: Lauri Nikkinen <[hidden email]> Subject: [R] RDCOMClient: how to close Excel process? To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 Hi, I?m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) to retrieve data from MS Excel workbook. I?m using the code below to count the number of sheets in the workbook and then loop the data from sheets in to a list. ############# R code ################### library(gdata) library(RDCOMClient) xl <- COMCreate("Excel.Application") sh <- xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() DF.list <- list() for (i in 1:sh) {    DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, stringsAsFactors = FALSE)    } ###################################### COMCreate opens Excel process and it can be seen from Windows Task Manager. When I try to open sample_file.xls in Excel, it just flashes in the screen and shuts down. When I kill (via task manager) the Excel process COMCreate started, sample_file.xls will open normally. The question is, how can I close the Excel process COMCreate started. xl$Close() doesn?t seem to work. The same problem have been presented in this post to R-help: http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html -L ------------------------------ Message: 17 Date: Wed, 8 Jul 2009 10:11:11 -0300 From: Henrique Dallazuanna <[hidden email]> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Lauri Nikkinen <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Try this: xl$Quit() On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <[hidden email]>wrote: > Hi, > > Iâm using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) > to retrieve data from MS Excel workbook. Iâm using the code below to > count the number of sheets in the workbook and then loop the data from > sheets in to a list. > > ############# R code ################### > library(gdata) > library(RDCOMClient) > > xl <- COMCreate("Excel.Application") > sh <- > xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > > DF.list <- list() > for (i in 1:sh) { >   DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, > stringsAsFactors = FALSE) >   } > ###################################### > > COMCreate opens Excel process and it can be seen from Windows Task > Manager. When I try to open sample_file.xls in Excel, it just flashes > in the screen and shuts down. When I kill (via task manager) the Excel > process COMCreate started, sample_file.xls will open normally. > > The question is, how can I close the Excel process COMCreate started. > xl$Close() doesnât seem to work. The same problem have been presented > in this post to R-help: > http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html > > -L > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 18 Date: Wed, 08 Jul 2009 14:17:55 +0100 (BST) From: (Ted Harding) <[hidden email]> Subject: Re: [R] linear regression and testing the slope To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=iso-8859-1 On 08-Jul-09 12:29:40, evrim akar wrote: > Dear All, > First of all I would like to say I do not have much knowledge > about this subject, so most of you can find it really easy. > I am doing a linear regression and I want to test if the slope > of the curve is 0. R gives the summary statistics: > > Call: > lm(formula = x ~ s) > > Residuals: >     Min    1Q  Median    3Q     Max > -0.025096 -0.020316 -0.001203 0.011658 0.044970 > > Coefficients: >       Estimate Std. Error t value Pr(>|t|) > (Intercept) 0.005567   0.016950   0.328  0.750 > s       -0.001599   0.002499 -0.640  0.538 > > Residual standard error: 0.02621 on 9 degrees of freedom > Multiple R-squared: 0.04352,  Adjusted R-squared: -0.06276 > F-statistic: 0.4095 on 1 and 9 DF, p-value: 0.5382 > > what is this t-value for? The explanation in the help file was > unfortunately not clear to me. How can I test my hypotheses that > if the slope is 0? > > Thank you in advance, > regards, > Evrim divided by its estimated standard error (0.002499). Taking the values as reported by the summary:  t = -0.001599/0.002499 = -0.639856 which R has reported (to 3 significant figures) as -0.640 The "Pr(>|t|)" is the probability, assuming the null hypothesis that the slope (coefficient of 's') is zero, that data could arise at random giving rise to a t-value which, in absolute value, would exceed the absolute value |t| = |-0.639856| = 0.639856 which you got from your data. The relevance of this for testing the hypothesis that the slope is 0 is that, if the slope really is 0, then large values (either way) of the coefficient of 's' (reported by R as "Estimate") are unlikely. So if you got a value of "Pr(>|t|)" which was small (conventionally less that 0.05, or 0.01, etc.) then you would have a value so large that getting a value at least as large as this if the hypothesis were true would be unlikely. Therefore it would be more plausible that the null hypothesis was false. In your case, the "P-value" Pr(>|t|) = 0.538, so you would be more likely than not to get an estimate at least as deviant from 0 as the one you did get, if the null hypothesis were true. Hence the data do not provide grounds for rejecting the null hypothesis. Note that not having grounds for rejection does not mean that you must accept it: a "non-signifcant" t-value is not proof that the null hypothesis is true. There is a good basic outline of the t-test in the Wikipedia article "Student's t-test":  http://en.wikipedia.org/wiki/Student%27s_t-test Hoping this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[hidden email]> Fax-to-email: +44 (0)870 094 0861 Date: 08-Jul-09                     Time: 14:17:52 ------------------------------ XFMail ------------------------------ ------------------------------ Message: 19 Date: Wed, 8 Jul 2009 10:18:01 -0300 From: Henrique Dallazuanna <[hidden email]> Subject: Re: [R] R regular expression to extract words with the query    string. To: [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Try this: sapply(strsplit(i, ' '), grep, pattern='ENSP', value = T) On Wed, Jul 8, 2009 at 10:04 AM, Praveen Surendran <[hidden email] > wrote: > Hi, > > > > Is there a way in R to get the string which matches the expression, where > the expression is a substring of the parent string. > > > > Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" > > What I need is the string "pid:ENSP000012345" from $i using the query > "ENSP". > > > > Appreciate your comments. > > > > Praveen Surendran > > School of Medicine and Medical Sciences > > University College Dublin > > Belfiled, Dublin 4 > > Ireland. > > > > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 20 Date: Wed, 8 Jul 2009 16:19:12 +0300 From: Lauri Nikkinen <[hidden email]> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Henrique Dallazuanna <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 Thanks but that did not work. xl$Quit() does not kill the Excel process and sample_file.xls will not open. I'm using Windows XP SP2 and R 2.8.1 -L 2009/7/8 Henrique Dallazuanna <[hidden email]>: > Try this: > > xl$Quit() > > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <[hidden email]> > wrote: >> >> Hi, >> >> I?m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) >> to retrieve data from MS Excel workbook. I?m using the code below to >> count the number of sheets in the workbook and then loop the data from >> sheets in to a list. >> >> ############# R code ################### >> library(gdata) >> library(RDCOMClient) >> >> xl <- COMCreate("Excel.Application") >> sh <- >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> DF.list <- list() >> for (i in 1:sh) { >> ? DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, >> stringsAsFactors = FALSE) >> ? } >> ###################################### >> >> COMCreate opens Excel process and it can be seen from Windows Task >> Manager. When I try to open sample_file.xls in Excel, it just flashes >> in the screen and shuts down. When I kill (via task manager) the Excel >> process COMCreate started, sample_file.xls will open normally. >> >> The question is, how can I close the Excel process COMCreate started. >> xl$Close() doesn?t seem to work. The same problem have been presented >> in this post to R-help: >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html >> >> -L >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > > > -- > Henrique Dallazuanna > Curitiba-Paran?-Brasil > 25? 25' 40" S 49? 16' 22" O > ------------------------------ Message: 21 Date: Wed, 8 Jul 2009 10:24:15 -0300 From: Henrique Dallazuanna <[hidden email]> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Lauri Nikkinen <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Then, you can try this: xl <- COMCreate("Excel.Application") wk <- xl$Workbooks() sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() wk$Close() xl$Quit() On Wed, Jul 8, 2009 at 10:19 AM, Lauri Nikkinen <[hidden email]>wrote: > Thanks but that did not work. xl$Quit() does not kill the Excel > process and sample_file.xls will not open. > > I'm using Windows XP SP2 and R 2.8.1 > > -L > > 2009/7/8 Henrique Dallazuanna <[hidden email]>: > > Try this: > > > > xl$Quit() > > > > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <[hidden email]> > > wrote: > >> > >> Hi, > >> > >> Iâm using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) > >> to retrieve data from MS Excel workbook. Iâm using the code below to > >> count the number of sheets in the workbook and then loop the data from > >> sheets in to a list. > >> > >> ############# R code ################### > >> library(gdata) > >> library(RDCOMClient) > >> > >> xl <- COMCreate("Excel.Application") > >> sh <- > >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > >> > >> DF.list <- list() > >> for (i in 1:sh) { > >>   DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, > >> stringsAsFactors = FALSE) > >>   } > >> ###################################### > >> > >> COMCreate opens Excel process and it can be seen from Windows Task > >> Manager. When I try to open sample_file.xls in Excel, it just flashes > >> in the screen and shuts down. When I kill (via task manager) the Excel > >> process COMCreate started, sample_file.xls will open normally. > >> > >> The question is, how can I close the Excel process COMCreate started. > >> xl$Close() doesnât seem to work. The same problem have been presented > >> in this post to R-help: > >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html > >> > >> -L > >> > >> ______________________________________________ > >> [hidden email] mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > > > > > > > -- > > Henrique Dallazuanna > > Curitiba-Paraná-Brasil > > 25° 25' 40" S 49° 16' 22" O > > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 22 Date: Wed, 08 Jul 2009 14:27:19 +0100 From: Praveen Surendran <[hidden email]> Subject: [R] R regular expression to extract words with the query    string. To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain Thanks Henrique. This is indeed short and quite simple compared to what I was using which goes like... unlist(strsplit(i,split=" "))[grep("ENSP",unlist(strsplit(i,split=" ")))] J Cheers, Praveen. From: Henrique Dallazuanna [mailto:[hidden email]] Sent: 08 July 2009 14:18 To: [hidden email] Cc: [hidden email] Subject: Re: [R] R regular expression to extract words with the query string. Try this: sapply(strsplit(i, ' '), grep, pattern='ENSP', value = T) On Wed, Jul 8, 2009 at 10:04 AM, Praveen Surendran <[hidden email]> wrote: Hi, Is there a way in R to get the string which matches the expression, where the expression is a substring of the parent string. Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" What I need is the string "pid:ENSP000012345" from $i using the query "ENSP". Appreciate your comments. Praveen Surendran School of Medicine and Medical Sciences University College Dublin Belfiled, Dublin 4 Ireland.      [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 23 Date: Wed, 8 Jul 2009 09:28:50 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: Petr PIKAL <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL <[hidden email]> wrote: > Hi > > [hidden email] napsal dne 07.07.2009 19:06:17: > > > Hi, > > > > I am confused about how to select elements from a list. > > > > I'm trying to select all rows of a table 'crossRsorted' such that the > > mean of a related vector is > 0. The related vector is accessible as > > a list element l[[i]] where i is the row index. > > > > I thought this would work: > > > > > crossRsorted[mean(q[[ crossRsorted[,1] ]], na.rm = TRUE) > 0, ] > > Error in q[[crossRsorted[, 1]]] : no such index at level 2 > > Strange, I got completely different error. Couldn't be that only ***you*** > have crossRsorted? Ok, fair enough. I'm still thinking of a language in which the meaning of operators is apparent from their syntactical structure - probably need to read more of "The R Inferno". Here's an example that reproduces the problem, I think (though the error message is slightly different): > q<-list() > q[[105]] <- as.numeric(c(0,0,1)) > q[[104]] <- as.numeric(c(1,1,1)) > q[[10]] <- as.integer(c(3,3,1)) > crossRsorted <- data.frame(i = c(105, 104,10)) > q[[ crossRsorted[,1] ]] Error in q[[crossRsorted[, 1]]] : recursive indexing failed at level 2 Even though the list 'q' has component 105, 104, and 10, the expression q[[ crossRsorted[,1] ]] causes an error. Why? And why does this work: > q[[c(105)]] [1] 0 0 1 but not this: > q[[c(105,104)]] Error in q[[c(105, 104)]] : subscript out of bounds > q[[c(105,104,10)]] Error in q[[c(105, 104, 10)]] : recursive indexing failed at level 2 even though q[[105]], q[[104], and q[[10]] are perfectly legitimate items? Coming back to my question, how to I express "select all i in a vector for which q[[i]] meets some predicate, where q is a list?" Thank you for the tip about 'str' - that's the typeof function I've been craving. (I thought 'attributes' or 'summary' was all there was...) The output for str in the original problem: In my original problem, the output is: > str(crossRsorted) 'data.frame':   15750 obs. of 5 variables: $ i    : num 105 104 9 8 10 9 98 97 10 8 ... $ j    : num 104 105 8 9 9 10 97 98 8 10 ... $ r    : num -0.973 -0.973 0.764 0.764 0.744 .... $ n    : num 135 135 138 138 138 138 136 136 138 138 ... $ pvalue: num 2.90e-86 2.90e-86 0.00 0.00 0.00 ... and > str(q) List of 165 $ : NULL $ : NULL $ : NULL $ : NULL $ :'data.frame':     138 obs. of 1 variable:  ..$ howdidyouhear: chr [1:138] "0 3" "3" "3" "3" ... $ :'data.frame':     138 obs. of 1 variable:  ..$ approximatelywhendidyoustart: int [1:138] 0 0 5 1 5 5 1 2 6 0 .... [ main body deleted ] $ :'data.frame':     138 obs. of 1 variable:  ..$ revisiontestpage: num [1:138] 0 0 0 0 0 0 0 0 0 0 ... basically - a heterogeneous sparse list of NULL and data.frames of types character, num, and int. However - by construction - the q[[i]] for i in crossRsorted[,1] are all non-NULL, as in my small reproducible example above. with data frame and list > > df1[sapply(list1,mean)>0,] > > selects rows of df1 which correspond to list elements with mean >0 > I can't run 'sapply' over my list because sapply will also iterate over the NULLs. I want to access only those components in list1 that occur in df1[1,]. - Godmar    [[alternative HTML version deleted]] ------------------------------ Message: 24 Date: Wed, 8 Jul 2009 10:40:06 -0300 From: Henrique Dallazuanna <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: Godmar Back <[hidden email]> Cc: [hidden email], Petr PIKAL <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain Its because '[[' accept only element, so you need use '[': q[crossRsorted[,1]] On Wed, Jul 8, 2009 at 10:28 AM, Godmar Back <[hidden email]> wrote: > On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL <[hidden email]> wrote: > > > Hi > > > > [hidden email] napsal dne 07.07.2009 19:06:17: > > > > > Hi, > > > > > > I am confused about how to select elements from a list. > > > > > > I'm trying to select all rows of a table 'crossRsorted' such that the > > > mean of a related vector is > 0. The related vector is accessible as > > > a list element l[[i]] where i is the row index. > > > > > > I thought this would work: > > > > > > > crossRsorted[mean(q[[ crossRsorted[,1] ]], na.rm = TRUE) > 0, ] > > > Error in q[[crossRsorted[, 1]]] : no such index at level 2 > > > > Strange, I got completely different error. Couldn't be that only > ***you*** > > have crossRsorted? > > > Ok, fair enough. I'm still thinking of a language in which the meaning of > operators is apparent from their syntactical structure - probably need to > read more of "The R Inferno". > > Here's an example that reproduces the problem, I think (though the error > message is slightly different): > > > q<-list() > > q[[105]] <- as.numeric(c(0,0,1)) > > q[[104]] <- as.numeric(c(1,1,1)) > > q[[10]] <- as.integer(c(3,3,1)) > > crossRsorted <- data.frame(i = c(105, 104,10)) > > q[[ crossRsorted[,1] ]] > Error in q[[crossRsorted[, 1]]] : recursive indexing failed at level 2 > > Even though the list 'q' has component 105, 104, and 10, the expression q[[ > crossRsorted[,1] ]] causes an error. > Why? > > And why does this work: > > > q[[c(105)]] > [1] 0 0 1 > > but not this: > > > q[[c(105,104)]] > Error in q[[c(105, 104)]] : subscript out of bounds > > q[[c(105,104,10)]] > Error in q[[c(105, 104, 10)]] : recursive indexing failed at level 2 > > even though q[[105]], q[[104], and q[[10]] are perfectly legitimate items? > > Coming back to my question, how to I express "select all i in a vector for > which q[[i]] meets some predicate, where q is a list?" > > Thank you for the tip about 'str' - that's the typeof function I've been > craving. (I thought 'attributes' or 'summary' was all there was...) > The output for str in the original problem: > > In my original problem, the output is: > > > > str(crossRsorted) > 'data.frame':   15750 obs. of 5 variables: > $ i    : num 105 104 9 8 10 9 98 97 10 8 ... > $ j    : num 104 105 8 9 9 10 97 98 8 10 ... > $ r    : num -0.973 -0.973 0.764 0.764 0..744 ... > $ n    : num 135 135 138 138 138 138 136 136 138 138 ... > $ pvalue: num 2.90e-86 2.90e-86 0.00 0.00 0.00 ... > > and > > > str(q) > List of 165 > $ : NULL > $ : NULL > $ : NULL > $ : NULL > $ :'data.frame':     138 obs. of 1 variable: > ..$ howdidyouhear: chr [1:138] "0 3" "3" "3" "3" ... > $ :'data.frame':     138 obs. of 1 variable: > ..$ approximatelywhendidyoustart: int [1:138] 0 0 5 1 5 5 1 2 6 0 .... > [ main body deleted ] > $ :'data.frame':     138 obs. of 1 variable: > ..$ revisiontestpage: num [1:138] 0 0 0 0 0 0 0 0 0 0 ... > > basically - a heterogeneous sparse list of NULL and data.frames of types > character, num, and int. > > However - by construction - the q[[i]] for i in crossRsorted[,1] are all > non-NULL, as in my small reproducible example above. > > with data frame and list > > > > df1[sapply(list1,mean)>0,] > > > > selects rows of df1 which correspond to list elements with mean >0 > > > > I can't run 'sapply' over my list because sapply will also iterate over the > NULLs. I want to access only those components in list1 that occur in > df1[1,]. > > - Godmar > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 25 Date: Wed, 8 Jul 2009 09:51:21 -0400 From: Whit Armstrong <[hidden email]> Subject: [R] functions to calculate t-stats, etc. for lm.fit objects? To: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 I'm running a huge number of regressions in a loop, so I tried lm.fit for a speedup. However, I would like to be able to calculate the t-stats for the coefficients. Does anyone have some functions for calculating the regression summary stats of an lm.fit object? Thanks, Whit ------------------------------ Message: 26 Date: Wed, 08 Jul 2009 08:57:47 -0500 From: Marc Schwartz <[hidden email]> Subject: Re: [R] Import xlsx file in Ubuntu 9.04 To: Rodrigo Aluizio <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Jul 8, 2009, at 6:56 AM, Rodrigo Aluizio wrote: > Hi list, > By the entire last 2 weeks I was looking for a way to directly > import xlsx > files to R in a Linux OS (Ubuntu 9.04). I already read the R Import/ > Export > guide, and I know how to use gdata to import xls files and > read.table to > import .csv. My problem is that all data that I receive is in the xlsx > format, and I have to convert all the files to xls. > Well, when I was using Windows Vista OS, RODBC did the trick with the > odbcConnectExcel2007 function (which I know is not present in the > Linux > RODBC package, probably due to drivers issue). Isn't there a way to > import > this xlsx files directly to R without any previous conversion (.csv or > .xls)? > > Thank you for the attention, it's probable that some one already > asked it. I > even remember seen that somewhere, but without a definitive answer. > > Rodrigo. Your best bet on Linux would be to open the Excel 2007 files using OpenOffice's Calc and save them to CSV files. The latest versions of OpenOffice will open Office 2007 files. An alternative of course would be to see if it is reasonable for the providers of the files to save them in the older XLS format instead, or to see if they have other file formats that they can send you rather than using Excel at all. There is a very preliminary Perl module in progress, that should eventually provide for a more efficient path:    http://search.cpan.org/dist/Spreadsheet-XLSX/ But from what I have seen, there are enough problems with it (including data integrity issues), that I would not use it in production work. Unfortunately, I don't believe that you have a lot of options on Linux at the moment. HTH, Marc Schwartz ------------------------------ Message: 27 Date: Wed, 8 Jul 2009 09:58:03 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: Henrique Dallazuanna <[hidden email]> Cc: [hidden email], Petr PIKAL <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <[hidden email]>wrote: > Its because '[[' accept only element, so you need use '[': > > q[crossRsorted[,1]] > This appears to be doing something different. For instance, my 'q' has 165 components, but what you suggest has 15750: > length(q) [1] 165 > length(q[ crossRsorted[,1] ]) [1] 15750 hardly what I want. Meanwhile, it looks as though [[ ]] does not vectorize its arguments, it curries them! Note that: > q[[c(105,104)]] Error in q[[c(105, 104)]] : subscript out of bounds gives the same error as: > q[[105]][[104]] Error in q[[105]][[104]] : subscript out of bounds Very mysterious, though, in all fairness, explained in help("[[") where it says:     '[[' can be applied recursively to lists, so that if the single     index 'i' is a vector of length 'p', 'alist[[i]]' is equivalent to     'alist[[i1]]...[[ip]]' providing all but the final indexing     results in a list. which leads to square one: how to express "select all r[i] where q[[i]] fulfills some predicate?" - Godmar    [[alternative HTML version deleted]] ------------------------------ Message: 28 Date: Wed, 8 Jul 2009 10:02:09 -0400 From: Farrel Buchinsky <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Uwe Ligges <[hidden email]> Cc: R <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain I have previously read "R Installation and Administration". I read it again. It does not help me The relevant paragraph is below. But I need lower level instructions. Where can I find them. R CMD INSTALL works in Windows to install source packages if you have the source-code package files (option âSource Package Installation Filesâ in the installer) and toolset (see The Windows toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) installed. Installation of binary packages must be done by install.packages .. R CMD INSTALL --help will tell you the current options under Windows (which differ from those on a Unix-alike): in particular there is a choice of the types of documentation to be installed. Farrel Buchinsky Google Voice Tel: (412) 567-7870 2009/6/19 Uwe Ligges <[hidden email]> > See the manual "R Installation and Administration" for information on how > to install source packages on Windows. > > Uwe Ligges > > Farrel Buchinsky wrote: > >> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an error >> >> message >> 'tar' is not recongnized as an internal or external command, operable >> program or batch file. >> >> Should I use my 7-zip to open up the archive? >> Where should I be doing this? For instance can I do it all in my >> download directory or should I do it in C:\Program >> Files\R\R-2.9.0\library or should I manually create C:\Program >> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the Rcmd >> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >> >> Yes, you assumed correctly. I am using Windows XP. >> Farrel Buchinsky >> Google Voice Tel: (412) 567-7870 >> >> >> >> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >> <[hidden email]>wrote: >> >> I have haven't neen following this thread but: >>> >>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>> opposed to built source) then the first line renames it so >>> that its not the same name as the built file about to be created. >>> The second line detars it into the RGoogleDocs directory. The third >>> builds >>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>> installs the built source file into R. I've assumed Windows. >>> If you are on Linux replace rename with mv. >>> >>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>> Rcmd build RGoogleDocs >>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>> >>> or >>> >>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then you >>> can just issue the last of the above lines and don't need >>> the others. >>> >>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>> wrote: >>> >>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>> Do you mean the directory where I downloaded the >>>> RGoogleDocs_0.2-2.tar.gz >>>> to? Or do you mean that I must create a directory called RGoogleDocs >>>> >>> under >>> >>>> Library and then change to that directory? >>>> Farrel Buchinsky >>>> Google Voice Tel: (412) 567-7870 >>>> >>>> >>>> >>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>> >>> [hidden email]> >>> >>>> wrote: >>>> >>>>> Finally enter into the Windows console: >>>>> >>>>> cd the.directory.containing.RGoogleDocs >>>>> Rcmd build RGoogleDocs >>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>> >>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>> created by the build. >>>>> >>>> >>    [[alternative HTML version deleted]] >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > ------------------------------ Message: 29 Date: Wed, 8 Jul 2009 10:05:54 -0400 From: Jorge Ivan Velez <[hidden email]> Subject: Re: [R] R regular expression to extract words with the query    string. To: [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Dear Praveen, Try also: strsplit(i,' ')[[1]][2] # [1] "pid:ENSP000012345" HTH, Jorge On Wed, Jul 8, 2009 at 9:04 AM, Praveen Surendran <[hidden email]>wrote: > Hi, > > > > Is there a way in R to get the string which matches the expression, where > the expression is a substring of the parent string. > > > > Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" > > What I need is the string "pid:ENSP000012345" from $i using the query > "ENSP". > > > > Appreciate your comments. > > > > Praveen Surendran > > School of Medicine and Medical Sciences > > University College Dublin > > Belfiled, Dublin 4 > > Ireland. > > > > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 30 Date: Wed, 8 Jul 2009 10:08:42 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] R regular expression to extract words with the query    string. To: [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Try this: library(gsubfn) i <- "transcript:ENST0000112334 pid:ENSP000012345" strapply(i, paste("\\w*", "ENSP", "\\w*", sep = ""), c, simplify = unlist) This says to match any number (possibly zero) of word characters followed by ENSP followed by more word characters. c just returns the match without further processing and unlist unlists the result giving a character vector (which otherwise would be a list). See http://gsubfn.googlecode.com for more info. On Wed, Jul 8, 2009 at 9:04 AM, Praveen Surendran<[hidden email]> wrote: > Hi, > > > > Is there a way in R to get the string which matches the expression, where > the expression is a substring of the parent string. > > > > Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" > > What I need is the string "pid:ENSP000012345" from $i using the query > "ENSP". > > > > Appreciate your comments. > > > > Praveen ?Surendran > > School of Medicine and Medical Sciences > > University College Dublin > > Belfiled, Dublin 4 > > Ireland. > > > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 31 Date: Wed, 08 Jul 2009 10:09:27 -0400 From: Duncan Murdoch <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Farrel Buchinsky <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: > I have previously read "R Installation and Administration". I read it > again. It does not help me > The relevant paragraph is below. But I need lower level instructions. Where > can I find them. Follow the link. If Windows can't find tar, your toolset is installed incorrectly. Duncan Murdoch > > R CMD INSTALL works in Windows to install source packages if you have the > source-code package files (option ?Source Package Installation Files? in the > installer) and toolset (see The Windows > toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) > installed. Installation of binary packages must be done by install.packages > . R CMD INSTALL --help will tell you the current options under Windows > (which differ from those on a Unix-alike): in particular there is a choice > of the types of documentation to be installed. > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > > > > 2009/6/19 Uwe Ligges <[hidden email]> > >> See the manual "R Installation and Administration" for information on how >> to install source packages on Windows. >> >> Uwe Ligges >> >> Farrel Buchinsky wrote: >> >>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an error >>> >>> message >>> 'tar' is not recongnized as an internal or external command, operable >>> program or batch file. >>> >>> Should I use my 7-zip to open up the archive? >>> Where should I be doing this? For instance can I do it all in my >>> download directory or should I do it in C:\Program >>> Files\R\R-2.9.0\library or should I manually create C:\Program >>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the Rcmd >>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>> >>> Yes, you assumed correctly. I am using Windows XP. >>> Farrel Buchinsky >>> Google Voice Tel: (412) 567-7870 >>> >>> >>> >>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>> <[hidden email]>wrote: >>> >>> I have haven't neen following this thread but: >>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>> opposed to built source) then the first line renames it so >>>> that its not the same name as the built file about to be created. >>>> The second line detars it into the RGoogleDocs directory. The third >>>> builds >>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>> installs the built source file into R. I've assumed Windows. >>>> If you are on Linux replace rename with mv. >>>> >>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>> Rcmd build RGoogleDocs >>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>> >>>> or >>>> >>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then you >>>> can just issue the last of the above lines and don't need >>>> the others. >>>> >>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>> wrote: >>>> >>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>> Do you mean the directory where I downloaded the >>>>> RGoogleDocs_0.2-2.tar.gz >>>>> to? Or do you mean that I must create a directory called RGoogleDocs >>>>> >>>> under >>>> >>>>> Library and then change to that directory? >>>>> Farrel Buchinsky >>>>> Google Voice Tel: (412) 567-7870 >>>>> >>>>> >>>>> >>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>> >>>> [hidden email]> >>>> >>>>> wrote: >>>>> >>>>>> Finally enter into the Windows console: >>>>>> >>>>>> cd the.directory.containing.RGoogleDocs >>>>>> Rcmd build RGoogleDocs >>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>> >>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>> created by the build. >>>>>> >>>    [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/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]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 32 Date: Wed, 8 Jul 2009 10:13:34 -0400 From: Farrel Buchinsky <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain Forgive my naivte, but how do I make windows find tar. In other words from where do I issue the command and what is the command. Farrel Buchinsky Google Voice Tel: (412) 567-7870 On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> wrote: > On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: > >> I have previously read "R Installation and Administration". I read it >> again. It does not help me >> The relevant paragraph is below. But I need lower level instructions. >> Where >> can I find them. >> > > Follow the link. If Windows can't find tar, your toolset is installed > incorrectly. > > Duncan Murdoch > > >> R CMD INSTALL works in Windows to install source packages if you have the >> source-code package files (option âSource Package Installation Filesâ in >> the >> installer) and toolset (see The Windows >> >> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >> >> installed. Installation of binary packages must be done by >> install.packages >> . R CMD INSTALL --help will tell you the current options under Windows >> (which differ from those on a Unix-alike): in particular there is a choice >> of the types of documentation to be installed. >> Farrel Buchinsky >> Google Voice Tel: (412) 567-7870 >> >> >> >> 2009/6/19 Uwe Ligges <[hidden email]> >> >> See the manual "R Installation and Administration" for information on how >>> to install source packages on Windows. >>> >>> Uwe Ligges >>> >>> Farrel Buchinsky wrote: >>> >>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an error >>>> >>>> message >>>> 'tar' is not recongnized as an internal or external command, operable >>>> program or batch file. >>>> >>>> Should I use my 7-zip to open up the archive? >>>> Where should I be doing this? For instance can I do it all in my >>>> download directory or should I do it in C:\Program >>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the Rcmd >>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>> >>>> Yes, you assumed correctly. I am using Windows XP. >>>> Farrel Buchinsky >>>> Google Voice Tel: (412) 567-7870 >>>> >>>> >>>> >>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>> <[hidden email]>wrote: >>>> >>>> I have haven't neen following this thread but: >>>> >>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>> opposed to built source) then the first line renames it so >>>>> that its not the same name as the built file about to be created. >>>>> The second line detars it into the RGoogleDocs directory. The third >>>>> builds >>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>> installs the built source file into R. I've assumed Windows. >>>>> If you are on Linux replace rename with mv. >>>>> >>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>> Rcmd build RGoogleDocs >>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>> >>>>> or >>>>> >>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then you >>>>> can just issue the last of the above lines and don't need >>>>> the others. >>>>> >>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>>> wrote: >>>>> >>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>> Do you mean the directory where I downloaded the >>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>> to? Or do you mean that I must create a directory called RGoogleDocs >>>>>> >>>>>> under >>>>> >>>>> Library and then change to that directory? >>>>>> Farrel Buchinsky >>>>>> Google Voice Tel: (412) 567-7870 >>>>>> >>>>>> >>>>>> >>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>> >>>>>> [hidden email]> >>>>> >>>>> wrote: >>>>>> >>>>>> Finally enter into the Windows console: >>>>>>> >>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>> Rcmd build RGoogleDocs >>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>> >>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>> created by the build. >>>>>>> >>>>>>>    [[alternative HTML version deleted]] >>>> >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/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]] >> >> >> >> ------------------------------------------------------------------------ >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ------------------------------ Message: 33 Date: Wed, 8 Jul 2009 19:45:53 +0530 From: anupam sinha <[hidden email]> Subject: Re: [R] Fitting a trend-line To: Jim Lemon <[hidden email]>, [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Thanks a lot for all your suggestions. Regards, Anupam    [[alternative HTML version deleted]] ------------------------------ Message: 34 Date: Wed, 8 Jul 2009 10:39:21 -0400 From: "Wouterse, Fleur \(IFPRI-Senegal\)" <[hidden email]> Subject: [R] truncated regression out-of-sample predictions To: <[hidden email]> Message-ID: <5C41B489BDE4614A9FA014D690BEB03F0C3AB3B4@IFPRIE> Content-Type: text/plain Dear all, I am trying to implement Simar & Wilson's (2007) second algorithm and have the following question: If I use a truncated regression on the m<n observations, how do I get fitted values for all n observations, instead of for m observations, which is what the command fitted returns; I would need these to construct the left-truncation needed to draw n random deviates. Thanks for your help, Fleur Fleur Wouterse, Ph.D. Post-Doctoral Fellow IFPRI-Dakar Immeuble Ousseynou Thiam Gueye Rue de Thies Point E, BP 15702 CP 12524 Dakar Fann Senegal Phone: +221 33 869 3986 Email: [hidden email]    [[alternative HTML version deleted]] ------------------------------ Message: 35 Date: Wed, 8 Jul 2009 10:46:46 -0400 From: Donald Braman <[hidden email]> Subject: [R] recoding strings containing colons To: r-help <[hidden email]>, [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Curious to know if recode can work with strings containing colons. I haven't gotten it to work yet, but perhaps there is a way? Donald Braman http://www.culturalcognition.com/braman/ ------------------------------ Message: 36 Date: Wed, 8 Jul 2009 10:47:32 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: Henrique Dallazuanna <[hidden email]> Cc: [hidden email], Petr PIKAL <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <[hidden email]>wrote: > Its because '[[' accept only element, so you need use '[': > > q[crossRsorted[,1]] > > Henrique, I figured out what q[crossRsorted[,1]] does - it produces q[i] for all i in crossRsorted[,1]. Ok. Since a given index 'k' of q[[k]] can occur in multiple rows in crossRsorted[,1], this is not what I want. Meanwhile, I was able to express what I do want like so: crossRsorted[Filter(function (idx) mean(q[[idx]], na.rm = TRUE), unique(crossRsorted[,1])), ] but, I'm afraid, that's not really "R style." Or is it? But perhaps the only way? I think I'm starting to see the allure of R: every indexing task ends up a challenging puzzle. Which prevents Alzheimer's [1]. - Godmar [1] http://www.timesonline.co.uk/tol/life_and_style/article508785.ece    [[alternative HTML version deleted]] ------------------------------ Message: 37 Date: Wed, 08 Jul 2009 10:50:27 -0400 From: "Curley, Jane" <[hidden email]> Subject: [R] please remove me from this list To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain    [[alternative HTML version deleted]] ------------------------------ Message: 38 Date: Wed, 08 Jul 2009 09:50:56 -0500 From: Marc Schwartz <[hidden email]> Subject: Re: [R] functions to calculate t-stats, etc. for lm.fit    objects? To: Whit Armstrong <[hidden email]> Cc: r-help <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Jul 8, 2009, at 8:51 AM, Whit Armstrong wrote: > I'm running a huge number of regressions in a loop, so I tried lm.fit > for a speedup. However, I would like to be able to calculate the > t-stats for the coefficients. > > Does anyone have some functions for calculating the regression summary > stats of an lm.fit object? > > Thanks, > Whit Whit, depending upon just how much time savings you are realizing by using lm.fit() and not lm(), the approach to your question may vary. Do you need all of the models, or only a subset? If the latter, then I would narrow down your model set and re-run them with lm() so that you can use summary.lm() directly. That would entail less custom coding, which may otherwise offset any time savings from using lm.fit() If the former, then there are two choices as I see them. The first would be to restructure the object resulting from lm.fit() by adding the elements required to run summary.lm(). However, I would think that this overhead would bring you back to a point where just using lm() would be a better approach from a time standpoint. The second would be to cook up a function that only provides the subset of results that you need from summary.lm() and then use that on the results of lm.fit(). Here again, there remains the question of just how much time are you saving using lm.fit() versus the additional overhead of calculating even a subset of the output. Here is a very simple approach to a function that would get you a subset of the output that you would get using, for example, coef(summary(lm.object)). This is using a selective approach of copying and slightly editing code from summary.lm(). Note that there is other code in summary.lm() to handle weights and such, if your models are more complex. You would need to add that in if that is the case. If you need much more summary output than this on each model, then I think you would be better off just using lm() and summary.lm(). # Use at your own risk...untested on more complex models :-) # 'x' is an lm.fit object calc.lm.t <- function(x) {    Qr <- x$qr    r <- x$residuals    p <- x$rank    p1 <- 1L:p    rss <- sum(r^2)    n <- NROW(Qr$qr)    rdf <- n - p    resvar <- rss/rdf    R <- chol2inv(Qr$qr[p1, p1, drop = FALSE])    se <- sqrt(diag(R) * resvar)    est <- x$coefficients[Qr$pivot[p1]]    tval <- est/se    res <- cbind(est = est, se = se, tval = tval)    res } Here is some simple example data: set.seed(1) y <- rnorm(100) x <- rnorm(100) # Get the default coefficient output using summary.lm() > coef(summary(lm(y ~ x)))          Estimate Std.. Error    t value Pr(>|t|) (Intercept) 0.1088521158 0.09034800 1.20480938 0.2311784 x       -0.0009323697 0.09472155 -0.00984327 0.9921663 # Now use calc.lm.t lmf <- lm.fit(model.matrix(y ~ x), y) > calc.lm.t(lmf)              est      se    tval (Intercept) 0.1088521158 0.09034800 1.20480938 x       -0.0009323697 0.09472155 -0.00984327 I'll leave it to you to see whether this approach may or may not be helpful from a time perspective. HTH, Marc Schwartz ------------------------------ Message: 39 Date: Wed, 8 Jul 2009 06:20:42 -0700 (PDT) From: cvandy <[hidden email]> Subject: [R] Formatting a Table To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii I've created a short program to print a table of learning curve factors. However, I cannot figure out how to format the table to: 1) Get rid of the [1]s in the first column and replace it with the values of N. 2) Line up the first row with the factors (decimal fractions). Thanks for any help. The complete program and output is as follows: > Lc<-seq(0.70,0.95,0.05) #Specify learning curves > T<-function(N,Lc) #Create a function to calc.time for Nth unit + { + N^(log(Lc,10)/log(2,10)) #Function + } > for (N in seq(2,10,2)) + {if (N==2){print(T(N,Lc)*100)}else{print(T(N,Lc),digits=3)}} [1] 70 75 80 85 90 95 [1] 0.490 0.562 0.640 0.722 0.810 0.902 [1] 0.398 0.475 0.562 0.657 0.762 0.876 [1] 0.343 0.422 0.512 0.614 0.729 0.857 [1] 0.306 0.385 0.477 0.583 0.705 0.843 > -- View this message in context: http://www.nabble.com/Formatting-a-Table-tp24391433p24391433.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 40 Date: Wed, 8 Jul 2009 16:34:35 +0200 From: Lars Bergemann <[hidden email]> Subject: [R] Two-way ANOVA gives different results using anova(lm())    than doing it by hand To: <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset="windows-1252" Hey! Could you please take a quick look at what I have done? Somehow I get wrong results using the anova(lm()) combination compared to doing a two way ANOVA by hand. Running: Data<-read.table("Data.txt"); g<-lm(ExM~S1*S2,Data); anova(g); Gives: Analysis of Variance Table Response: ExM        Df Sum Sq Mean Sq F value  Pr(>F)  S1     1 4.3679 4.3679 167.045 < 2.2e-16 *** S2     1 0.9427 0.9427 36.053 8.236e-09 *** S1:S2     1 0.3231 0.3231 12.357 0.0005371 *** Residuals 212 5.5434 0.0261           I compared it to the work done by hand, ie calculated all the different square sums using sum() and tapply(). So I know that anova(lm()) gets the degrees of freedom equal two 1, 1, 1 and 212 when it should be 5, 5, 25 and 180. Also, the square sums are quite different ... I get 4.xx, 4.xx, 1.xx, 0.xx ... as you see, what anova(lm()) gets is different. The data: S1 has 6 levels, so has S2. On average, each cell has 6 values, most cells have actually 6 values, and there are two of each: 5, 7, 4, 8 - so average 6. Could you please help me, why it does not work with anova(lm())? I tried quite a few thinks found with Google, but it all gave me the same result as anova(lm()) ... Thanks a lot! Lars _________________________________________________________________ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Data.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090708/19a66254/attachment-0001.txt> ------------------------------ Message: 41 Date: Wed, 8 Jul 2009 16:01:17 +0200 From: Tymek Wo?od?ko <[hidden email]> Subject: [R] Passing arguments to with() To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 Hi, I've been wondering how to write a function that will produce results from multiple tests (eg. paired t-tests) for all or several variables in some data frame. I'd like it to do t-test for each variable ('x') in 'data' by 'y'. I'm stuck in here: function(data,y) { for (x in names(data)) {    with(data, t.test(x~y)) }} How to tell 'with' that 'x' and 'y' are names of columns in 'data'? Or pass similar arguments? I probably understand the logic why this is not working, but still don't know how to make it work. [[elided Yahoo spam]] Timo ------------------------------ Message: 42 Date: Wed, 8 Jul 2009 11:07:03 -0400 From: Whit Armstrong <[hidden email]> Subject: Re: [R] functions to calculate t-stats, etc. for lm.fit    objects? To: Marc Schwartz <[hidden email]> Cc: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 Marc, Thanks very much for your detailed reply. I'll give your code a try and post back the time difference. Cheers, Whit On Wed, Jul 8, 2009 at 10:50 AM, Marc Schwartz<[hidden email]> wrote: > On Jul 8, 2009, at 8:51 AM, Whit Armstrong wrote: > >> I'm running a huge number of regressions in a loop, so I tried lm.fit >> for a speedup. ?However, I would like to be able to calculate the >> t-stats for the coefficients. >> >> Does anyone have some functions for calculating the regression summary >> stats of an lm.fit object? >> >> Thanks, >> Whit > > > > Whit, depending upon just how much time savings you are realizing by using > lm.fit() and not lm(), the approach to your question may vary. > > Do you need all of the models, or only a subset? > > If the latter, then I would narrow down your model set and re-run them with > lm() so that you can use summary.lm() directly. That would entail less > custom coding, which may otherwise offset any time savings from using > lm.fit() > > If the former, then there are two choices as I see them. > > The first would be to restructure the object resulting from lm.fit() by > adding the elements required to run summary.lm(). However, I would think > that this overhead would bring you back to a point where just using lm() > would be a better approach from a time standpoint. > > The second would be to cook up a function that only provides the subset of > results that you need from summary.lm() and then use that on the results of > lm.fit(). Here again, there remains the question of just how much time are > you saving using lm.fit() versus the additional overhead of calculating even > a subset of the output. > > Here is a very simple approach to a function that would get you a subset of > the output that you would get using, for example, coef(summary(lm.object)). > This is using a selective approach of copying and slightly editing code from > summary.lm(). Note that there is other code in summary.lm() to handle > weights and such, if your models are more complex. You would need to add > that in if that is the case. > > If you need much more summary output than this on each model, then I think > you would be better off just using lm() and summary.lm(). > > > # Use at your own risk...untested on more complex models ?:-) > > # 'x' is an lm.fit object > > calc.lm.t <- function(x) > { > ?Qr <- x$qr > ?r <- x$residuals > ?p <- x$rank > ?p1 <- 1L:p > ?rss <- sum(r^2) > > ?n <- NROW(Qr$qr) > ?rdf <- n - p > > ?resvar <- rss/rdf > ?R <- chol2inv(Qr$qr[p1, p1, drop = FALSE]) > ?se <- sqrt(diag(R) * resvar) > > ?est <- x$coefficients[Qr$pivot[p1]] > ?tval <- est/se > > ?res <- cbind(est = est, se = se, tval = tval) > ?res > } > > > > Here is some simple example data: > > set.seed(1) > y <- rnorm(100) > x <- rnorm(100) > > > # Get the default coefficient output using summary.lm() >> coef(summary(lm(y ~ x))) > ? ? ? ? ? ? ? ? Estimate Std. Error ? ? t value ?Pr(>|t|) > (Intercept) ?0.1088521158 0.09034800 ?1.20480938 0.2311784 > x ? ? ? ? ? -0.0009323697 0.09472155 -0.00984327 0.9921663 > > > > # Now use calc.lm.t > > lmf <- lm.fit(model.matrix(y ~ x), y) > >> calc.lm.t(lmf) > ? ? ? ? ? ? ? ? ? ? ?est ? ? ? ? se ? ? ? ?tval > (Intercept) ?0.1088521158 0.09034800 ?1.20480938 > x ? ? ? ? ? -0.0009323697 0.09472155 -0.00984327 > > > > I'll leave it to you to see whether this approach may or may not be helpful > from a time perspective. > > HTH, > > Marc Schwartz > > ------------------------------ Message: 43 Date: Wed, 8 Jul 2009 10:16:48 -0500 From: Idgarad <[hidden email]> Subject: [R] #INCLUDE To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain What is R's equivalent to a C-like #include to incorporate external files. I have a 2k line function that is generated and need to include it at runtime but not manage it as a package (as it changes hourly.) Any ideas?    [[alternative HTML version deleted]] ------------------------------ Message: 44 Date: Wed, 08 Jul 2009 11:21:25 -0400 From: Duncan Murdoch <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Farrel Buchinsky <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: > Forgive my naivte, but how do I make windows find tar. In other words from > where do I issue the command and what is the command. You need to install the toolset, and let the installer set your path. Duncan Murdoch > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > > > > On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> wrote: > >> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >> >>> I have previously read "R Installation and Administration". I read it >>> again. It does not help me >>> The relevant paragraph is below. But I need lower level instructions. >>> Where >>> can I find them. >>> >> Follow the link. If Windows can't find tar, your toolset is installed >> incorrectly. >> >> Duncan Murdoch >> >> >>> R CMD INSTALL works in Windows to install source packages if you have the >>> source-code package files (option ?Source Package Installation Files? in >>> the >>> installer) and toolset (see The Windows >>> >>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>> >>> installed. Installation of binary packages must be done by >>> install.packages >>> . R CMD INSTALL --help will tell you the current options under Windows >>> (which differ from those on a Unix-alike): in particular there is a choice >>> of the types of documentation to be installed. >>> Farrel Buchinsky >>> Google Voice Tel: (412) 567-7870 >>> >>> >>> >>> 2009/6/19 Uwe Ligges <[hidden email]> >>> >>> See the manual "R Installation and Administration" for information on how >>>> to install source packages on Windows. >>>> >>>> Uwe Ligges >>>> >>>> Farrel Buchinsky wrote: >>>> >>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an error >>>>> message >>>>> 'tar' is not recongnized as an internal or external command, operable >>>>> program or batch file. >>>>> >>>>> Should I use my 7-zip to open up the archive? >>>>> Where should I be doing this? For instance can I do it all in my >>>>> download directory or should I do it in C:\Program >>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the Rcmd >>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>> >>>>> Yes, you assumed correctly. I am using Windows XP. >>>>> Farrel Buchinsky >>>>> Google Voice Tel: (412) 567-7870 >>>>> >>>>> >>>>> >>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>> <[hidden email]>wrote: >>>>> >>>>> I have haven't neen following this thread but: >>>>> >>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>> opposed to built source) then the first line renames it so >>>>>> that its not the same name as the built file about to be created. >>>>>> The second line detars it into the RGoogleDocs directory. The third >>>>>> builds >>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>>> installs the built source file into R. I've assumed Windows. >>>>>> If you are on Linux replace rename with mv. >>>>>> >>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>> Rcmd build RGoogleDocs >>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>> >>>>>> or >>>>>> >>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then you >>>>>> can just issue the last of the above lines and don't need >>>>>> the others. >>>>>> >>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>>>> wrote: >>>>>> >>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>> Do you mean the directory where I downloaded the >>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>> to? Or do you mean that I must create a directory called RGoogleDocs >>>>>>> >>>>>>> under >>>>>> Library and then change to that directory? >>>>>>> Farrel Buchinsky >>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>> >>>>>>> [hidden email]> >>>>>> wrote: >>>>>>> Finally enter into the Windows console: >>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>> Rcmd build RGoogleDocs >>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>> >>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>> created by the build. >>>>>>>> >>>>>>>>    [[alternative HTML version deleted]] >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/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]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 45 Date: Wed, 8 Jul 2009 11:23:52 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] #INCLUDE To: Idgarad <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 ?source ? On Wed, Jul 8, 2009 at 11:16 AM, Idgarad<[hidden email]> wrote: > What is R's equivalent to a C-like #include to incorporate external files.. I > have a 2k line function that is generated and need to include it at runtime > but not manage it as a package (as it changes hourly.) Any ideas? > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 46 Date: Wed, 08 Jul 2009 11:24:31 -0400 From: Paul Simonin <[hidden email]> Subject: [R] Comparing GAMMs To: R Help Listserve <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Greetings!  I am looking for advice regarding the best way to compare GAMMs. I know other model outputs return enough information for R's AIC, ANOVA, etc. commands to function, but this is not the case with GAMM unless one specifies the gam or lme portion. I know these parts of the gamm contain items that will facilitate comparisons between gamms. Is it correct to simply use these values for this purpose? For example, the lme portion of the gamm returns a log liklihood value that could be used to calculate information criteria. However, I am wondering whether entire gamms be compared using this, or only the lme part.  Maybe my thinking about the lme and gam portions of gamms is incorrect? If this appears to be the case, let me know! In general, if someone could clarify my understanding in any way it would be much appreciated. Thank you very much! Sincerely, Paul Simonin ------------------------------ Message: 47 Date: Wed, 08 Jul 2009 11:26:06 -0400 From: Duncan Murdoch <[hidden email]> Subject: Re: [R] Passing arguments to with() To: Tymek Wo?odz'ko <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed On 08/07/2009 10:01 AM, Tymek Wo?odz'ko wrote: > Hi, > > I've been wondering how to write a function that will produce results > from multiple tests (eg. paired t-tests) for all or several variables > in some data frame. I'd like it to do t-test for each variable ('x') > in 'data' by 'y'. I'm stuck in here: > > function(data,y) { > for (x in names(data)) { >    with(data, t.test(x~y)) > }} > > How to tell 'with' that 'x' and 'y' are names of columns in 'data'? Or > pass similar arguments? Duncan Murdoch > > I probably understand the logic why this is not working, but still > don't know how to make it work. > [[elided Yahoo spam]] > Timo > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 48 Date: Wed, 8 Jul 2009 11:36:23 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] Formatting a Table To: cvandy <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 You could use 'cat(sprintf())', C-style: > for (N in seq(2,10,2)) + {if (N==2){cat(sprintf("%5d", T(N,Lc)*100),"\n")}else{cat(sprintf("%5.3f", T(N,Lc)), "\n")}}    70  75  80  85  89  95 0.490 0.562 0.640 0.722 0.810 0.902 0.398 0.475 0.562 0.657 0.762 0.876 0.343 0.422 0.512 0.614 0.729 0.857 0.306 0.385 0.477 0.583 0.705 0.843 On Wed, Jul 8, 2009 at 9:20 AM, cvandy<[hidden email]> wrote: > > I've created a short program to print a table of learning curve factors. > However, I cannot figure out how to format the table to: > 1) Get rid of the [1]s in the first column and replace it with the values of > N. > 2) Line up the first row with the factors (decimal fractions). > Thanks for any help. > The complete program and output is as follows: > >> Lc<-seq(0.70,0.95,0.05) #Specify learning curves >> T<-function(N,Lc) ?#Create a function to calc.time for Nth unit > + { > + N^(log(Lc,10)/log(2,10)) ?#Function > + } >> for (N in seq(2,10,2)) > + {if (N==2){print(T(N,Lc)*100)}else{print(T(N,Lc),digits=3)}} > [1] 70 75 80 85 90 95 > [1] 0.490 0.562 0.640 0.722 0.810 0.902 > [1] 0.398 0.475 0.562 0.657 0.762 0.876 > [1] 0.343 0.422 0.512 0.614 0.729 0.857 > [1] 0.306 0.385 0.477 0.583 0.705 0.843 >> > -- > View this message in context: http://www.nabble.com/Formatting-a-Table-tp24391433p24391433.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 49 Date: Wed, 8 Jul 2009 11:42:09 -0400 From: "David Huffer" <[hidden email]> Subject: Re: [R] Formatting a Table To: "cvandy" <[hidden email]>, <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Cvandy, is this close to what you need:  > printT <- function ( .seq = seq ( 2 , 10 , 2 ) ) {  +   x <- t ( sapply ( .seq , T , Lc ) )  +   x <- cbind (  +    .seq  +    , rbind (  +     format ( x [ 1 , ] * 100 )  +     , format ( x [ -1 , ] , digits = 3 )  +    )  +   )  +   dimnames ( x ) [[2]] <- NULL  +   print ( x , quote = FALSE )  + }  > printT ( )      [,1] [,2] [,3] [,4] [,5] [,6] [,7]  [1,] 2  70  75  80  85  90  95  [2,] 4  0.490 0.562 0.640 0.722 0.810 0.902  [3,] 6  0.398 0.475 0.562 0.657 0.762 0.876  [4,] 8  0.343 0.422 0.512 0.614 0.729 0.857  [5,] 10   0.306 0.385 0.477 0.583 0.705 0.843 Im not really sure what you mean by "Line up the first row with the factors (decimal fractions)". -- David ? ----------------------------------------------------- David Huffer, Ph.D.         Senior Statistician CSOSA/Washington, DC       [hidden email] ----------------------------------------------------- -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of cvandy Sent: Wednesday, July 08, 2009 9:21 AM To: [hidden email] Subject: [R] Formatting a Table I've created a short program to print a table of learning curve factors. However, I cannot figure out how to format the table to: 1) Get rid of the [1]s in the first column and replace it with the values of N. 2) Line up the first row with the factors (decimal fractions). Thanks for any help. The complete program and output is as follows: > Lc<-seq(0.70,0.95,0.05) #Specify learning curves > T<-function(N,Lc) #Create a function to calc.time for Nth unit + { + N^(log(Lc,10)/log(2,10)) #Function + } > for (N in seq(2,10,2)) + {if (N==2){print(T(N,Lc)*100)}else{print(T(N,Lc),digits=3)}} [1] 70 75 80 85 90 95 [1] 0.490 0.562 0.640 0.722 0.810 0.902 [1] 0.398 0.475 0.562 0.657 0.762 0.876 [1] 0.343 0.422 0.512 0.614 0.729 0.857 [1] 0.306 0.385 0.477 0.583 0.705 0.843 > -- View this message in context: http://www.nabble.com/Formatting-a-Table-tp24391433p24391433.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 50 Date: Wed, 08 Jul 2009 16:54:04 +0100 From: Gavin Simpson <[hidden email]> Subject: Re: [R] Comparing GAMMs To: Paul Simonin <[hidden email]> Cc: R Help Listserve <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain On Wed, 2009-07-08 at 11:24 -0400, Paul Simonin wrote: > Greetings! >   I am looking for advice regarding the best way to compare GAMMs. I > know other model outputs return enough information for R's AIC, ANOVA, > etc. commands to function, but this is not the case with GAMM unless one > specifies the gam or lme portion. I know these parts of the gamm contain > items that will facilitate comparisons between gamms. Is it correct to > simply use these values for this purpose? For example, the lme portion > of the gamm returns a log liklihood value that could be used to > calculate information criteria. However, I am wondering whether entire > gamms be compared using this, or only the lme part. >   Maybe my thinking about the lme and gam portions of gamms is > incorrect? If this appears to be the case, let me know! In general, if > someone could clarify my understanding in any way it would be much > appreciated. > Sincerely, > Paul Simonin Hi Paul, Are your GAMMs Guassian (i.e. AMM) or non-Gaussian? If they are Gaussian, then anova(mod1$lme, mod2$lme) gives an approximate LRT for the two models. That will also yield AIC and BIC which might also be used for inference. Your AMM in this case is just a linear mixed model and these usual forms of inference apply, with the caveat that the hypothesis testing is approximate. You end up using both the $lme and the $gam components for various aspects of model inspection, interrogation etc, but for hypothesis testing, the lme bit is sufficient. You can also use things like intervals(mod1$lme) to look at confidence on the smoothing parameters. See Simon Wood's book [1] section 6.7 for more details, and preceding sections on how the smoothers can be formulated as a mixed model. If your GAMMS are generalised then I'm not sure what the best approach for comparison or hypothesis testing might be - especially as this is an ongoing research topic for GLMMs, and also because of the method by which GAMMs are fitted in mgcv. Simon Wood says as much in his 2006 monograph [1, page 318, section 6.6.2]. The non-Gaussian case uses glmmPQL from package MASS, and this doesn't return a likelihood and hence no AIC (in the same way that quasi families in glm() fits don't return likelihoods). So having said that, if you do have a likelihood, then you must be fitting AMM via gamm() and the first half of my reply would seem most appropriate. [1] Wood, S.N. (2006) Generalized Additive Models; an Introduction with R. Chapman & Hall/CRC. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson        [t] +44 (0)20 7679 0522 ECRC, UCL Geography,     [f] +44 (0)20 7679 0565 Pearson Building,        [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London     [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT.          [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ------------------------------ Message: 51 Date: Wed, 8 Jul 2009 09:54:14 -0600 From: Mark Na <[hidden email]> Subject: [R] Randomizing a dataframe To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hi R-helpers, I have a dataframe (called data) with trees in rows (n=100) and insect species (n=10) in columns. My tree IDs are in a column called TREE and each species has a column labeled SPEC1, SPEC2, SPEC3, etc... I wish to randomize the values in my dataframe such that row and column totals are held constant, i.e. in my randomized data each tree will have the same number of individual insects as in the real data (constant row totals) and each species will have the same number of individuals as in the real data (constant column totals). I will eventually want to do this many times, but I would appreciate help getting started with the randomization. Thank you, Mark Na    [[alternative HTML version deleted]] ------------------------------ Message: 52 Date: Wed, 8 Jul 2009 11:55:32 -0400 From: "David Huffer" <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: "Godmar Back" <[hidden email]>, "Henrique Dallazuanna"    <[hidden email]> Cc: [hidden email], Petr PIKAL <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Godmar, I don't follow...  > q <- list ( )  > q [[ 105 ]] <- as.numeric ( c ( 0 , 0 , 1 ) )  > q [[ 104 ]] <- as.numeric ( c ( 1 , 1 , 1 ) )  > q [[ 10 ]] <- as.integer ( c ( 3 , 3 , 1 ) )  > crossRsorted <- data.frame ( i = c ( 105 , 104 , 10 ) )  > q [ crossRsorted [ , 1 ] ]  [[1]]  [1] 0 0 1  [[2]]  [1] 1 1 1  [[3]]  [1] 3 3 1  > length ( q [ crossRsorted [ , 1 ] ] )  [1] 3  > How'd you come up with  > length(q)  [1] 165  > length(q[ crossRsorted[,1] ])  [1] 15750 I must be missing something. -- David ? ----------------------------------------------------- David Huffer, Ph.D.         Senior Statistician CSOSA/Washington, DC       [hidden email] ----------------------------------------------------- -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Godmar Back Sent: Wednesday, July 08, 2009 9:58 AM To: Henrique Dallazuanna Cc: [hidden email]; Petr PIKAL Subject: Re: [R] error: no such index at level 2 On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <[hidden email]>wrote: > Its because '[[' accept only element, so you need use '[': > > q[crossRsorted[,1]] > This appears to be doing something different. For instance, my 'q' has 165 components, but what you suggest has 15750: > length(q) [1] 165 > length(q[ crossRsorted[,1] ]) [1] 15750 hardly what I want. Meanwhile, it looks as though [[ ]] does not vectorize its arguments, it curries them! Note that: > q[[c(105,104)]] Error in q[[c(105, 104)]] : subscript out of bounds gives the same error as: > q[[105]][[104]] Error in q[[105]][[104]] : subscript out of bounds Very mysterious, though, in all fairness, explained in help("[[") where it says:     '[[' can be applied recursively to lists, so that if the single     index 'i' is a vector of length 'p', 'alist[[i]]' is equivalent to     'alist[[i1]]...[[ip]]' providing all but the final indexing     results in a list. which leads to square one: how to express "select all r[i] where q[[i]] fulfills some predicate?" - Godmar    [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Godmar Back Sent: Wednesday, July 08, 2009 9:58 AM To: Henrique Dallazuanna Cc: [hidden email]; Petr PIKAL Subject: Re: [R] error: no such index at level 2 On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <[hidden email]>wrote: > Its because '[[' accept only element, so you need use '[': > > q[crossRsorted[,1]] > This appears to be doing something different. For instance, my 'q' has 165 components, but what you suggest has 15750: > length(q) [1] 165 > length(q[ crossRsorted[,1] ]) [1] 15750 hardly what I want. Meanwhile, it looks as though [[ ]] does not vectorize its arguments, it curries them! Note that: > q[[c(105,104)]] Error in q[[c(105, 104)]] : subscript out of bounds gives the same error as: > q[[105]][[104]] Error in q[[105]][[104]] : subscript out of bounds Very mysterious, though, in all fairness, explained in help("[[") where it says:     '[[' can be applied recursively to lists, so that if the single     index 'i' is a vector of length 'p', 'alist[[i]]' is equivalent to     'alist[[i1]]...[[ip]]' providing all but the final indexing     results in a list. which leads to square one: how to express "select all r[i] where q[[i]] fulfills some predicate?" - Godmar    [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 53 Date: Wed, 8 Jul 2009 11:59:43 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: David Huffer <[hidden email]> Cc: [hidden email], Petr PIKAL <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Sorry, I mixed my toy example to recreate the problem with the actual data set. The 'crossRsorted' in the toy and in the actual are different. See my latest posting in this thread. - Godmar On Wed, Jul 8, 2009 at 11:55 AM, David Huffer<[hidden email]> wrote: > Godmar, > > I don't follow... > > ?> q <- list ( ) > ?> q [[ 105 ]] <- as.numeric ( c ( 0 , 0 , 1 ) ) > ?> q [[ 104 ]] <- as.numeric ( c ( 1 , 1 , 1 ) ) > ?> q [[ 10 ]] <- as.integer ( c ( 3 , 3 , 1 ) ) > ?> crossRsorted <- data.frame ( i = c ( 105 , 104 , 10 ) ) > ?> q [ crossRsorted [ , 1 ] ] > ?[[1]] > ?[1] 0 0 1 > > ?[[2]] > ?[1] 1 1 1 > > ?[[3]] > ?[1] 3 3 1 > > ?> length ( q [ crossRsorted [ , 1 ] ] ) > ?[1] 3 > ?> > > How'd you come up with > > ?> length(q) > ?[1] 165 > ?> length(q[ crossRsorted[,1] ]) > ?[1] 15750 > > I must be missing something. > > -- > ?David > > ?----------------------------------------------------- > ?David Huffer, Ph.D. ? ? ? ? ? ? ? Senior Statistician > ?CSOSA/Washington, DC ? ? ? ? ? [hidden email] > ?----------------------------------------------------- > > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Godmar Back > Sent: Wednesday, July 08, 2009 9:58 AM > To: Henrique Dallazuanna > Cc: [hidden email]; Petr PIKAL > Subject: Re: [R] error: no such index at level 2 > > On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <[hidden email]>wrote: > >> Its because '[[' accept only element, so you need use '[': >> >> q[crossRsorted[,1]] >> > > This appears to be doing something different. For instance, my 'q' has 165 > components, but what you suggest has 15750: >> length(q) > [1] 165 >> length(q[ crossRsorted[,1] ]) > [1] 15750 > > hardly what I want. > > Meanwhile, it looks as though [[ ]] does not vectorize its arguments, it > curries them! > > Note that: > >> q[[c(105,104)]] > Error in q[[c(105, 104)]] : subscript out of bounds > > gives the same error as: > >> q[[105]][[104]] > Error in q[[105]][[104]] : subscript out of bounds > > Very mysterious, though, in all fairness, explained in help("[[") where it > says: > > ? ? '[[' can be applied recursively to lists, so that if the single > ? ? index 'i' is a vector of length 'p', 'alist[[i]]' is equivalent to > ? ? 'alist[[i1]]...[[ip]]' providing all but the final indexing > ? ? results in a list. > > which leads to square one: how to express "select all r[i] where q[[i]] > fulfills some predicate?" > > ?- Godmar > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Godmar Back > Sent: Wednesday, July 08, 2009 9:58 AM > To: Henrique Dallazuanna > Cc: [hidden email]; Petr PIKAL > Subject: Re: [R] error: no such index at level 2 > > On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <[hidden email]>wrote: > >> Its because '[[' accept only element, so you need use '[': >> >> q[crossRsorted[,1]] >> > > This appears to be doing something different. For instance, my 'q' has 165 > components, but what you suggest has 15750: >> length(q) > [1] 165 >> length(q[ crossRsorted[,1] ]) > [1] 15750 > > hardly what I want. > > Meanwhile, it looks as though [[ ]] does not vectorize its arguments, it > curries them! > > Note that: > >> q[[c(105,104)]] > Error in q[[c(105, 104)]] : subscript out of bounds > > gives the same error as: > >> q[[105]][[104]] > Error in q[[105]][[104]] : subscript out of bounds > > Very mysterious, though, in all fairness, explained in help("[[") where it > says: > > ? ? '[[' can be applied recursively to lists, so that if the single > ? ? index 'i' is a vector of length 'p', 'alist[[i]]' is equivalent to > ? ? 'alist[[i1]]...[[ip]]' providing all but the final indexing > ? ? results in a list. > > which leads to square one: how to express "select all r[i] where q[[i]] > fulfills some predicate?" > > ?- Godmar > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 54 Date: Wed, 8 Jul 2009 12:04:04 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 Its safer just to temporarily add it to your path. Unfortunately Rtools has a find command that conflicts with the find command in Windows so if you add the Rtools bin directory to your path permanently then you could find other programs stop working. That actually happened to me once and it took the longest time until I discovered that Rtools was the culprit. If you follow the advice I gave you normally won't have that problem. On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> wrote: > On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >> >> Forgive my naivte, but how do I make windows find tar. In other words from >> where do I issue the command and what is the command. > > You need to install the toolset, and let the installer set your path. > > Duncan Murdoch > >> Farrel Buchinsky >> Google Voice Tel: (412) 567-7870 >> >> >> >> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> wrote: >> >>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>> >>>> I ?have previously read "R Installation and Administration". I read it >>>> again. It does not help me >>>> The relevant paragraph is below. But I need lower level instructions. >>>> Where >>>> can I find them. >>>> >>> Follow the link. ?If Windows can't find tar, your toolset is installed >>> incorrectly. >>> >>> Duncan Murdoch >>> >>> >>>> R CMD INSTALL works in Windows to install source packages if you have >>>> the >>>> source-code package files (option ?Source Package Installation Files? in >>>> the >>>> installer) and toolset (see The Windows >>>> >>>> >>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>> >>>> installed. Installation of binary packages must be done by >>>> install.packages >>>> . R CMD INSTALL --help will tell you the current options under Windows >>>> (which differ from those on a Unix-alike): in particular there is a >>>> choice >>>> of the types of documentation to be installed. >>>> Farrel Buchinsky >>>> Google Voice Tel: (412) 567-7870 >>>> >>>> >>>> >>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>> >>>> ?See the manual "R Installation and Administration" for information on >>>> how >>>>> >>>>> to install source packages on Windows. >>>>> >>>>> Uwe Ligges >>>>> >>>>> Farrel Buchinsky wrote: >>>>> >>>>> ?After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>> error >>>>>> >>>>>> message >>>>>> 'tar' is not recongnized as an internal or external command, operable >>>>>> program or batch file. >>>>>> >>>>>> Should I use my 7-zip to open up the archive? >>>>>> Where should I be doing this? For instance can I do it all in my >>>>>> download directory or should I do it in C:\Program >>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the >>>>>> Rcmd >>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>> >>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>> Farrel Buchinsky >>>>>> Google Voice Tel: (412) 567-7870 >>>>>> >>>>>> >>>>>> >>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>> <[hidden email]>wrote: >>>>>> >>>>>> ?I have haven't neen following this thread but: >>>>>> >>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>> opposed to built source) then the first line renames it so >>>>>>> that its not the same name as the built file about to be created. >>>>>>> The second line detars it into the RGoogleDocs directory. ?The third >>>>>>> builds >>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. ?The fourth >>>>>>> installs the built source file into R. ?I've assumed Windows. >>>>>>> If you are on Linux replace rename with mv. >>>>>>> >>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>> Rcmd build RGoogleDocs >>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>> >>>>>>> or >>>>>>> >>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then >>>>>>> you >>>>>>> can just issue the last of the above lines and don't need >>>>>>> the others. >>>>>>> >>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>>>>> wrote: >>>>>>> >>>>>>> ?What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>> >>>>>>>> Do you mean the directory where I downloaded the >>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>> to? Or do you mean that I must create a directory called RGoogleDocs >>>>>>>> >>>>>>>> ?under >>>>>>> >>>>>>> ?Library and then change to that directory? >>>>>>>> >>>>>>>> Farrel Buchinsky >>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>> >>>>>>>> ?[hidden email]> >>>>>>> >>>>>>> ?wrote: >>>>>>>> >>>>>>>> ?Finally enter into the Windows console: >>>>>>>>> >>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>> >>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>> created by the build. >>>>>>>>> >>>>>>>>> ? ? ? [[alternative HTML version deleted]] >>>>>> >>>>>> ______________________________________________ >>>>>> [hidden email] mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/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]] >> >> >> >> ------------------------------------------------------------------------ >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 55 Date: Wed, 8 Jul 2009 10:09:08 -0600 From: Greg Snow <[hidden email]> Subject: Re: [R] Uncorrelated random vectors    <[hidden email]>, " Luba (AIM SE)Stein" <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset="iso-8859-1" The mvrnorm function in the MASS package has an argument to force the generated data to have the exact mean/variance structure as specified which when used with a diagonal variance matrix will generate data that has a 0 (within round off error) correlation in the data. No post processing by Gramm-Schmidt or other methods needed. The author(s) of the function cleverly hid this feature by placing the information on the help page for the function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email] 801.408.8111 > -----Original Message----- > From: [hidden email] [mailto:r-help-bounces@r- > project.org] On Behalf Of Moshe Olshansky > Sent: Tuesday, July 07, 2009 9:10 PM > To: [hidden email]; Luba (AIM SE)Stein > Subject: Re: [R] Uncorrelated random vectors > > > As mentioned by somebody before, there is no problem for the normal > case - use mvrnorm function from MASS package with any mu and make > Sigma be any diagonal matrix (with strictly positive diagonal). Note > that even though all the correlations are 0, the SAMPLE correlations > won't be 0. If you want to create a set of vectors whose SAMPLE > correlations are 0 you will have to use a variant of Gramm-Schmidt. > I do not know whether a variant of mvrnorm exists for logistic > distribution (my guess is that it does not). > > --- On Tue, 7/7/09, Stein, Luba (AIM SE) <[hidden email]> > wrote: > > > From: Stein, Luba (AIM SE) <[hidden email]> > > Subject: [R] Uncorrelated random vectors > > To: "[hidden email]" <[hidden email]> > > Received: Tuesday, 7 July, 2009, 11:45 PM > > Hello, > > > > is it possible to create two uncorrelated random vectors > > for a given distribution. > > > > In fact, I would like to have something like the function > > "rnorm" or "rlogis" with the extra property that they are > > uncorrelated. > > > > Thanks for your help, > > Luba > > > > > > > > > > ??? [[alternative HTML version deleted]] > > > > ______________________________________________ > > [hidden email] > > mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > > and provide commented, minimal, self-contained, > > reproducible code. > > > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 56 Date: Wed, 8 Jul 2009 09:10:45 -0700 (PDT) Subject: Re: [R] #INCLUDE To: [hidden email], Idgarad <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain source(_external_file_name) --- On Wed, 7/8/09, Idgarad <[hidden email]> wrote: From: Idgarad <[hidden email]> Subject: [R] #INCLUDE To: [hidden email] Date: Wednesday, July 8, 2009, 11:16 AM What is R's equivalent to a C-like #include to incorporate external files. I have a 2k line function that is generated and need to include it at runtime but not manage it as a package (as it changes hourly.) Any ideas? [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/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]] ------------------------------ Message: 57 Date: Wed, 08 Jul 2009 09:15:47 -0700 From: Duncan Temple Lang <[hidden email]> Subject: Re: [R] Import xlsx file in Ubuntu 9.04 To: Marc Schwartz <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed I did some preliminary work on xslx (and docx and pptx) files some time ago and will hopefully finish things off by the end of summer. We can read these with a combination of the Rcompression and XML package. I have put versions of two packages (ROOXML and RExcelXML) at    http://www.omegahat.org/Prerelease/ (ROOXML_0.1-0.tar.gz and RExcelXML_0.1-0.tar.gz) There are no guarantees about how they work at this point, but the basic structures are there. I'd be happy to hear about any problems and to try to add functionality. Given the framework, it should be relatively easy to add support for additional cell types, etc.    D. Marc Schwartz wrote: > On Jul 8, 2009, at 6:56 AM, Rodrigo Aluizio wrote: > >> Hi list, >> By the entire last 2 weeks I was looking for a way to directly import >> xlsx >> files to R in a Linux OS (Ubuntu 9.04). I already read the R >> Import/Export >> guide, and I know how to use gdata to import xls files and read.table to >> import .csv. My problem is that all data that I receive is in the xlsx >> format, and I have to convert all the files to xls. >> Well, when I was using Windows Vista OS, RODBC did the trick with the >> odbcConnectExcel2007 function (which I know is not present in the Linux >> RODBC package, probably due to drivers issue). Isn't there a way to >> import >> this xlsx files directly to R without any previous conversion (.csv or >> .xls)? >> >> Thank you for the attention, it's probable that some one already asked >> it. I >> even remember seen that somewhere, but without a definitive answer. >> >> Rodrigo. > > > > Your best bet on Linux would be to open the Excel 2007 files using > OpenOffice's Calc and save them to CSV files. The latest versions of > OpenOffice will open Office 2007 files. > > An alternative of course would be to see if it is reasonable for the > providers of the files to save them in the older XLS format instead, or > to see if they have other file formats that they can send you rather > than using Excel at all. > > There is a very preliminary Perl module in progress, that should > eventually provide for a more efficient path: > >   http://search.cpan.org/dist/Spreadsheet-XLSX/ > > But from what I have seen, there are enough problems with it (including > data integrity issues), that I would not use it in production work. > > Unfortunately, I don't believe that you have a lot of options on Linux > at the moment. > > HTH, > > Marc Schwartz > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 58 Date: Wed, 8 Jul 2009 09:19:12 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] Randomizing a dataframe To: Mark Na <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 8:54 AM, Mark Na<[hidden email]> wrote: > Hi R-helpers, > > I have a dataframe (called data) with trees in rows (n=100) and insect > species (n=10) in columns. My tree IDs are in a column called TREE and each > species has a column labeled SPEC1, SPEC2, SPEC3, etc... > > I wish to randomize the values in my dataframe such that row and column > totals are held constant, i.e. in my randomized data each tree will have the > same number of individual insects as in the real data (constant row totals) > and each species will have the same number of individuals as in the real > data (constant column totals). > > I will eventually want to do this many times, but I would appreciate help > getting started with the randomization. > > Thank you, Mark Na > > ? ? ? ?[[alternative HTML version deleted]] > experiments in R which is on my list of to-do for the next month. I need to do something like rearrange the dates in one database as in Monte Carlo but then rearrange all my other databases so that dates still match up. It's just not bubbled to the top of the list yet. I took a quick look in Google and found MCMCpack pretty quickly. There's some documentation out there which is easy to find if it's of interest. Good luck and I'll be following the thread. cheers, Mark ------------------------------ Message: 59 Date: Wed, 8 Jul 2009 09:23:08 -0700 From: "William Dunlap" <[hidden email]> Subject: Re: [R] Reading from Google Docs To: "Gabor Grothendieck" <[hidden email]> Cc: R <[hidden email]>, Farrel Buchinsky <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Gabor Grothendieck > Sent: Wednesday, July 08, 2009 9:04 AM > To: Duncan Murdoch > Cc: R; Uwe Ligges; Farrel Buchinsky > Subject: Re: [R] Reading from Google Docs > > Its safer just to temporarily add it to your path. I recommend that also. Here is the SETPATH.BAT file that I put into my Rtools directory that sets up PATH so it can be used for building R and R packages. I run it from within the cmd window I will use for building packages. Note that it totally replaces the current value of PATH with a new one; it does not append or prepend entries to the existing one. You will have to adjust the entries for you own machine. It is safe to add other entries (like e:\cygwin\bin) to the end of this PATH, but you might run into trouble putting entries at the front of PATH. (I have a similar script to run before building packages for S+, whose package building system uses the Microsoft compilers and ActiveState perl but no cygwin tools.) E:\>type e:\Rtools\SETPATH.BAT set RTOOLS=E:\Rtools REM RHOME is for use in this script, R_HOME will be set by R itself. set RHOME=E:\R-svn\r-devel set PATH=C:\WINDOWS\system32;C:\WINDOWS set PATH=%RTOOLS%\bin;%RTOOLS%\perl\bin;%RTOOLS%\MinGW\bin;%PATH% set PATH=%RHOME%\bin;%PATH% set PATH=%PATH%;E:\Program Files\MiKTeX 2.7\miktex\bin set PATH=%PATH%;E:\Program Files\Inno Setup 5 set PATH=%PATH%;C:\Program Files\HTML Help Workshop set PATH=%PATH%;E:\Program Files\CollabNet Subversion Server Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.com > > Unfortunately Rtools has a find command that conflicts with > the find command in Windows so if you add the Rtools > bin directory to your path permanently then you could > find other programs stop working. That actually happened > to me once and it took the longest time until I discovered > that Rtools was the culprit. > > If you follow the advice I gave you normally won't have > that problem. > > On Wed, Jul 8, 2009 at 11:21 AM, Duncan > Murdoch<[hidden email]> wrote: > > On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: > >> > >> Forgive my naivte, but how do I make windows find tar. In > other words from > >> where do I issue the command and what is the command. > > > > You need to install the toolset, and let the installer set > your path. > > > > Duncan Murdoch > > > >> Farrel Buchinsky > >> Google Voice Tel: (412) 567-7870 > >> > >> > >> > >> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch > <[hidden email]> wrote: > >> > >>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: > >>> > >>>> I ?have previously read "R Installation and > Administration". I read it > >>>> again. It does not help me > >>>> The relevant paragraph is below. But I need lower level > instructions. > >>>> Where > >>>> can I find them. > >>>> > >>> Follow the link. ?If Windows can't find tar, your toolset > is installed > >>> incorrectly. > >>> > >>> Duncan Murdoch > >>> > >>> > >>>> R CMD INSTALL works in Windows to install source > packages if you have > >>>> the > >>>> source-code package files (option "Source Package > Installation Files" in > >>>> the > >>>> installer) and toolset (see The Windows > >>>> > >>>> > >>>> > toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admi > n.html#The-Windows-toolset>) > >>>> > >>>> installed. Installation of binary packages must be done by > >>>> install.packages > >>>> . R CMD INSTALL --help will tell you the current options > under Windows > >>>> (which differ from those on a Unix-alike): in particular > there is a > >>>> choice > >>>> of the types of documentation to be installed. > >>>> Farrel Buchinsky > >>>> Google Voice Tel: (412) 567-7870 > >>>> > >>>> > >>>> > >>>> 2009/6/19 Uwe Ligges <[hidden email]> > >>>> > >>>> ?See the manual "R Installation and Administration" for > information on > >>>> how > >>>>> > >>>>> to install source packages on Windows. > >>>>> > >>>>> Uwe Ligges > >>>>> > >>>>> Farrel Buchinsky wrote: > >>>>> > >>>>> ?After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI > am getting an > >>>>> error > >>>>>> > >>>>>> message > >>>>>> 'tar' is not recongnized as an internal or external > command, operable > >>>>>> program or batch file. > >>>>>> > >>>>>> Should I use my 7-zip to open up the archive? > >>>>>> Where should I be doing this? For instance can I do it > all in my > >>>>>> download directory or should I do it in C:\Program > >>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program > >>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all > there or will the > >>>>>> Rcmd > >>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. > >>>>>> > >>>>>> Yes, you assumed correctly. I am using Windows XP. > >>>>>> Farrel Buchinsky > >>>>>> Google Voice Tel: (412) 567-7870 > >>>>>> > >>>>>> > >>>>>> > >>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck > >>>>>> <[hidden email]>wrote: > >>>>>> > >>>>>> ?I have haven't neen following this thread but: > >>>>>> > >>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as > >>>>>>> opposed to built source) then the first line renames it so > >>>>>>> that its not the same name as the built file about to > be created. > >>>>>>> The second line detars it into the RGoogleDocs > directory. ?The third > >>>>>>> builds > >>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. ?The fourth > >>>>>>> installs the built source file into R. ?I've assumed Windows. > >>>>>>> If you are on Linux replace rename with mv. > >>>>>>> > >>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz > >>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz > >>>>>>> Rcmd build RGoogleDocs > >>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz > >>>>>>> > >>>>>>> or > >>>>>>> > >>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built > source file then > >>>>>>> you > >>>>>>> can just issue the last of the above lines and don't need > >>>>>>> the others. > >>>>>>> > >>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel > Buchinsky<[hidden email]> > >>>>>>> wrote: > >>>>>>> > >>>>>>> ?What do you mean by "cd the.directory.containing.RGoogleDocs" > >>>>>>>> > >>>>>>>> Do you mean the directory where I downloaded the > >>>>>>>> RGoogleDocs_0.2-2.tar.gz > >>>>>>>> to? Or do you mean that I must create a directory > called RGoogleDocs > >>>>>>>> > >>>>>>>> ?under > >>>>>>> > >>>>>>> ?Library and then change to that directory? > >>>>>>>> > >>>>>>>> Farrel Buchinsky > >>>>>>>> Google Voice Tel: (412) 567-7870 > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < > >>>>>>>> > >>>>>>>> ?[hidden email]> > >>>>>>> > >>>>>>> ?wrote: > >>>>>>>> > >>>>>>>> ?Finally enter into the Windows console: > >>>>>>>>> > >>>>>>>>> cd the.directory.containing.RGoogleDocs > >>>>>>>>> Rcmd build RGoogleDocs > >>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz > >>>>>>>>> > >>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename > >>>>>>>>> created by the build. > >>>>>>>>> > >>>>>>>>> ? ? ? [[alternative HTML version deleted]] > >>>>>> > >>>>>> ______________________________________________ > >>>>>> [hidden email] mailing list > >>>>>> https://stat.ethz.ch/mailman/listinfo/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]] > >>>> > >>>> > >>>> > >>>> > -------------------------------------------------------------- > ---------- > >>>> > >>>> ______________________________________________ > >>>> [hidden email] mailing list > >>>> https://stat.ethz.ch/mailman/listinfo/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]] > >> > >> > >> > >> > -------------------------------------------------------------- > ---------- > >> > >> ______________________________________________ > >> [hidden email] mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > > [hidden email] mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 60 Date: Wed, 8 Jul 2009 10:33:08 -0600 From: Greg Snow <[hidden email]> Subject: Re: [R] bigglm() results different from glm()+Another    question To: utkarshsinghal <[hidden email]> Cc: r help <[hidden email]>, Thomas Lumley    <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain OK, it appears that the problem is the df.resid component of the biglm object. Everything else is being updated by the update function except the df.resid piece, so it is based solely on the initial fit and the chunksize used there. The df.resid piece is then used in the computation of the AIC and hence the differences that you see. There could also be a difference in the p-values and confidence intervals, but at those high of numbers, the differences are smaller than can be seen at the level of rounding done. This appears to be a bug/overlooked piece to me, Thomas is cc'd on this so he should be able to fix this. A work around in the meantime is to do something like: > fit$df.resid <- 10000-4 Then compute the AIC. Also as an aside, if you change your seq to: seq(chunksize, 10000-chunksize, chunksize) then you won't get the error messages. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email] 801.408.8111 From: utkarshsinghal [mailto:[hidden email]] Sent: Wednesday, July 08, 2009 2:24 AM To: Greg Snow Cc: Thomas Lumley; r help Subject: Re: [R] bigglm() results different from glm()+Another question Hi Greg, Many thanks for your precious time. Here is a workable code: set.seed(1) xx = data.frame(x1=runif(10000,0,10), x2=runif(10000,0,10), x3=runif(10000,0,10)) xx$y = 3 + xx$x1 + 2*xx$x2 + 3*xx$x3 + rnorm(10000) chunksize = 500 fit = biglm(y~x1+x2+x3, data=xx[1:chunksize,]) for(i in seq(chunksize,10000,chunksize)) fit=update(fit, moredata=xx[(i+1):(i+chunksize),]) AIC(fit) [1] 28956.91 And the AIC for other chunksizes: chunksize  AIC 500     28956.91 1000    27956.91 2000    25956.91 2500    24956.91 5000    19956.91 10000    9956.91 Also I noted that the estimated coefficients are not dependent on chunksize and AIC is exactly a linear function of chunksize. So I guess it is some problem with the calculation of AIC, may be in some degree of freedom or adding some constant somewhere. And my comments below. Regards Utkarsh Greg Snow wrote: How many rows does xx have? Let's look at your example for chunksize 10000, you initially fit the first 10000 observations, then the seq results in just the value 10000 which means that you do the update based on vaues 10001 through 20000, if xx only has 10000 rows, then this should give at least one error. If xx has 20000 or more rows, then only chunksize 10000 will ever see the 20000th value, the other chunksizes will use less of the data. Understood your point and apologize that you had to spend time going into the logic inside for loop. I definitely thought of that but my actual problem was the variation in AICs (which I was sure about), so to ignore this loop problem (temporarily), I deliberately chose the chunksizes such that the number of rows is a multiple of chunksize. I knew there is still one extra iteration happening and I checked that it was not causing any problem, the "moredata" in the last iteration will be all NA's and "update" does nothing in such a case. For example: Let's say chunksize=5000, even though "xx" has only 10000 rows, "fit2" and "fit3" below are exactly same. fit1 = biglm(y~x1+x2+x3, data=xx[1:5000,]) fit2 = update(fit1, moredata=xx[5001:10000,]) fit3 = update(fit2, moredata=xx[10001:15000,]) AIC(fit1); AIC(fit2); AIC(fit3) [1] 5018.282 [1] 19956.91 [1] 19956.91 (The AIC matches with the table above and no warnings at all) I checked all these things before sending my first mail and dropped the idea of refining the for loop as this will save me a few lines of code and also the loop looks good and easy to understand. Moreover it is neither taking any extra run time nor producing any warnings or errors. Also looking at the help for update.biglm, the 2nd argument is "moredata" not "data", so if the code below is the code that you actually ran, then the new data chunks are going into the "..." argument (and being ignored as that is there for future expansion and does nothing yet) and the "moredata" argument is left empty, which should also be giving an error. For the code below, the model is only being fit to the initial chunk and never updated, so with different chunk sizes, there is different amounts of data per model. You can check this by doing summary(fit) and looking at the sample size in the 2nd line. My fault in writing the mail. In the actual code, I gave "update(fit, xx[(i+1):(i+chunksize),])" ,i.e., I just passed the new chunk as the 2nd argument without mentioning the argument name, which is correct, but while writing the mail I added the argument name as "data" without checking what it is. It is easier for us to help you if you provide code that can be run by copying and pasting (we don't have xx, so we can't just run the code below, you could include a line to randomly generate an xx, or a link to where a copy of xx can be downloaded from). It also helps if you mention any errors or warnings that you receive in the process of running your code. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email]<mailto:[hidden email]> 801.408.8111 From: utkarshsinghal [mailto:[hidden email]] Sent: Tuesday, July 07, 2009 12:10 AM To: Greg Snow Cc: Thomas Lumley; r help Subject: Re: [R] bigglm() results different from glm()+Another question Trust me, it is the same total data I am using, even the chunksizes are all equal. I also crosschecked by manually creating the chunks and updating as in example given on biglm help page. > ?biglm Regards Utkarsh Greg Snow wrote: Are you sure that you are fitting all the models on the same total data? A first glance looks like you may be including more data in some of the chunk sizes, or be producing an error that update does not know how to deal with. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email]<mailto:[hidden email]> 801.408.8111 From: utkarshsinghal [mailto:[hidden email]] Sent: Monday, July 06, 2009 8:58 AM To: Thomas Lumley; Greg Snow Cc: r help Subject: Re: [R] bigglm() results different from glm()+Another question The AIC of the biglm models is highly dependent on the size of chunks selected (example provided below). This I can somehow expect because the model error will increase with the number of chunks. It will be helpful if you can provide your opinion for comparing different models in such cases: *   can I compare two models fitted with different chunksizes, or should I always use the same chunk size. *   although I am not going to use AIC at all in my model selection, but I think any other model parameters will also vary in the same way. Am I right? *   what would be the ideal chunksize? should it be the maximum possible size R and my system's RAM is able to handle? Any comments will be helpful. Example of AIC variation with chunksize: I ran the following code on my data which has 10000 observations and 3 independent variables > chunksize = 500 > fit = biglm(y~x1+x2+x3, data=xx[1:chunksize,]) > for(i in seq(chunksize,10000,chunksize)) fit=update(fit, data=xx[(i+1):(i+chunksize),]) > AIC(fit) [1] 30647.79 Here are the AIC for other chunksizes: chunksize  AIC 500     30647.79 1000    29647.79 2000    27647.79 2500    26647.79 5000    21647.79 10000   11647.79 Regards Utkarsh utkarshsinghal wrote: Thank you Mr. Lumley and Mr. Greg. That was helpful. Regards Utkarsh Thomas Lumley wrote: On Fri, 3 Jul 2009, utkarshsinghal wrote: Hi Sir, Thanks for making package available to us. I am facing few problems if you can give some hints: Problem-1: The model summary and residual deviance matched (in the mail below) but I didn't understand why AIC is still different. AIC(m1) [1] 532965 AIC(m1big_longer) [1] 101442.9 That's because AIC.default uses the unnormalized loglikelihood and AIC.biglm uses the deviance. Only differences in AIC between models are meaningful, not individual values. Problem-2: chunksize argument is there in bigglm but not in biglm, consequently, udate..biglm is there, but not update.bigglm Is my observation correct? If yes, why is this difference? Because update.bigglm is impossible. Fitting a glm requires iteration, which means that it requires multiple passes through the data. Fitting a linear model requires only a single pass. update.biglm can take a fitted or partially fitted biglm and add more data. To do the same thing for a bigglm you would need to start over again from the beginning of the data set. To fit a glm, you need to specify a data source that bigglm() can iterate over. You do this with a function that can be called repeatedly to return the next chunk of data.    -thomas Thomas Lumley      Assoc. Professor, Biostatistics [hidden email]<mailto:[hidden email]>  University of Washington, Seattle I don't know why the AIC is different, but remember that there are multiple definitions for AIC (generally differing in the constant added) and it may just be a difference in the constant, or it could be that you have not fit the whole dataset (based on your other question). For an lm model biglm only needs to make a single pass through the data. This was the first function written for the package and the update mechanism was an easy way to write the function (and still works well). The bigglm function came later and the models other than Gaussian require multiple passes through the data so instead of the update mechanism that biglm uses, bigglm requires the data argument to be a function that returns the next chunk of data and can restart to the beginning of the dataset. Also note that the bigglm function usually only does a few passes through the data, usually this is good enough, but in some cases you may need to increase the number of passes. Hope this helps,    [[alternative HTML version deleted]] ------------------------------ Message: 61 Date: Wed, 8 Jul 2009 08:09:33 -0700 (PDT) From: tathta <[hidden email]> Subject: [R] matching each row To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii I have two dataframes, the first column of each dataframe is a unique id number (the rest of the columns are data variables). I would like to figure out how many times each id number appears in each dataframe. So far I can use: length( match (dataframeA$unique.id[1], dataframeB$unique.id) ) but this only works on each row of dataframe A one-at-a-time. I would like to do this for all of the rows in dataframe A, and then put the results in a new variable: dataframeA$count [[elided Yahoo spam]] Sorry if this question has already been answered, my search of the archives only brought up one relevant post, and I didn't understand the answer to it.... http://www.nabble.com/match-to20799206.html#a20799206 thx -- View this message in context: http://www.nabble.com/matching-each-row-tp24393051p24393051.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 62 Date: Wed, 8 Jul 2009 08:41:14 -0700 (PDT) From: mister_bluesman <[hidden email]> Subject: [R] Extracting a column name in loop? To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii Hi, I am writing a script that will address columns using syntax like: data_set[,1] to extract the data from the first column of my data set, for example. This code will be placed in a loop (where the column reference will be placed by a variable). What I also need to do is extract the column NAME for a given column being processed in the loop. The dataframe has been set so that R knows that the top line refers to column headers. Can anyone help me understand how to do this? Thanks. -- View this message in context: http://www.nabble.com/Extracting-a-column-name-in-loop--tp24393160p24393160.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 63 Date: Wed, 8 Jul 2009 09:53:09 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] Extracting a column name in loop? To: mister_bluesman <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 8:41 AM, mister_bluesman<[hidden email]> wrote: > > Hi, > > I am writing a script that will address columns using syntax like: > > data_set[,1] > > to extract the data from the first column of my data set, for example. This > code will be placed in a loop (where the column reference will be placed by > a variable). > > What I also need to do is extract the column NAME for a given column being > processed in the loop. The dataframe has been set so that R knows that the > top line refers to column headers. > > Can anyone help me understand how to do this? > > Thanks. names(data_set)[i] ? HTH, Mark ------------------------------ Message: 64 Date: Wed, 08 Jul 2009 12:55:15 -0400 From: Duncan Murdoch <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed On 08/07/2009 12:04 PM, Gabor Grothendieck wrote: > Its safer just to temporarily add it to your path. > > Unfortunately Rtools has a find command that conflicts with > the find command in Windows so if you add the Rtools > bin directory to your path permanently then you could > find other programs stop working. That actually happened > to me once and it took the longest time until I discovered > that Rtools was the culprit. That's true, but there is a workaround: you can manually rename the find.exe in Rtools, and adjust the entry in one of the R makefiles (MkRules), and it will use the new name instead of "find". The reason you might not want to do this is you might expect find to act the way it does on Unix: the Rtools basically try to make Windows look a little bit like Unix. Duncan Murdoch > > If you follow the advice I gave you normally won't have > that problem. > > On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> wrote: >> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>> Forgive my naivte, but how do I make windows find tar. In other words from >>> where do I issue the command and what is the command. >> You need to install the toolset, and let the installer set your path. >> >> Duncan Murdoch >> >>> Farrel Buchinsky >>> Google Voice Tel: (412) 567-7870 >>> >>> >>> >>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> wrote: >>> >>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>> >>>>> I have previously read "R Installation and Administration". I read it >>>>> again. It does not help me >>>>> The relevant paragraph is below. But I need lower level instructions. >>>>> Where >>>>> can I find them. >>>>> >>>> Follow the link. If Windows can't find tar, your toolset is installed >>>> incorrectly. >>>> >>>> Duncan Murdoch >>>> >>>> >>>>> R CMD INSTALL works in Windows to install source packages if you have >>>>> the >>>>> source-code package files (option ?Source Package Installation Files? in >>>>> the >>>>> installer) and toolset (see The Windows >>>>> >>>>> >>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>> >>>>> installed. Installation of binary packages must be done by >>>>> install.packages >>>>> . R CMD INSTALL --help will tell you the current options under Windows >>>>> (which differ from those on a Unix-alike): in particular there is a >>>>> choice >>>>> of the types of documentation to be installed. >>>>> Farrel Buchinsky >>>>> Google Voice Tel: (412) 567-7870 >>>>> >>>>> >>>>> >>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>> >>>>> See the manual "R Installation and Administration" for information on >>>>> how >>>>>> to install source packages on Windows. >>>>>> >>>>>> Uwe Ligges >>>>>> >>>>>> Farrel Buchinsky wrote: >>>>>> >>>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>> error >>>>>>> message >>>>>>> 'tar' is not recongnized as an internal or external command, operable >>>>>>> program or batch file. >>>>>>> >>>>>>> Should I use my 7-zip to open up the archive? >>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>> download directory or should I do it in C:\Program >>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the >>>>>>> Rcmd >>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>> >>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>> Farrel Buchinsky >>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>> <[hidden email]>wrote: >>>>>>> >>>>>>> I have haven't neen following this thread but: >>>>>>> >>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>> opposed to built source) then the first line renames it so >>>>>>>> that its not the same name as the built file about to be created. >>>>>>>> The second line detars it into the RGoogleDocs directory. The third >>>>>>>> builds >>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>>>>> installs the built source file into R. I've assumed Windows. >>>>>>>> If you are on Linux replace rename with mv. >>>>>>>> >>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>> Rcmd build RGoogleDocs >>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>> >>>>>>>> or >>>>>>>> >>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then >>>>>>>> you >>>>>>>> can just issue the last of the above lines and don't need >>>>>>>> the others. >>>>>>>> >>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>>>>>> wrote: >>>>>>>> >>>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>> to? Or do you mean that I must create a directory called RGoogleDocs >>>>>>>>> >>>>>>>>> under >>>>>>>> Library and then change to that directory? >>>>>>>>> Farrel Buchinsky >>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>> >>>>>>>>> [hidden email]> >>>>>>>> wrote: >>>>>>>>> Finally enter into the Windows console: >>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>> >>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>> created by the build. >>>>>>>>>> >>>>>>>>>>     [[alternative HTML version deleted]] >>>>>>> ______________________________________________ >>>>>>> [hidden email] mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 65 Date: Wed, 08 Jul 2009 17:19:22 +0200 From: [hidden email] Subject: [R] Simple monovariate classification? To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-15; DelSp="Yes";    format="flowed" I'm looking for an R function that simply recodes a quantitative variable into a number of classes according to specified break-points.  Obviously I can do this using nested ifelse() commands, but I want to write it into a function where I can't pre-specify the number of classes. Is there an obvious way to do this? An example to clarify: how to convert c(0,10,5,1,9,6) to c(1,3,2,1,3,2) by specifying "breaks"=c(2.5,7.5) - or something like that. Thanks, Richard Gunton. INRA-Dijon, France ------------------------------ Message: 66 Date: Wed, 8 Jul 2009 12:59:48 -0400 From: Farrel Buchinsky <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <[hidden email]> Cc: Uwe Ligges <[hidden email]>, R    <[hidden email]>,   Duncan Murdoch <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain Does changing the path in Windows work in real time or does one need to restart the computer for the changes to take effect. Farrel Buchinsky Google Voice Tel: (412) 567-7870 On Wed, Jul 8, 2009 at 12:04, Gabor Grothendieck <[hidden email]>wrote: > Its safer just to temporarily add it to your path. > > Unfortunately Rtools has a find command that conflicts with > the find command in Windows so if you add the Rtools > bin directory to your path permanently then you could > find other programs stop working. That actually happened > to me once and it took the longest time until I discovered > that Rtools was the culprit. > > If you follow the advice I gave you normally won't have > that problem. > > On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> > wrote: > > On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: > >> > >> Forgive my naivte, but how do I make windows find tar. In other words > from > >> where do I issue the command and what is the command. > > > > You need to install the toolset, and let the installer set your path. > > > > Duncan Murdoch > > > >> Farrel Buchinsky > >> Google Voice Tel: (412) 567-7870 > >> > >> > >> > >> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> > wrote: > >> > >>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: > >>> > >>>> I have previously read "R Installation and Administration". I read it > >>>> again. It does not help me > >>>> The relevant paragraph is below. But I need lower level instructions.. > >>>> Where > >>>> can I find them. > >>>> > >>> Follow the link. If Windows can't find tar, your toolset is installed > >>> incorrectly. > >>> > >>> Duncan Murdoch > >>> > >>> > >>>> R CMD INSTALL works in Windows to install source packages if you have > >>>> the > >>>> source-code package files (option âSource Package Installation Filesâ > in > >>>> the > >>>> installer) and toolset (see The Windows > >>>> > >>>> > >>>> > toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) > >>>> > >>>> installed. Installation of binary packages must be done by > >>>> install.packages > >>>> . R CMD INSTALL --help will tell you the current options under Windows > >>>> (which differ from those on a Unix-alike): in particular there is a > >>>> choice > >>>> of the types of documentation to be installed. > >>>> Farrel Buchinsky > >>>> Google Voice Tel: (412) 567-7870 > >>>> > >>>> > >>>> > >>>> 2009/6/19 Uwe Ligges <[hidden email]> > >>>> > >>>> See the manual "R Installation and Administration" for information on > >>>> how > >>>>> > >>>>> to install source packages on Windows. > >>>>> > >>>>> Uwe Ligges > >>>>> > >>>>> Farrel Buchinsky wrote: > >>>>> > >>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an > >>>>> error > >>>>>> > >>>>>> message > >>>>>> 'tar' is not recongnized as an internal or external command, > operable > >>>>>> program or batch file. > >>>>>> > >>>>>> Should I use my 7-zip to open up the archive? > >>>>>> Where should I be doing this? For instance can I do it all in my > >>>>>> download directory or should I do it in C:\Program > >>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program > >>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the > >>>>>> Rcmd > >>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. > >>>>>> > >>>>>> Yes, you assumed correctly. I am using Windows XP. > >>>>>> Farrel Buchinsky > >>>>>> Google Voice Tel: (412) 567-7870 > >>>>>> > >>>>>> > >>>>>> > >>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck > >>>>>> <[hidden email]>wrote: > >>>>>> > >>>>>> I have haven't neen following this thread but: > >>>>>> > >>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as > >>>>>>> opposed to built source) then the first line renames it so > >>>>>>> that its not the same name as the built file about to be created. > >>>>>>> The second line detars it into the RGoogleDocs directory. The > third > >>>>>>> builds > >>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth > >>>>>>> installs the built source file into R. I've assumed Windows.. > >>>>>>> If you are on Linux replace rename with mv. > >>>>>>> > >>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz > >>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz > >>>>>>> Rcmd build RGoogleDocs > >>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz > >>>>>>> > >>>>>>> or > >>>>>>> > >>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then > >>>>>>> you > >>>>>>> can just issue the last of the above lines and don't need > >>>>>>> the others. > >>>>>>> > >>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email] > > > >>>>>>> wrote: > >>>>>>> > >>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" > >>>>>>>> > >>>>>>>> Do you mean the directory where I downloaded the > >>>>>>>> RGoogleDocs_0.2-2.tar.gz > >>>>>>>> to? Or do you mean that I must create a directory called > RGoogleDocs > >>>>>>>> > >>>>>>>> under > >>>>>>> > >>>>>>> Library and then change to that directory? > >>>>>>>> > >>>>>>>> Farrel Buchinsky > >>>>>>>> Google Voice Tel: (412) 567-7870 > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < > >>>>>>>> > >>>>>>>> [hidden email]> > >>>>>>> > >>>>>>> wrote: > >>>>>>>> > >>>>>>>> Finally enter into the Windows console: > >>>>>>>>> > >>>>>>>>> cd the.directory.containing.RGoogleDocs > >>>>>>>>> Rcmd build RGoogleDocs > >>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz > >>>>>>>>> > >>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename > >>>>>>>>> created by the build. > >>>>>>>>> > >>>>>>>>>     [[alternative HTML version deleted]] > >>>>>> > >>>>>> ______________________________________________ > >>>>>> [hidden email] mailing list > >>>>>> https://stat.ethz.ch/mailman/listinfo/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]] > >>>> > >>>> > >>>> > >>>> > ------------------------------------------------------------------------ > >>>> > >>>> ______________________________________________ > >>>> [hidden email] mailing list > >>>> https://stat.ethz.ch/mailman/listinfo/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]] > >> > >> > >> > >> ------------------------------------------------------------------------ > >> > >> ______________________________________________ > >> [hidden email] mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > > [hidden email] mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > ------------------------------ Message: 67 Date: Wed, 8 Jul 2009 11:11:14 -0600 From: Greg Snow <[hidden email]> Subject: Re: [R] Two-way ANOVA gives different results using    anova(lm()) than doing it by hand To: Lars Bergemann <[hidden email]>,    "[hidden email]"   <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset="us-ascii" Well, since we don't have Data.txt it is kind of hard for us to replicate what you have done. Here goes a guess as to what the problem may be. Have you told R anywhere that S1 and S2 are factors with 6 levels rather than numeric vectors? Or are you just hoping that the computer can read your mind to find out this information? (reading minds is one of the things that R and computers in general are not very good at yet. I have made a note to my future self to use the TimeTravel package to send a copy of the ESP package back to my past self, but I have not received it yet). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email] 801.408.8111 > -----Original Message----- > From: [hidden email] [mailto:r-help-bounces@r- > project.org] On Behalf Of Lars Bergemann > Sent: Wednesday, July 08, 2009 8:35 AM > To: [hidden email] > Subject: [R] Two-way ANOVA gives different results using anova(lm()) > than doing it by hand > > > Hey! > > > > Could you please take a quick look at what I have done? Somehow I get > wrong results using the anova(lm()) combination compared to doing a two > way ANOVA by hand. > > > > Running: > > > > Data<-read.table("Data.txt"); > g<-lm(ExM~S1*S2,Data); > anova(g); > > > > Gives: > > > > Analysis of Variance Table > > Response: ExM >      Df Sum Sq Mean Sq F value  Pr(>F) > S1     1 4.3679 4.3679 167.045 < 2.2e-16 *** > S2     1 0.9427 0.9427 36.053 8..236e-09 *** > S1:S2     1 0.3231 0.3231 12.357 0..0005371 *** > Residuals 212 5.5434 0.0261 > > > I compared it to the work done by hand, ie calculated all the different > square sums using sum() and tapply(). > > So I know that anova(lm()) gets the degrees of freedom equal two 1, 1, > 1 and 212 when it should be 5, 5, 25 and 180. Also, the square sums are > quite different ... I get 4.xx, 4.xx, 1.xx, 0.xx ... as you see, what > anova(lm()) gets is different. > > > > The data: S1 has 6 levels, so has S2. On average, each cell has 6 > values, most cells have actually 6 values, and there are two of each: > 5, 7, 4, 8 - so average 6. > > > > Could you please help me, why it does not work with anova(lm())? I > tried quite a few thinks found with Google, but it all gave me the same > result as anova(lm()) ... > > > > Thanks a lot! > > > > Lars > > _________________________________________________________________ > > ------------------------------ Message: 68 Date: Wed, 8 Jul 2009 10:14:02 -0700 (PDT) From: John Kane <[hidden email]> Subject: Re: [R] #INCLUDE To: [hidden email], Idgarad <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=iso-8859-1 ?source perhaps? --- On Wed, 7/8/09, Idgarad <[hidden email]> wrote: > From: Idgarad <[hidden email]> > Subject: [R] #INCLUDE > To: [hidden email] > Received: Wednesday, July 8, 2009, 11:16 AM > What is R's equivalent to a C-like > #include to incorporate external files. I > have a 2k line function that is generated and need to > include it at runtime > but not manage it as a package (as it changes hourly.) Any > ideas?    __________________________________________________________________ The new Internet Explorer? 8 - Faster, safer, easier. Optimized for Y xplorer/ ------------------------------ Message: 69 Date: Wed, 08 Jul 2009 12:19:49 -0500 From: Marc Schwartz <[hidden email]> Subject: Re: [R] Two-way ANOVA gives different results using    anova(lm()) than doing it by hand To: Greg Snow <[hidden email]> Cc: r-help <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Jul 8, 2009, at 12:11 PM, Greg Snow wrote: > Well, since we don't have Data.txt it is kind of hard for us to > replicate what you have done. > > Here goes a guess as to what the problem may be. > > Have you told R anywhere that S1 and S2 are factors with 6 levels > rather than numeric vectors? Or are you just hoping that the > computer can read your mind to find out this information? > > (reading minds is one of the things that R and computers in general > are not very good at yet. I have made a note to my future self to > use the TimeTravel package to send a copy of the ESP package back to > my past self, but I have not received it yet). A definite Fortunes candidate. Marc Schwartz ------------------------------ Message: 70 Date: Wed, 8 Jul 2009 13:23:29 -0400 From: "David Huffer" <[hidden email]> Subject: Re: [R] matching each row To: "tathta" <[hidden email]>, <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Something like this?  > dataframeA <- data.frame (  +   unique.id= c(1,1,3,3,3,5,7,7, 9)  +   , x1=rnorm(9)  +   , x2=rnorm(9)  +   , x3=rnorm(9)  + )  > dataframeB <- data.frame (  +   unique.id= c(2,3,4,5,5,5,6,7,9,10,10)  +   , x4=rnorm(11)  +   , x5=rnorm(11)  +   , x6=rnorm(11)  + )  > match.counts <- function ( x , y ) {  +   out <- cbind (  +    table ( x [ which ( x %in% y ) ] )  +    , table ( y [ which ( y %in% x ) ] )  +   )  +   dimnames ( out ) [[2]] <- c ( "N in x" , "N in y" )  +   out  + }  > match.counts ( dataframeA$unique.id , dataframeB$unique.id )   N in x N in y  3   3   1  5   1   3  7   2   1  9   1   1  > -- David ? ----------------------------------------------------- David Huffer, Ph.D.         Senior Statistician CSOSA/Washington, DC       [hidden email] ----------------------------------------------------- -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of tathta Sent: Wednesday, July 08, 2009 11:10 AM To: [hidden email] Subject: [R] matching each row I have two dataframes, the first column of each dataframe is a unique id number (the rest of the columns are data variables). I would like to figure out how many times each id number appears in each dataframe. So far I can use: length( match (dataframeA$unique.id[1], dataframeB$unique.id) ) but this only works on each row of dataframe A one-at-a-time. I would like to do this for all of the rows in dataframe A, and then put the results in a new variable: dataframeA$count [[elided Yahoo spam]] Sorry if this question has already been answered, my search of the archives only brought up one relevant post, and I didn't understand the answer to it.... http://www.nabble.com/match-to20799206.html#a20799206 thx -- View this message in context: http://www.nabble.com/matching-each-row-tp24393051p24393051.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 71 Date: Wed, 8 Jul 2009 11:28:20 -0600 From: Greg Snow <[hidden email]> Subject: Re: [R] Randomizing a dataframe To: Mark Na <[hidden email]>, "[hidden email]"    <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset="us-ascii" Here is one approach (there are others, some that are probably better, but this can get you started): 1. rearrange your data so that every insect is a single row with 2 columns: the tree id and the species (this new dataset will have as many rows as the sum of the values in the old dataset). The reshape package may be able to help with this step (you may also need the rep function). 2. randomly permute one of the 2 columns (see ?sample). 3. restructure the permuted data back to the original (the table function may be enough here, the reshape package will give more options). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email] 801.408.8111 > -----Original Message----- > From: [hidden email] [mailto:r-help-bounces@r- > project.org] On Behalf Of Mark Na > Sent: Wednesday, July 08, 2009 9:54 AM > To: [hidden email] > Subject: [R] Randomizing a dataframe > > Hi R-helpers, > > I have a dataframe (called data) with trees in rows (n=100) and insect > species (n=10) in columns. My tree IDs are in a column called TREE and > each > species has a column labeled SPEC1, SPEC2, SPEC3, etc... > > I wish to randomize the values in my dataframe such that row and column > totals are held constant, i.e. in my randomized data each tree will > have the > same number of individual insects as in the real data (constant row > totals) > and each species will have the same number of individuals as in the > real > data (constant column totals). > > I will eventually want to do this many times, but I would appreciate > help > getting started with the randomization. > > Thank you, Mark Na > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 72 Date: Wed, 08 Jul 2009 10:29:21 -0700 From: Greg Hirson <[hidden email]> Subject: Re: [R] Simple monovariate classification? To: [hidden email], [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Try ?cut Greg [hidden email] wrote: > > I'm looking for an R function that simply recodes a quantitative > variable into a number of classes according to specified break-points. > Obviously I can do this using nested ifelse() commands, but I want to > write it into a function where I can't pre-specify the number of > classes. Is there an obvious way to do this? > > An example to clarify: how to convert c(0,10,5,1,9,6) to > c(1,3,2,1,3,2) by specifying "breaks"=c(2.5,7.5) - or something like > that. > > Thanks, > > Richard Gunton. > INRA-Dijon, France > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. Greg Hirson [hidden email] Graduate Student Agricultural and Environmental Chemistry 1106 Robert Mondavi Institute North One Shields Avenue Davis, CA 95616 ------------------------------ Message: 73 Date: Wed, 08 Jul 2009 10:39:03 -0700 From: Greg Hirson <[hidden email]> Subject: Re: [R] Simple monovariate classification? To: [hidden email], [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Richard, More specifically, x = c(0,10,5,1,9,6) cut(x, breaks = c(-Inf, 2.5,7.5, Inf), labels = c(1, 2, 3)) #[1] 1 3 2 1 3 2 Hope that helps, Greg [hidden email] wrote: > > I'm looking for an R function that simply recodes a quantitative > variable into a number of classes according to specified break-points. > Obviously I can do this using nested ifelse() commands, but I want to > write it into a function where I can't pre-specify the number of > classes. Is there an obvious way to do this? > > An example to clarify: how to convert c(0,10,5,1,9,6) to > c(1,3,2,1,3,2) by specifying "breaks"=c(2.5,7.5) - or something like > that. > > Thanks, > > Richard Gunton. > INRA-Dijon, France > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. Greg Hirson [hidden email] Graduate Student Agricultural and Environmental Chemistry 1106 Robert Mondavi Institute North One Shields Avenue Davis, CA 95616 ------------------------------ Message: 74 Date: Wed, 8 Jul 2009 10:45:56 -0700 (PDT) From: tathta <[hidden email]> Subject: Re: [R] matching each row To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=UTF-8 Close...   The output I'm looking for is more like this: output <- data.frame(unique.id=c(1,3,5,7,9),N.in.x=c(2,3,1,2,1),N.in.y=c(0,1,3,1,1)) The first column can be gotten using a small change to the first table line: table ( x [ which ( x %in% x ) ] )   ##the 3rd "x" used to be a "y" but I can't modify it to make the second "ideal output" column, I just end up with warnings... Something like this?  > dataframeA <- data.frame (  +   unique.id= c(1,1,3,3,3,5,7,7, 9)  +   , x1=rnorm(9)  +   , x2=rnorm(9)  +   , x3=rnorm(9)  + )  > dataframeB <- data.frame (  +   unique.id= c(2,3,4,5,5,5,6,7,9,10,10)  +   , x4=rnorm(11)  +   , x5=rnorm(11)  +   , x6=rnorm(11)  + )  > match.counts <- function ( x , y ) {  +   out <- cbind (  +    table ( x [ which ( x %in% y ) ] )  +    , table ( y [ which ( y %in% x ) ] )  +   )  +   dimnames ( out ) [[2]] <- c ( "N in x" , "N in y" )  +   out  + }  > match.counts ( dataframeA$unique.id , dataframeB$unique.id )   N in x N in y  3   3   1  5   1   3  7   2   1  9   1   1  > -- David ? -- View this message in context: http://www.nabble.com/matching-each-row-tp24393051p24396184.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 75 Date: Wed, 08 Jul 2009 13:51:36 -0400 From: [hidden email] (Michael A. Miller) Subject: Re: [R] OK - I got the data - now what? :-) To: Mark Knecht <[hidden email]> Cc: r-help <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii >>>>> Mark wrote:   > Currently my data is one experiment per row, but that's   > wasting space as most experiments only take 20% of the row   > and 80% of the row is filled with 0's. I might want to make   > the array more narrow and have a flag somewhere in the 1st   > 10 columns that says the this row is a continuation row   > from the previous row. That way I could pack the array   > better, use less memory and when I do finally test for 0 I   > have a short line to traverse? This may be a bit off track from the data manipulation you are working on, but I thought I'd point out that another way to handle this sort of data is to make a table with one measurement per row, rather than one experiment per row. experiment measurement value       A       1 0.27       A       2 0.66       A       3 0.24       A       4 0.55       B       1 0.13       B       2 0.65       B       3 0.83       B       4 0.41       B       5 0.92       B       6 0.67       C       1 0.75       C       2 0.97       C       3 0.49       C       4 0.58       D       1 1.00       D       2 0.71       E       1 0.11       E       2 0.50       E       3 0.98       E       4 0.07       E       5 0.94       E       6 0.57       E       7 0.34       E       8 0.21 If you wrote the output of your calculations in this way, one value per line, it can easily be read into R as a data.frame and handled with less need for munging. No need to remove the zero-padding because the zeros aren't needed in the first place. You can subset the data with subset, as in  test <- read.table('test.dat',header=TRUE)  expA <- subset(test, experiment=='A')  expB <- subset(test, experiment=='B') so there is no need to deal with ragged/zero-padded arrays. Your plots can be grouped automatically with lattice: require(lattice) xyplot(value ~ measurement, data=test, group=experiment, type='b') xyplot(value ~ measurement | experiment, data=test, type='b') It is simple to do calculations by experiment using tapply. For example > with(test, tapply(value, experiment, mean))     A      B      C      D      E 0.4300000 0.6016667 0.6975000 0.8550000 0.4650000 > with(test, tapply(measurement, experiment, max)) A B C D E 4 6 4 2 8 Mike ------------------------------ Message: 76 Date: Wed, 8 Jul 2009 12:59:27 -0500 From: "Mikhail Titov" <[hidden email]> Subject: [R] typo in ts detrending implementation in spec.pgram? To: <[hidden email]> Message-ID: <002401c9fff5$d6540230$82fc0690$@edu> Content-Type: text/plain;   charset="UTF-8" Hello! I wonder if there is a typo in detrending code of spec.pgram in spectrum.R from stats package. One can see in the code https://svn.r-project.org/R/trunk/src/library/stats/R/spectrum.R . I am afraid there is a typo and the code should look like if (detrend) {    t <- 1L:N - (N + 1)/2    sumt2 <- N * (N^2 - 1)/12    for (i in 1L:ncol(x))       x[, i] <- x[, i] - mean(x[, i]) - sum((x[, i]-mean(x[,i]) * t) * t/sumt2   } Note x[, i]-mean(x[,i]) instead of x[,i] only as in repository. Here is a quick reference http://en.wikipedia.org/wiki/Simple_linear_regression#Estimating_the_regression_line . Note $\hat b$ there. It has not x in summation, but x-mean(x). Perhaps, the even better solution would be resid(lm(x[,i] ~ seq(along = x[,i]))) . See http://tolstoy.newcastle.edu.au/R/help/05/01/10115.html Mikhail ------------------------------ Message: 77 Date: Wed, 8 Jul 2009 14:06:28 -0400 From: Farrel Buchinsky <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <[hidden email]> Cc: Uwe Ligges <[hidden email]>, R    <[hidden email]>,   Duncan Murdoch <[hidden email]>,    Duncan Temple Lang <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain Hooray! I got it to work. Here is what I think happened.My hold up was that the tar command was not working. If you recall, when I issued the command: tar xvfz RgoogleDocs_0.2.2-src.tar.gz cmd.exe told me it could not be found I reran Rtools29.exe which is the Rtools setup program which offered to change my path. However it still did not work. I went to lunch and took the opportunity to reboot my computer. When I retried after lunch the tar command worked and everything thereafter worked. I think that the file C:\Program Files\R\Rtools\bin\tar.exe could not be found earlier. I just looked back at my path and I see that C:\Program Files\R\Rtools\bin is on the path. RgoogleDocs 0.2-2 is amazing. I can now read data straight into a dataframe.. The fact that I am always reading from realtime data is astounding. sheets.con = getGoogleDocsConnection(getGoogleAuth("[hidden email]", "password here", service = "wise")) ts2=getWorksheets("Consents Received",sheets.con)# put the name of the spreadsheet in the inverted commas names(ts2) sheetAsMatrix(ts2$Sheet1,header=TRUE, as.data.frame=TRUE, trim=TRUE) MAGIC Boy oh boy that process of getting source to binary was super painful. Now that I have the package as binary I can share the whole folder with my coworker and she is able to use RGoogleDocs. I intend to use the same process for the other two windows machines that I use. I really do not want to go through the same installation and path hassles all over again. Should I post my directory containing the binary files somewhere so that others do not have to experience pain. Does etiquette dictate that I should post the directory to help other or does etiquette dictate that it is Duncan Temple Lang's code and thus it his prerogative to distribute his work as he wishes? Farrel Buchinsky Google Voice Tel: (412) 567-7870 On Wed, Jul 8, 2009 at 12:59, Farrel Buchinsky <[hidden email]> wrote: > Does changing the path in Windows work in real time or does one need to > restart the computer for the changes to take effect. > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > > > > On Wed, Jul 8, 2009 at 12:04, Gabor Grothendieck <[hidden email]>wrote: > >> Its safer just to temporarily add it to your path. >> >> Unfortunately Rtools has a find command that conflicts with >> the find command in Windows so if you add the Rtools >> bin directory to your path permanently then you could >> find other programs stop working. That actually happened >> to me once and it took the longest time until I discovered >> that Rtools was the culprit. >> >> If you follow the advice I gave you normally won't have >> that problem. >> >> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >> wrote: >> > On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >> >> >> >> Forgive my naivte, but how do I make windows find tar. In other words >> from >> >> where do I issue the command and what is the command. >> > >> > You need to install the toolset, and let the installer set your path. >> > >> > Duncan Murdoch >> > >> >> Farrel Buchinsky >> >> Google Voice Tel: (412) 567-7870 >> >> >> >> >> >> >> >> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >> wrote: >> >> >> >>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >> >>> >> >>>> I have previously read "R Installation and Administration". I read >> it >> >>>> again. It does not help me >> >>>> The relevant paragraph is below. But I need lower level instructions. >> >>>> Where >> >>>> can I find them. >> >>>> >> >>> Follow the link. If Windows can't find tar, your toolset is installed >> >>> incorrectly. >> >>> >> >>> Duncan Murdoch >> >>> >> >>> >> >>>> R CMD INSTALL works in Windows to install source packages if you have >> >>>> the >> >>>> source-code package files (option âSource Package Installation Filesâ >> in >> >>>> the >> >>>> installer) and toolset (see The Windows >> >>>> >> >>>> >> >>>> >> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >> >>>> >> >>>> installed. Installation of binary packages must be done by >> >>>> install.packages >> >>>> . R CMD INSTALL --help will tell you the current options under >> Windows >> >>>> (which differ from those on a Unix-alike): in particular there is a >> >>>> choice >> >>>> of the types of documentation to be installed. >> >>>> Farrel Buchinsky >> >>>> Google Voice Tel: (412) 567-7870 >> >>>> >> >>>> >> >>>> >> >>>> 2009/6/19 Uwe Ligges <[hidden email]> >> >>>> >> >>>> See the manual "R Installation and Administration" for information >> on >> >>>> how >> >>>>> >> >>>>> to install source packages on Windows. >> >>>>> >> >>>>> Uwe Ligges >> >>>>> >> >>>>> Farrel Buchinsky wrote: >> >>>>> >> >>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >> >>>>> error >> >>>>>> >> >>>>>> message >> >>>>>> 'tar' is not recongnized as an internal or external command, >> operable >> >>>>>> program or batch file. >> >>>>>> >> >>>>>> Should I use my 7-zip to open up the archive? >> >>>>>> Where should I be doing this? For instance can I do it all in my >> >>>>>> download directory or should I do it in C:\Program >> >>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >> >>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the >> >>>>>> Rcmd >> >>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >> >>>>>> >> >>>>>> Yes, you assumed correctly. I am using Windows XP. >> >>>>>> Farrel Buchinsky >> >>>>>> Google Voice Tel: (412) 567-7870 >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >> >>>>>> <[hidden email]>wrote: >> >>>>>> >> >>>>>> I have haven't neen following this thread but: >> >>>>>> >> >>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >> >>>>>>> opposed to built source) then the first line renames it so >> >>>>>>> that its not the same name as the built file about to be created.. >> >>>>>>> The second line detars it into the RGoogleDocs directory. The >> third >> >>>>>>> builds >> >>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >> >>>>>>> installs the built source file into R. I've assumed Windows. >> >>>>>>> If you are on Linux replace rename with mv. >> >>>>>>> >> >>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >> >>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >> >>>>>>> Rcmd build RGoogleDocs >> >>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >> >>>>>>> >> >>>>>>> or >> >>>>>>> >> >>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then >> >>>>>>> you >> >>>>>>> can just issue the last of the above lines and don't need >> >>>>>>> the others. >> >>>>>>> >> >>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky< >> [hidden email]> >> >>>>>>> wrote: >> >>>>>>> >> >>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >> >>>>>>>> >> >>>>>>>> Do you mean the directory where I downloaded the >> >>>>>>>> RGoogleDocs_0.2-2.tar.gz >> >>>>>>>> to? Or do you mean that I must create a directory called >> RGoogleDocs >> >>>>>>>> >> >>>>>>>> under >> >>>>>>> >> >>>>>>> Library and then change to that directory? >> >>>>>>>> >> >>>>>>>> Farrel Buchinsky >> >>>>>>>> Google Voice Tel: (412) 567-7870 >> >>>>>>>> >> >>>>>>>> >> >>>>>>>> >> >>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >> >>>>>>>> >> >>>>>>>> [hidden email]> >> >>>>>>> >> >>>>>>> wrote: >> >>>>>>>> >> >>>>>>>> Finally enter into the Windows console: >> >>>>>>>>> >> >>>>>>>>> cd the.directory.containing.RGoogleDocs >> >>>>>>>>> Rcmd build RGoogleDocs >> >>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >> >>>>>>>>> >> >>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >> >>>>>>>>> created by the build. >> >>>>>>>>> >> >>>>>>>>>     [[alternative HTML version deleted]] >> >>>>>> >> >>>>>> ______________________________________________ >> >>>>>> [hidden email] mailing list >> >>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >> >>>> >> >>>> >> >>>> >> >>>> >> ------------------------------------------------------------------------ >> >>>> >> >>>> ______________________________________________ >> >>>> [hidden email] mailing list >> >>>> https://stat.ethz.ch/mailman/listinfo/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]] >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------ >> >> >> >> ______________________________________________ >> >> [hidden email] mailing list >> >> https://stat.ethz.ch/mailman/listinfo/r-help >> >> PLEASE do read the posting guide >> >> http://www.R-project.org/posting-guide.html >> >> and provide commented, minimal, self-contained, reproducible code. >> > >> > ______________________________________________ >> > [hidden email] mailing list >> > https://stat.ethz.ch/mailman/listinfo/r-help >> > PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> > and provide commented, minimal, self-contained, reproducible code. >> > >> > > ------------------------------ Message: 78 Date: Wed, 08 Jul 2009 13:10:32 -0500 From: Marc Schwartz <[hidden email]> Subject: Re: [R] matching each row To: tathta <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Jul 8, 2009, at 10:09 AM, tathta wrote: > > I have two dataframes, the first column of each dataframe is a > unique id > number (the rest of the columns are data variables). > I would like to figure out how many times each id number appears in > each > dataframe. > > So far I can use: > length( match (dataframeA$unique.id[1], dataframeB$unique.id) ) > > but this only works on each row of dataframe A one-at-a-time. > > I would like to do this for all of the rows in dataframe A, and then > put the > results in a new variable: dataframeA$count > > > > > Sorry if this question has already been answered, my search of the > archives > only brought up one relevant post, and I didn't understand the > answer to > it.... http://www.nabble.com/match-to20799206.html#a20799206 If I am correctly understanding what you are looking for, you could do something like the following: # Create some simple data. Note that only a subset of the ID's (3:5) will match across the two DF's: set.seed(1) DF.A <- data.frame(ID = sample(1:5, 10, replace = TRUE)) DF.B <- data.frame(ID = sample(3:7, 10, replace = TRUE)) > DF.A   ID 1   2 2   2 3   3 4   5 5   2 6   5 7   5 8   4 9   4 10 1 > DF.B   ID 1   4 2   3 3   6 4   4 5   6 6   5 7   6 8   7 9   4 10 6 Now, create counts of the IDs in each, coercing the results to data frames and setting the count column name for each: TAB.A <- as.data.frame(table(DF.A$ID), responseName = "Count.A") TAB.B <- as.data.frame(table(DF.B$ID), responseName = "Count.B") > TAB.A    Var1 Count.A 1  1     1 2  2     3 3  3     1 4  4     2 5  5     3 > TAB.B    Var1 Count.B 1  3     1 2  4     3 3  5     1 4  6     4 5  7     1 Now, use merge() to join each of the two above. 'all = TRUE' will include non-matching keys: > merge(TAB.A, TAB.B, by = "Var1", all = TRUE)    Var1 Count.A Count.B 1  1     1   NA 2  2     3   NA 3  3     1     1 4  4     2     3 5  5     3     1 6  6   NA     4 7  7   NA     1 Note that you will get NAs for any non-matching ID's (Var1). See ?table, ?as.data.frame and ?merge for more information. HTH, Marc Schwartz ------------------------------ Message: 79 Date: Wed, 8 Jul 2009 11:13:16 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] OK - I got the data - now what? :-) To: [hidden email] Cc: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 10:51 AM, Michael A. Miller<[hidden email]> wrote: >>>>>> Mark wrote: > > ? ?> Currently my data is one experiment per row, but that's > ? ?> wasting space as most experiments only take 20% of the row > ? ?> and 80% of the row is filled with 0's. I might want to make > ? ?> the array more narrow and have a flag somewhere in the 1st > ? ?> 10 columns that says the this row is a continuation row > ? ?> from the previous row. That way I could pack the array > ? ?> better, use less memory and when I do finally test for 0 I > ? ?> have a short line to traverse? > > This may be a bit off track from the data manipulation you are > working on, but I thought I'd point out that another way to > handle this sort of data is to make a table with one measurement > per row, rather than one experiment per row. > > experiment measurement value > ? ? ? ? A ? ? ? ? ? 1 ?0.27 > ? ? ? ? A ? ? ? ? ? 2 ?0.66 > ? ? ? ? A ? ? ? ? ? 3 ?0.24 > ? ? ? ? A ? ? ? ? ? 4 ?0.55 > ? ? ? ? B ? ? ? ? ? 1 ?0.13 > ? ? ? ? B ? ? ? ? ? 2 ?0.65 > ? ? ? ? B ? ? ? ? ? 3 ?0.83 > ? ? ? ? B ? ? ? ? ? 4 ?0.41 > ? ? ? ? B ? ? ? ? ? 5 ?0.92 > ? ? ? ? B ? ? ? ? ? 6 ?0.67 > ? ? ? ? C ? ? ? ? ? 1 ?0.75 > ? ? ? ? C ? ? ? ? ? 2 ?0.97 > ? ? ? ? C ? ? ? ? ? 3 ?0.49 > ? ? ? ? C ? ? ? ? ? 4 ?0.58 > ? ? ? ? D ? ? ? ? ? 1 ?1.00 > ? ? ? ? D ? ? ? ? ? 2 ?0.71 > ? ? ? ? E ? ? ? ? ? 1 ?0.11 > ? ? ? ? E ? ? ? ? ? 2 ?0.50 > ? ? ? ? E ? ? ? ? ? 3 ?0.98 > ? ? ? ? E ? ? ? ? ? 4 ?0.07 > ? ? ? ? E ? ? ? ? ? 5 ?0.94 > ? ? ? ? E ? ? ? ? ? 6 ?0.57 > ? ? ? ? E ? ? ? ? ? 7 ?0.34 > ? ? ? ? E ? ? ? ? ? 8 ?0.21 > > > If you wrote the output of your calculations in this way, one > value per line, it can easily be read into R as a data.frame and > handled with less need for munging. ?No need to remove the > zero-padding because the zeros aren't needed in the first place. > > You can subset the data with subset, as in > > ?test <- read.table('test.dat',header=TRUE) > ?expA <- subset(test, experiment=='A') > ?expB <- subset(test, experiment=='B') > > so there is no need to deal with ragged/zero-padded arrays. Your > plots can be grouped automatically with lattice: > > require(lattice) > xyplot(value ~ measurement, data=test, group=experiment, type='b') > xyplot(value ~ measurement | experiment, data=test, type='b') > > > It is simple to do calculations by experiment using tapply. ?For > example > > >> with(test, tapply(value, experiment, mean)) > ? ? ? ?A ? ? ? ? B ? ? ? ? C ? ? ? ? D ? ? ? ? E > 0.4300000 0.6016667 0.6975000 0.8550000 0.4650000 > > >> with(test, tapply(measurement, experiment, max)) > A B C D E > 4 6 4 2 8 > > > > Mike >    It's not really that far off track as I didn't have any background when I started this in R. This is the first time I've used it. I simply chose to use a format that I thought would work for me in both Excel and R. I do like your examples.    My impression of reshape coupled with cast is that it's pretty capable of giving me more or less the same format you suggest although it is a bit of work. Currently in my files I save only the start and finish times of the experiments and planned on calculating all the times in the middle if necessary. With this format I'd just write them out on each line and save that work in R.    I suppose the files using this alternative format would be a lot larger on disk. I currently have 10 values + 500 observations per experiment with an average experiment tracking file containing maybe 500-1000 experiments. With this format in the worst I suppose I'd have (10+1) * 1000 per experiment on disk, but on average it would be less than that because as you say I wouldn't write out any zeros. Once in R in memory they'd be equivalent. Disk space doesn't matter but reading and writing the files might be slower. I suppose I don't really have to write the zeros out anyway, but at this point it's jsut one additional subset after going through reshape.    It might be an advantage to get to the subset commands immediately but still I've got 10 independent variables and I suspect I'm going to be using reshape/cast more than once to get to my answers so I haven't been against learning how to work with it.    Overall they are good inputs and I appreciate them. Thanks! Cheers, Mark ------------------------------ Message: 80 Date: Wed, 8 Jul 2009 14:31:49 -0400 (EDT) From: Rebecca Sela <[hidden email]> Subject: [R] \dQuote in packages To: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=utf-8 I am in the process of submitting a package to CRAN. R CMD check ran successfully on the package on my local computer, using R version 2.1.1. However, on the computers for CRAN (with version 2.10.0), the following errors occurred: Warning in parse_Rd("./man/predict.Rd", encoding = "unknown") :  ./man/predict.Rd:28: unknown macro '\dquote' *** error on file ./man/predict.Rd Error : ./man/predict.Rd:28: Unrecognized macro \dquote Warning in parse_Rd("./man/print.Rd", encoding = "unknown") :  ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects' Warning in parse_Rd("./man/simpleREEMdata.Rd", encoding = "unknown") :  ./man/simpleREEMdata.Rd:10: unknown macro '\item' Are \dquote, \sideeffects, and \item not supported in newer versions of R? Is there some underlying problem that I should fix that makes these show up? Thank you very much. Rebecca ------------------------------ Message: 81 Date: Wed, 8 Jul 2009 14:34:38 -0400 From: "Wouterse, Fleur \(IFPRI-Senegal\)" <[hidden email]> Subject: Re: [R] truncated regression out-of-sample predictions To: <[hidden email]> Message-ID: <5C41B489BDE4614A9FA014D690BEB03F0C3F8E37@IFPRIE> Content-Type: text/plain Dear all, I am trying to implement Simar & Wilson's (2007) second algorithm and have the following question: If I use a truncated regression on the m<n observations, how do I get fitted values for all n observations, instead of for m observations, which is what the command fitted returns; I would need these to construct the left-truncation needed to draw n random deviates. Thanks for your help, Fleur Fleur Wouterse, Ph.D. Post-Doctoral Fellow IFPRI-Dakar Immeuble Ousseynou Thiam Gueye Rue de Thies Point E, BP 15702 CP 12524 Dakar Fann Senegal Phone: +221 33 869 3986 Email: [hidden email]    [[alternative HTML version deleted]] ------------------------------ Message: 82 Date: Wed, 8 Jul 2009 19:38:23 +0100 From: "Chrysanthi A." <[hidden email]> Subject: [R] heatmap.2: question regarding the "raw z-score" To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hi, I am analysing gene expression data using the heatmap.2 function in R and I was wondering what is the formula of the "raw z-score" bar which shows the colors for each pixel. According to that post: https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html, it is the (actual value - mean of the group) / standard deviation. But, mean of which group? Mean of the gene vector? And actual value of that gene on a sample? I would be grateful if you could give me some more details about it or even if there is a book/manual that I could address to.. Thanks a lot, Chrysanthi. * *    [[alternative HTML version deleted]] ------------------------------ Message: 83 Date: Wed, 8 Jul 2009 12:03:21 -0700 (PDT) From: Steve Jaffe <[hidden email]> Subject: [R] print() to file? To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii I'd like to write some objects (eg arrays) to a log file. cat() flattens them out. I'd like them formatted as in 'print' but print only writes to stdout. Is there a simple way to achieve this result? Thanks -- View this message in context: http://www.nabble.com/print%28%29-to-file--tp24397445p24397445.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 84 Date: Wed, 8 Jul 2009 13:16:08 -0600 From: Greg Snow <[hidden email]> Subject: Re: [R] print() to file? To: Steve Jaffe <[hidden email]>, "[hidden email]"    <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset="us-ascii" ?sink -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [hidden email] 801.408.8111 > -----Original Message----- > From: [hidden email] [mailto:r-help-bounces@r- > project.org] On Behalf Of Steve Jaffe > Sent: Wednesday, July 08, 2009 1:03 PM > To: [hidden email] > Subject: [R] print() to file? > > > I'd like to write some objects (eg arrays) to a log file. cat() > flattens them > out. I'd like them formatted as in 'print' but print only writes to > stdout. > Is there a simple way to achieve this result? > > Thanks > > -- > View this message in context: http://www.nabble.com/print%28%29-to- > file--tp24397445p24397445.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 85 Date: Wed, 8 Jul 2009 15:18:48 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 To my mind its pretty serious that Rtools can make other software not work and the importance of using the word find in the tools is close to zero. Most people never even look at the scripts. Why don't you just rename find.exe to find2.exe, say, in Rtools and adjust the other files accordingly. For the small number of people who ever look at the scripts it will be obvious that we are dealing with a find variant and the danger and need for kludges is eliminated. On Wed, Jul 8, 2009 at 12:55 PM, Duncan Murdoch<[hidden email]> wrote: > On 08/07/2009 12:04 PM, Gabor Grothendieck wrote: >> >> Its safer just to temporarily add it to your path. >> >> Unfortunately Rtools has a find command that conflicts with >> the find command in Windows so if you add the Rtools >> bin directory to your path permanently then you could >> find other programs stop working. ?That actually happened >> to me once and it took the longest time until I discovered >> that Rtools was the culprit. > > That's true, but there is a workaround: you can manually rename the find.exe > in Rtools, and adjust the entry in one of the R makefiles (MkRules), and it > will use the new name instead of "find". ?The reason you might not want to > do this is you might expect find to act the way it does on Unix: ?the Rtools > basically try to make Windows look a little bit like Unix. > > Duncan Murdoch > >> >> If you follow the advice I gave you normally won't have >> that problem. >> >> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >> wrote: >>> >>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>> >>>> Forgive my naivte, but how do I make windows find tar. In other words >>>> from >>>> where do I issue the command and what is the command. >>> >>> You need to install the toolset, and let the installer set your path. >>> >>> Duncan Murdoch >>> >>>> Farrel Buchinsky >>>> Google Voice Tel: (412) 567-7870 >>>> >>>> >>>> >>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>>> wrote: >>>> >>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>> >>>>>> I ?have previously read "R Installation and Administration". I read it >>>>>> again. It does not help me >>>>>> The relevant paragraph is below. But I need lower level instructions.. >>>>>> Where >>>>>> can I find them. >>>>>> >>>>> Follow the link. ?If Windows can't find tar, your toolset is installed >>>>> incorrectly. >>>>> >>>>> Duncan Murdoch >>>>> >>>>> >>>>>> R CMD INSTALL works in Windows to install source packages if you have >>>>>> the >>>>>> source-code package files (option ?Source Package Installation Files? >>>>>> in >>>>>> the >>>>>> installer) and toolset (see The Windows >>>>>> >>>>>> >>>>>> >>>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>>> >>>>>> installed. Installation of binary packages must be done by >>>>>> install.packages >>>>>> . R CMD INSTALL --help will tell you the current options under Windows >>>>>> (which differ from those on a Unix-alike): in particular there is a >>>>>> choice >>>>>> of the types of documentation to be installed. >>>>>> Farrel Buchinsky >>>>>> Google Voice Tel: (412) 567-7870 >>>>>> >>>>>> >>>>>> >>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>> >>>>>> ?See the manual "R Installation and Administration" for information on >>>>>> how >>>>>>> >>>>>>> to install source packages on Windows. >>>>>>> >>>>>>> Uwe Ligges >>>>>>> >>>>>>> Farrel Buchinsky wrote: >>>>>>> >>>>>>> ?After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>>> error >>>>>>>> >>>>>>>> message >>>>>>>> 'tar' is not recongnized as an internal or external command, >>>>>>>> operable >>>>>>>> program or batch file. >>>>>>>> >>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>> download directory or should I do it in C:\Program >>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the >>>>>>>> Rcmd >>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>> >>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>> Farrel Buchinsky >>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>> <[hidden email]>wrote: >>>>>>>> >>>>>>>> ?I have haven't neen following this thread but: >>>>>>>> >>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>> that its not the same name as the built file about to be created. >>>>>>>>> The second line detars it into the RGoogleDocs directory. ?The >>>>>>>>> third >>>>>>>>> builds >>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. ?The fourth >>>>>>>>> installs the built source file into R. ?I've assumed Windows. >>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>> >>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>> >>>>>>>>> or >>>>>>>>> >>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then >>>>>>>>> you >>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>> the others. >>>>>>>>> >>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>> ?What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>> >>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>> to? Or do you mean that I must create a directory called >>>>>>>>>> RGoogleDocs >>>>>>>>>> >>>>>>>>>> ?under >>>>>>>>> >>>>>>>>> ?Library and then change to that directory? >>>>>>>>>> >>>>>>>>>> Farrel Buchinsky >>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>> >>>>>>>>>> ?[hidden email]> >>>>>>>>> >>>>>>>>> ?wrote: >>>>>>>>>> >>>>>>>>>> ?Finally enter into the Windows console: >>>>>>>>>>> >>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>> >>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>> created by the build. >>>>>>>>>>> >>>>>>>>>>> ? ? ?[[alternative HTML version deleted]] >>>>>>>> >>>>>>>> ______________________________________________ >>>>>>>> [hidden email] mailing list >>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> ______________________________________________ >>>>>> [hidden email] mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ------------------------------ Message: 86 Date: Wed, 8 Jul 2009 10:17:07 -0700 (PDT) From: tathta <[hidden email]> Subject: Re: [R] matching each row To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii >From an email suggestion, here are two sample datasets, and my ideal output: dataA <- data.frame(unique.id=c("A","B","C","B"),x=11:14,y=5:2) dataB <- data.frame(unique.id=c("A","B","A","B","A","C","D","A"),x=27:20,y=22:29) ## mystery operation(s) happen here.... ## ideal output would be: dataA <- data.frame(unique.id=c("A","B","C","B"),x=11:14,y=5:2,countA=c(1,2,1,2),countB=c(4,2,1,2)) so my mystery operation(s) would count the number of times the unique id shows up in a given dataset. my ideal outputs are as follows: countA is the "mystery operation" applied to dataA (counting occurrences within the same dataset) countB is applied to dataB (counting occurrences within a second dataset). My best try so far is to do: tempA <- aggregate(dataA$unique.id,list(dataA$unique.id),length) which gives me a matrix with ONE instance of each unique.id and the counts... (and which I thought was kinda cute) but it only works for within a single dataset! tathta wrote: > > I have two dataframes, the first column of each dataframe is a unique id > number (the rest of the columns are data variables). > I would like to figure out how many times each id number appears in each > dataframe. > > So far I can use: > length( match (dataframeA$unique.id[1], dataframeB$unique.id) ) > > but this only works on each row of dataframe A one-at-a-time. > > I would like to do this for all of the rows in dataframe A, and then put > the results in a new variable: dataframeA$count > > > > > > thx > -- View this message in context: http://www.nabble.com/matching-each-row-tp24393051p24395711.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 87 Date: Wed, 08 Jul 2009 13:17:54 +0200 From: Karina Boege <[hidden email]> Subject: [R] bootstrapping error message "Error in t.star[r, ] <-    statistic(data, i[r, ], ...) : number of items to replace is not a    multiple of replacement length" To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset="us-ascii"; format=flowed Hi, I am trying to run some bootstraps with the boot package. When I run it with 400 replicates it does it ok, but then I need to run the same analysis but with 89, 86, 102 and 106 samples (for four different environments), and then is when I get the error message: > mybootstrap <- boot(Datos, mystat, 2000) Error in t.star[r, ] <- statistic(data, i[r, ], ...) : number of items to replace is not a multiple of replacement length Anyone familiar with this error message? Does anyone knows the minimum sample size for boot package to run properly? Is there anyway to tell R how many samples should it pick for the resampling? If it helps, this is how my model looks like: mymodel = lm(Datos[,4]~Datos[,1]+ Datos[,8]+Datos[,9]+Datos[,10]+Datos[,11]+Datos[,12]) summary(mymodel) mystat <- function(a,b) f<- lm(a[b,4]~a[b,1]+a[b,8]+ a[b,9]+a[b,10]+a[b,11]+a[b,12])$coef mybootstrap <- boot(Datos, mystat, 2000) INT1<-boot.ci(mybootstrap, conf=0.95, type="all", index=1) INT2<-boot.ci(mybootstrap, conf=0.95, type="all", index=2) INT3<-boot.ci(mybootstrap, conf=0.95, type="all", index=3) INT4<-boot.ci(mybootstrap, conf=0.95, type="all", index=4) INT5<-boot.ci(mybootstrap, conf=0.95, type="all", index=5) INT6<-boot.ci(mybootstrap, conf=0.95, type="all", index=6) INT7<-boot.ci(mybootstrap, conf=0.95, type="all", index=7) Thanks for your help! I am new to bootstraps and to R, and I feel pretty lonely with this Karina Boege ------------------------------ Message: 88 Date: Wed, 08 Jul 2009 15:30:09 -0400 From: Duncan Murdoch <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed On 7/8/2009 3:18 PM, Gabor Grothendieck wrote: > To my mind its pretty serious that Rtools can make other > software not work and the importance of using the word > find in the tools is close to zero. Most people never even > look at the scripts. You didn't read what I wrote. It could be called anything as far as the scripts are concerned. I explained to you how to rename it and keep them happy. Duncan Murdoch > > Why don't you just rename find.exe to find2.exe, say, in > Rtools and adjust the other files accordingly. For the small > number of people who ever look at the scripts it will be obvious > that we are dealing with a find variant and the danger and need > for kludges is eliminated. > > On Wed, Jul 8, 2009 at 12:55 PM, Duncan Murdoch<[hidden email]> wrote: >> On 08/07/2009 12:04 PM, Gabor Grothendieck wrote: >>> >>> Its safer just to temporarily add it to your path. >>> >>> Unfortunately Rtools has a find command that conflicts with >>> the find command in Windows so if you add the Rtools >>> bin directory to your path permanently then you could >>> find other programs stop working. That actually happened >>> to me once and it took the longest time until I discovered >>> that Rtools was the culprit. >> >> That's true, but there is a workaround: you can manually rename the find..exe >> in Rtools, and adjust the entry in one of the R makefiles (MkRules), and it >> will use the new name instead of "find". The reason you might not want to >> do this is you might expect find to act the way it does on Unix: the Rtools >> basically try to make Windows look a little bit like Unix. >> >> Duncan Murdoch >> >>> >>> If you follow the advice I gave you normally won't have >>> that problem. >>> >>> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >>> wrote: >>>> >>>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>>> >>>>> Forgive my naivte, but how do I make windows find tar. In other words >>>>> from >>>>> where do I issue the command and what is the command. >>>> >>>> You need to install the toolset, and let the installer set your path. >>>> >>>> Duncan Murdoch >>>> >>>>> Farrel Buchinsky >>>>> Google Voice Tel: (412) 567-7870 >>>>> >>>>> >>>>> >>>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>>>> wrote: >>>>> >>>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>>> >>>>>>> I have previously read "R Installation and Administration". I read it >>>>>>> again. It does not help me >>>>>>> The relevant paragraph is below. But I need lower level instructions. >>>>>>> Where >>>>>>> can I find them. >>>>>>> >>>>>> Follow the link. If Windows can't find tar, your toolset is installed >>>>>> incorrectly. >>>>>> >>>>>> Duncan Murdoch >>>>>> >>>>>> >>>>>>> R CMD INSTALL works in Windows to install source packages if you have >>>>>>> the >>>>>>> source-code package files (option ?Source Package Installation Files? >>>>>>> in >>>>>>> the >>>>>>> installer) and toolset (see The Windows >>>>>>> >>>>>>> >>>>>>> >>>>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>>>> >>>>>>> installed. Installation of binary packages must be done by >>>>>>> install.packages >>>>>>> . R CMD INSTALL --help will tell you the current options under Windows >>>>>>> (which differ from those on a Unix-alike): in particular there is a >>>>>>> choice >>>>>>> of the types of documentation to be installed. >>>>>>> Farrel Buchinsky >>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>> >>>>>>> >>>>>>> >>>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>>> >>>>>>> See the manual "R Installation and Administration" for information on >>>>>>> how >>>>>>>> >>>>>>>> to install source packages on Windows. >>>>>>>> >>>>>>>> Uwe Ligges >>>>>>>> >>>>>>>> Farrel Buchinsky wrote: >>>>>>>> >>>>>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>>>> error >>>>>>>>> >>>>>>>>> message >>>>>>>>> 'tar' is not recongnized as an internal or external command, >>>>>>>>> operable >>>>>>>>> program or batch file. >>>>>>>>> >>>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>>> download directory or should I do it in C:\Program >>>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the >>>>>>>>> Rcmd >>>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>>> >>>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>>> Farrel Buchinsky >>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>>> <[hidden email]>wrote: >>>>>>>>> >>>>>>>>> I have haven't neen following this thread but: >>>>>>>>> >>>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>>> that its not the same name as the built file about to be created.. >>>>>>>>>> The second line detars it into the RGoogleDocs directory. The >>>>>>>>>> third >>>>>>>>>> builds >>>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>>>>>>> installs the built source file into R. I've assumed Windows. >>>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>>> >>>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>>> >>>>>>>>>> or >>>>>>>>>> >>>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then >>>>>>>>>> you >>>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>>> the others. >>>>>>>>>> >>>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky<[hidden email]> >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>>> >>>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>> to? Or do you mean that I must create a directory called >>>>>>>>>>> RGoogleDocs >>>>>>>>>>> >>>>>>>>>>> under >>>>>>>>>> >>>>>>>>>> Library and then change to that directory? >>>>>>>>>>> >>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>>> >>>>>>>>>>> [hidden email]> >>>>>>>>>> >>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> Finally enter into the Windows console: >>>>>>>>>>>> >>>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>>> >>>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>>> created by the build. >>>>>>>>>>>> >>>>>>>>>>>>   [[alternative HTML version deleted]] >>>>>>>>> >>>>>>>>> ______________________________________________ >>>>>>>>> [hidden email] mailing list >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> ______________________________________________ >>>>>>> [hidden email] mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 89 Date: Wed, 8 Jul 2009 15:39:25 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 I understand what you wrote. Its just that I don't agree that that is a reasonable solution. What is wanted is something that works safely out of the box, not something with a built in danger that every single person that uses it must fix (and know about it to fix) in order to maintain the integrity of their system. On Wed, Jul 8, 2009 at 3:30 PM, Duncan Murdoch<[hidden email]> wrote: > On 7/8/2009 3:18 PM, Gabor Grothendieck wrote: >> >> To my mind its pretty serious that Rtools can make other >> software not work and the importance of using the word >> find in the tools is close to zero. ?Most people never even >> look at the scripts. > > You didn't read what I wrote. ?It could be called anything as far as the > scripts are concerned. ?I explained to you how to rename it and keep them > happy. > > Duncan Murdoch >> >> Why don't you just rename find.exe to find2.exe, say, in >> Rtools and adjust the other files accordingly. For the small >> number of people who ever look at the scripts it will be obvious >> that we are dealing with a find variant and the danger and need >> for kludges is eliminated. >> >> On Wed, Jul 8, 2009 at 12:55 PM, Duncan Murdoch<[hidden email]> >> wrote: >>> >>> On 08/07/2009 12:04 PM, Gabor Grothendieck wrote: >>>> >>>> Its safer just to temporarily add it to your path. >>>> >>>> Unfortunately Rtools has a find command that conflicts with >>>> the find command in Windows so if you add the Rtools >>>> bin directory to your path permanently then you could >>>> find other programs stop working. ?That actually happened >>>> to me once and it took the longest time until I discovered >>>> that Rtools was the culprit. >>> >>> That's true, but there is a workaround: you can manually rename the >>> find.exe >>> in Rtools, and adjust the entry in one of the R makefiles (MkRules), and >>> it >>> will use the new name instead of "find". ?The reason you might not want >>> to >>> do this is you might expect find to act the way it does on Unix: ?the >>> Rtools >>> basically try to make Windows look a little bit like Unix. >>> >>> Duncan Murdoch >>> >>>> >>>> If you follow the advice I gave you normally won't have >>>> that problem. >>>> >>>> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >>>> wrote: >>>>> >>>>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>>>> >>>>>> Forgive my naivte, but how do I make windows find tar. In other words >>>>>> from >>>>>> where do I issue the command and what is the command. >>>>> >>>>> You need to install the toolset, and let the installer set your path. >>>>> >>>>> Duncan Murdoch >>>>> >>>>>> Farrel Buchinsky >>>>>> Google Voice Tel: (412) 567-7870 >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>>>>> wrote: >>>>>> >>>>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>>>> >>>>>>>> I ?have previously read "R Installation and Administration". I read >>>>>>>> it >>>>>>>> again. It does not help me >>>>>>>> The relevant paragraph is below. But I need lower level >>>>>>>> instructions. >>>>>>>> Where >>>>>>>> can I find them. >>>>>>>> >>>>>>> Follow the link. ?If Windows can't find tar, your toolset is >>>>>>> installed >>>>>>> incorrectly. >>>>>>> >>>>>>> Duncan Murdoch >>>>>>> >>>>>>> >>>>>>>> R CMD INSTALL works in Windows to install source packages if you >>>>>>>> have >>>>>>>> the >>>>>>>> source-code package files (option ?Source Package Installation >>>>>>>> Files? >>>>>>>> in >>>>>>>> the >>>>>>>> installer) and toolset (see The Windows >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>>>>> >>>>>>>> installed. Installation of binary packages must be done by >>>>>>>> install.packages >>>>>>>> . R CMD INSTALL --help will tell you the current options under >>>>>>>> Windows >>>>>>>> (which differ from those on a Unix-alike): in particular there is a >>>>>>>> choice >>>>>>>> of the types of documentation to be installed. >>>>>>>> Farrel Buchinsky >>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>>>> >>>>>>>> ?See the manual "R Installation and Administration" for information >>>>>>>> on >>>>>>>> how >>>>>>>>> >>>>>>>>> to install source packages on Windows. >>>>>>>>> >>>>>>>>> Uwe Ligges >>>>>>>>> >>>>>>>>> Farrel Buchinsky wrote: >>>>>>>>> >>>>>>>>> ?After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>>>>> error >>>>>>>>>> >>>>>>>>>> message >>>>>>>>>> 'tar' is not recongnized as an internal or external command, >>>>>>>>>> operable >>>>>>>>>> program or batch file. >>>>>>>>>> >>>>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>>>> download directory or should I do it in C:\Program >>>>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will >>>>>>>>>> the >>>>>>>>>> Rcmd >>>>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>>>> >>>>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>>>> Farrel Buchinsky >>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>>>> <[hidden email]>wrote: >>>>>>>>>> >>>>>>>>>> ?I have haven't neen following this thread but: >>>>>>>>>> >>>>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>>>> that its not the same name as the built file about to be created. >>>>>>>>>>> The second line detars it into the RGoogleDocs directory. ?The >>>>>>>>>>> third >>>>>>>>>>> builds >>>>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. ?The fourth >>>>>>>>>>> installs the built source file into R. ?I've assumed Windows. >>>>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>>>> >>>>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>> >>>>>>>>>>> or >>>>>>>>>>> >>>>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file >>>>>>>>>>> then >>>>>>>>>>> you >>>>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>>>> the others. >>>>>>>>>>> >>>>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel >>>>>>>>>>> Buchinsky<[hidden email]> >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> ?What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>>>> >>>>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>>> to? Or do you mean that I must create a directory called >>>>>>>>>>>> RGoogleDocs >>>>>>>>>>>> >>>>>>>>>>>> ?under >>>>>>>>>>> >>>>>>>>>>> ?Library and then change to that directory? >>>>>>>>>>>> >>>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>>>> >>>>>>>>>>>> ?[hidden email]> >>>>>>>>>>> >>>>>>>>>>> ?wrote: >>>>>>>>>>>> >>>>>>>>>>>> ?Finally enter into the Windows console: >>>>>>>>>>>>> >>>>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>>>> >>>>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>>>> created by the build. >>>>>>>>>>>>> >>>>>>>>>>>>> ? ? [[alternative HTML version deleted]] >>>>>>>>>> >>>>>>>>>> ______________________________________________ >>>>>>>>>> [hidden email] mailing list >>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------ >>>>>>>> >>>>>>>> ______________________________________________ >>>>>>>> [hidden email] mailing list >>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> ______________________________________________ >>>>>> [hidden email] mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>> >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ------------------------------ Message: 90 Date: Wed, 8 Jul 2009 15:40:45 -0400 From: Jeff DaCosta <[hidden email]> Subject: [R] nested model with random factors To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain I am really having trouble with getting the right syntax for my model. Here is a truncated version of my data: > data     Ind Treatment Order   Date    PC1 1 PER14    SC   3rd 4-May-09 0.5704611 2 PER14    SH   1st 26-Apr-09 0.5329025 3 PER14    AC   2nd 29-Apr-09 2.1392279 4 PER25    SC   2nd 29-Apr-09 -0.2083382 5 PER25    SH   3rd 3-May-09 3.7818356 6 PER25    AC   1st 26-Apr-09 -1.9689733 7 PER30    SC   1st 24-Apr-09 -0.1255970 8 PER30    SH   2nd 27-Apr-09 2.1474393 9 PER30    AC   3rd 30-Apr-09 -1.8683396 > str(data) 'data.frame':   9 obs. of 5 variables:  $ Ind   : Factor w/ 3 levels "PER14","PER25",..: 1 1 1 2 2 2 3 3 3  $ Treatment: Factor w/ 3 levels "AC","SC","SH": 2 3 1 2 3 1 2 3 1  $ Order  : Factor w/ 3 levels "1st","2nd","3rd": 3 1 2 2 3 1 1 2 3  $ Date    : Factor w/ 7 levels "24-Apr-09","26-Apr-09",..: 7 2 4 4 5 2 1 3 6  $ PC1   : num 0.57 0.533 2.139 -0.208 3.782 .... > factor(Order, ordered=TRUE) [1] 3rd 1st 2nd 2nd 3rd 1st 1st 2nd 3rd Levels: 1st < 2nd < 3rd > factor(Date,ordered=TRUE) [1] 4-May-09 26-Apr-09 29-Apr-09 29-Apr-09 3-May-09 26-Apr-09 24- Apr-09 27-Apr-09 30-Apr-09 Levels: 24-Apr-09 < 26-Apr-09 < 27-Apr-09 < 29-Apr-09 < 3-May-09 < 30- Apr-09 < 4-May-09 "Ind" are different individuals in the study, each of which received three "Treatment"s (SC, SH, and AC). The "Order" (ordered=TRUE) in which each individual received a treatment was systematically shuffled in the study, and the "Date" (ordered=TRUE) is simply when each treatment was completed. The response variable are scores from a principal components analysis ("PC1"). So I want to run a model where "PC1" is the response variable and "Ind" is nested within "Treatment", and I also want to include "Order" and "Date" as random factors. I have been struggling to describe the model with aov, lm, lme, and lmer, and don't think I'm getting the syntax right. Suggestions? Thanks for your time and consideration, -Jeff    [[alternative HTML version deleted]] ------------------------------ Message: 91 Date: Wed, 8 Jul 2009 12:41:28 -0700 From: Mark Knecht <[hidden email]> Subject: [R] What is cast telling me? To: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 Hi,    What is cast telling me when it says the following? Aggregation requires fun.aggregate: length used as default What is 'length'?    I've taken a small subset of data and wondered what EnTime vs ExTime might look like. cast is kind enough to give me a table but I don't understand the values in the table. They seem to sum up ro be the same as the total dimension of the data so I'm guessing (but cannot prove) that it's something like whether each experiment has values for both EnTime and ExTime?    Assuming that cast is taking some sort of sum then I'd like to learn how to replace the value in the table with something meaningful to me. On thing would the the ExNum value from the first occurrence at that crosspoint, or the PL_Pos value, etc.    How might I write a fun.aggregate to to that? Thanks, Mark > dim(MyResults) [1] 1105   12 > head(MyResults, n=15)     ExNum PosType EnDate EnTime ExDate ExTime PL_Pos Costs Save2 time value id 1.1   1   -1 1080103  800 1080103   1310  520  26    0 1 746.2 1 2.1   2   -1 1080104  755 1080104   1310  530  26    0 1 721.9 2 3.1   3     1 1080107  945 1080107   1310   -340  26    0 1 722.8 3 4.1   4   -1 1080108  820 1080108   1310   2150  26    0 1 717.4 4 5.1   5   -1 1080109  855 1080109   1245 -1040  26    0 1 693.2 5 6.1   6     1 1080109   1245 1080109   1310  110  26    0 1 703.6 6 7.1   7     1 1080110  925 1080110   1310  680  26    0 1 708.9 7 8.1   8     1 1080111  800 1080111   1155   -830  26    0 1 709.4 8 9.1   9   -1 1080111   1155 1080111   1310  160  26    0 1 701.1 9 10.1  10   -1 1080114  935 1080114   1210   -810  26    0 1 698.9 10 11.1  11     1 1080114   1210 1080114   1310   -280  26    0 1 707.0 11 12.1  12   -1 1080115  750 1080115   1310   -310  26    0 1 688.2 12 13.1  13   -1 1080116  755 1080116  950 -1340  26    0 1 684.1 13 14.1  14     1 1080116  950 1080116   1310   -550  26    0 1 697.5 14 15.1  15   -1 1080117  740 1080117   1310  700  26    0 1 680.8 15 > cast(MyResults,ExTime ~ EnTime) Aggregation requires fun.aggregate: length used as default  ExTime 740 750 755 800 805 810 815 820 850 855 925 935 945 950 1125 1155 1210 1245 1305 1  950   0   0 25   0   0   0   0   0   0   0   0   0   0   0  0  0  0  0  0 2   1125   0   0   0   0   0   0   0   0 33   0   0   0   0   0  0  0  0  0  0 3   1155   0   0   0 49   0   0   0   0   0   0   0   0   0   0  0  0  0  0  0 4   1210   0   0   0   0   0   0   0   0   0   0   0 33   0   0  0  0  0  0  0 5   1245   0   0   0   0   0   0   0   0   0 48   0   0   0   0  0  0  0  0  0 6   1305   0   0   0   0   0   0   0   0   0   0   0   0   0   0   22  0  0  0  0 7   1310 136 132 130 64 63 62 61 60   0   0 47   0 43 42  0 17   28  7  3 > > sum(cast(MyResults,ExTime ~ EnTime)) Aggregation requires fun.aggregate: length used as default [1] 1105 > ------------------------------ Message: 92 Date: Wed, 08 Jul 2009 15:51:17 -0400 From: Duncan Murdoch <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed On 7/8/2009 3:39 PM, Gabor Grothendieck wrote: > I understand what you wrote. Its just that I don't agree that that > is a reasonable solution. > > What is wanted is something that works safely out of the box, > not something with a built in danger that every single person > that uses it must fix (and know about it to fix) in order to > maintain the integrity of their system. As far as I know, you are the only person in the whole world who has been affected by this. But fixing it would inconvenience hundreds of people, who would have to install a new version of Rtools, if the make system suddenly started looking for find2 instead of find. So it's unfortunate that Microsoft chose to use the name of the wrong Unix utility when they wrote find, and it's unfortunate that the first version of Rtools didn't fix this, but there you are: name clashes happen, and sometimes you need to work around them. Duncan Murdoch > > On Wed, Jul 8, 2009 at 3:30 PM, Duncan Murdoch<[hidden email]> wrote: >> On 7/8/2009 3:18 PM, Gabor Grothendieck wrote: >>> >>> To my mind its pretty serious that Rtools can make other >>> software not work and the importance of using the word >>> find in the tools is close to zero. Most people never even >>> look at the scripts. >> >> You didn't read what I wrote. It could be called anything as far as the >> scripts are concerned. I explained to you how to rename it and keep them >> happy. >> >> Duncan Murdoch >>> >>> Why don't you just rename find.exe to find2.exe, say, in >>> Rtools and adjust the other files accordingly. For the small >>> number of people who ever look at the scripts it will be obvious >>> that we are dealing with a find variant and the danger and need >>> for kludges is eliminated. >>> >>> On Wed, Jul 8, 2009 at 12:55 PM, Duncan Murdoch<[hidden email]> >>> wrote: >>>> >>>> On 08/07/2009 12:04 PM, Gabor Grothendieck wrote: >>>>> >>>>> Its safer just to temporarily add it to your path. >>>>> >>>>> Unfortunately Rtools has a find command that conflicts with >>>>> the find command in Windows so if you add the Rtools >>>>> bin directory to your path permanently then you could >>>>> find other programs stop working. That actually happened >>>>> to me once and it took the longest time until I discovered >>>>> that Rtools was the culprit. >>>> >>>> That's true, but there is a workaround: you can manually rename the >>>> find.exe >>>> in Rtools, and adjust the entry in one of the R makefiles (MkRules), and >>>> it >>>> will use the new name instead of "find". The reason you might not want >>>> to >>>> do this is you might expect find to act the way it does on Unix: the >>>> Rtools >>>> basically try to make Windows look a little bit like Unix. >>>> >>>> Duncan Murdoch >>>> >>>>> >>>>> If you follow the advice I gave you normally won't have >>>>> that problem. >>>>> >>>>> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >>>>> wrote: >>>>>> >>>>>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>>>>> >>>>>>> Forgive my naivte, but how do I make windows find tar. In other words >>>>>>> from >>>>>>> where do I issue the command and what is the command. >>>>>> >>>>>> You need to install the toolset, and let the installer set your path.. >>>>>> >>>>>> Duncan Murdoch >>>>>> >>>>>>> Farrel Buchinsky >>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>>>>>> wrote: >>>>>>> >>>>>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>>>>> >>>>>>>>> I have previously read "R Installation and Administration". I read >>>>>>>>> it >>>>>>>>> again. It does not help me >>>>>>>>> The relevant paragraph is below. But I need lower level >>>>>>>>> instructions. >>>>>>>>> Where >>>>>>>>> can I find them. >>>>>>>>> >>>>>>>> Follow the link. If Windows can't find tar, your toolset is >>>>>>>> installed >>>>>>>> incorrectly. >>>>>>>> >>>>>>>> Duncan Murdoch >>>>>>>> >>>>>>>> >>>>>>>>> R CMD INSTALL works in Windows to install source packages if you >>>>>>>>> have >>>>>>>>> the >>>>>>>>> source-code package files (option ?Source Package Installation >>>>>>>>> Files? >>>>>>>>> in >>>>>>>>> the >>>>>>>>> installer) and toolset (see The Windows >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>>>>>> >>>>>>>>> installed. Installation of binary packages must be done by >>>>>>>>> install.packages >>>>>>>>> . R CMD INSTALL --help will tell you the current options under >>>>>>>>> Windows >>>>>>>>> (which differ from those on a Unix-alike): in particular there is a >>>>>>>>> choice >>>>>>>>> of the types of documentation to be installed. >>>>>>>>> Farrel Buchinsky >>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>>>>> >>>>>>>>> See the manual "R Installation and Administration" for information >>>>>>>>> on >>>>>>>>> how >>>>>>>>>> >>>>>>>>>> to install source packages on Windows. >>>>>>>>>> >>>>>>>>>> Uwe Ligges >>>>>>>>>> >>>>>>>>>> Farrel Buchinsky wrote: >>>>>>>>>> >>>>>>>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>>>>>> error >>>>>>>>>>> >>>>>>>>>>> message >>>>>>>>>>> 'tar' is not recongnized as an internal or external command, >>>>>>>>>>> operable >>>>>>>>>>> program or batch file. >>>>>>>>>>> >>>>>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>>>>> download directory or should I do it in C:\Program >>>>>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will >>>>>>>>>>> the >>>>>>>>>>> Rcmd >>>>>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>>>>> >>>>>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>>>>> <[hidden email]>wrote: >>>>>>>>>>> >>>>>>>>>>> I have haven't neen following this thread but: >>>>>>>>>>> >>>>>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>>>>> that its not the same name as the built file about to be created. >>>>>>>>>>>> The second line detars it into the RGoogleDocs directory. The >>>>>>>>>>>> third >>>>>>>>>>>> builds >>>>>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>>>>>>>>> installs the built source file into R. I've assumed Windows. >>>>>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>>>>> >>>>>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>>> >>>>>>>>>>>> or >>>>>>>>>>>> >>>>>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file >>>>>>>>>>>> then >>>>>>>>>>>> you >>>>>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>>>>> the others. >>>>>>>>>>>> >>>>>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel >>>>>>>>>>>> Buchinsky<[hidden email]> >>>>>>>>>>>> wrote: >>>>>>>>>>>> >>>>>>>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>>>>> >>>>>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>>>> to? Or do you mean that I must create a directory called >>>>>>>>>>>>> RGoogleDocs >>>>>>>>>>>>> >>>>>>>>>>>>> under >>>>>>>>>>>> >>>>>>>>>>>> Library and then change to that directory? >>>>>>>>>>>>> >>>>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>>>>> >>>>>>>>>>>>> [hidden email]> >>>>>>>>>>>> >>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> Finally enter into the Windows console: >>>>>>>>>>>>>> >>>>>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>>>>> >>>>>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>>>>> created by the build. >>>>>>>>>>>>>> >>>>>>>>>>>>>>    [[alternative HTML version deleted]] >>>>>>>>>>> >>>>>>>>>>> ______________________________________________ >>>>>>>>>>> [hidden email] mailing list >>>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>> >>>>>>>>> ______________________________________________ >>>>>>>>> [hidden email] mailing list >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> ______________________________________________ >>>>>>> [hidden email] mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>> PLEASE do read the posting guide >>>>>>> http://www.R-project.org/posting-guide.html >>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>>>> ______________________________________________ >>>>>> [hidden email] mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>>> >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> ------------------------------ Message: 93 Date: Wed, 08 Jul 2009 14:57:18 -0500 From: Marc Schwartz <[hidden email]> Subject: Re: [R] matching each row To: tathta <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Jul 8, 2009, at 12:17 PM, tathta wrote: > >> From an email suggestion, here are two sample datasets, and my >> ideal output: > > dataA <- data.frame(unique.id=c("A","B","C","B"),x=11:14,y=5:2) > dataB <- > data > .frame(unique.id=c("A","B","A","B","A","C","D","A"),x=27:20,y=22:29) > > ## mystery operation(s) happen here.... > > ## ideal output would be: > dataA <- > data > .frame > (unique > .id > =c("A","B","C","B"),x=11:14,y=5:2,countA=c(1,2,1,2),countB=c(4,2,1,2)) > > > so my mystery operation(s) would count the number of times the > unique id > shows up in a given dataset. > my ideal outputs are as follows: > countA is the "mystery operation" applied to dataA (counting > occurrences > within the same dataset) > countB is applied to dataB (counting occurrences within a second > dataset). > > > > My best try so far is to do: > tempA <- aggregate(dataA$unique.id,list(dataA$unique.id),length) > > which gives me a matrix with ONE instance of each unique.id and the > counts... > (and which I thought was kinda cute) <snip> Modify my initial proposal: countA <- as.data.frame(table(dataA$unique.id), responseName = "countA") countB <- as.data.frame(table(dataB$unique.id), responseName = "countB") > countA    Var1 countA 1  A   1 2  B   2 3  C   1 > countB    Var1 countB 1  A   4 2  B   2 3  C   1 4  D   1 dataA <- merge(dataA, countA, by.x = "unique.id", by.y = "Var1") dataA <- merge(dataA, countB, by.x = "unique.id", by.y = "Var1") > dataA    unique.id x y countA countB 1      A 11 5   1   4 2      B 12 4   2   2 3      B 14 2   2   2 4      C 13 3   1   1 Note that without 'all.x = TRUE' in the merge() calls, only those unique.id's that are common to both datasets will be in the result. If you want to include unique.id's that are in A, but not in B, using 'all.x = TRUE'. Note also that by default, 'unique.id' will be alpha sorted in the output. HTH, Marc Schwartz ------------------------------ Message: 94 Date: Wed, 08 Jul 2009 12:58:38 -0700 From: [hidden email] Subject: Re: [R] What is cast telling me? To: "Mark Knecht" <[hidden email]>, "r-help"    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset="us-ascii" That you have non-unique rows in your data (as identified by the identifying variables). ----- Original message ----- From: "Mark Knecht" <[hidden email]> To: "r-help" <[hidden email]> Date: Wed, 8 Jul 2009 12:41:28 -0700 Subject: [R] What is cast telling me? Hi,    What is cast telling me when it says the following? Aggregation requires fun.aggregate: length used as default What is 'length'?    I've taken a small subset of data and wondered what EnTime vs ExTime might look like. cast is kind enough to give me a table but I don't understand the values in the table. They seem to sum up ro be the same as the total dimension of the data so I'm guessing (but cannot prove) that it's something like whether each experiment has values for both EnTime and ExTime?    Assuming that cast is taking some sort of sum then I'd like to learn how to replace the value in the table with something meaningful to me. On thing would the the ExNum value from the first occurrence at that crosspoint, or the PL_Pos value, etc.    How might I write a fun.aggregate to to that? Thanks, Mark > dim(MyResults) [1] 1105   12 > head(MyResults, n=15)     ExNum PosType EnDate EnTime ExDate ExTime PL_Pos Costs Save2 time value id 1.1   1   -1 1080103  800 1080103   1310  520  26    0 1 746.2 1 2.1   2   -1 1080104  755 1080104   1310  530  26    0 1 721.9 2 3.1   3     1 1080107  945 1080107   1310   -340  26    0 1 722.8 3 4.1   4   -1 1080108  820 1080108   1310   2150  26    0 1 717.4 4 5.1   5   -1 1080109  855 1080109   1245 -1040  26    0 1 693.2 5 6.1   6     1 1080109   1245 1080109   1310  110  26    0 1 703.6 6 7.1   7     1 1080110  925 1080110   1310  680  26    0 1 708.9 7 8.1   8     1 1080111  800 1080111   1155   -830  26    0 1 709.4 8 9.1   9   -1 1080111   1155 1080111   1310  160  26    0 1 701.1 9 10.1  10   -1 1080114  935 1080114   1210   -810  26    0 1 698.9 10 11.1  11     1 1080114   1210 1080114   1310   -280  26    0 1 707.0 11 12.1  12   -1 1080115  750 1080115   1310   -310  26    0 1 688.2 12 13.1  13   -1 1080116  755 1080116  950 -1340  26    0 1 684.1 13 14.1  14     1 1080116  950 1080116   1310   -550  26    0 1 697.5 14 15.1  15   -1 1080117  740 1080117   1310  700  26    0 1 680.8 15 > cast(MyResults,ExTime ~ EnTime) Aggregation requires fun.aggregate: length used as default  ExTime 740 750 755 800 805 810 815 820 850 855 925 935 945 950 1125 1155 1210 1245 1305 1  950   0   0 25   0   0   0   0   0   0   0   0   0   0   0  0  0  0  0  0 2   1125   0   0   0   0   0   0   0   0 33   0   0   0   0   0  0  0  0  0  0 3   1155   0   0   0 49   0   0   0   0   0   0   0   0   0   0  0  0  0  0  0 4   1210   0   0   0   0   0   0   0   0   0   0   0 33   0   0  0  0  0  0  0 5   1245   0   0   0   0   0   0   0   0   0 48   0   0   0   0  0  0  0  0  0 6   1305   0   0   0   0   0   0   0   0   0   0   0   0   0   0   22  0  0  0  0 7   1310 136 132 130 64 63 62 61 60   0   0 47   0 43 42  0 17   28  7  3 > > sum(cast(MyResults,ExTime ~ EnTime)) Aggregation requires fun.aggregate: length used as default [1] 1105 > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 95 Date: Wed, 08 Jul 2009 16:08:32 -0400 From: "James W. MacDonald" <[hidden email]> Subject: Re: [R] heatmap.2: question regarding the "raw z-score" To: "Chrysanthi A." <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi Chrysanthi, Chrysanthi A. wrote: > Hi, > > I am analysing gene expression data using the heatmap.2 function in R and I > was wondering what is the formula of the "raw z-score" bar which shows the > colors for each pixel. > According to that post: > https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html, it > is the > > (actual value - mean of the group) / standard deviation. > > But, mean of which group? Mean of the gene vector? And actual value of that > gene on a sample? I would be grateful if you could give me some more > details about it or even if there is a book/manual that I could address > to..     if (scale == "row") {       retval$rowMeans <- rm <- rowMeans(x, na.rm = na.rm)       x <- sweep(x, 1, rm)       retval$rowSDs <- sx <- apply(x, 1, sd, na.rm = na.rm)       x <- sweep(x, 1, sx, "/")     }     else if (scale == "column") {       retval$colMeans <- rm <- colMeans(x, na.rm = na.rm)       x <- sweep(x, 2, rm)       retval$colSDs <- sx <- apply(x, 2, sd, na.rm = na.rm)       x <- sweep(x, 2, sx, "/")     } So the z-score is calculated on either the row or column (or the default of "none"). I don't see how you can get something saying 'raw z-score'. I get either 'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row Z-Score, then the rows are centered and scaled by subtracting the mean of the row from every value and then dividing the resulting values by the standard deviation of the row. Best, Jim > > Thanks a lot, > > Chrysanthi. > > * > * > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ------------------------------ Message: 96 Date: Wed, 8 Jul 2009 13:22:27 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] What is cast telling me? To: [hidden email] Cc: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 12:58 PM, <[hidden email]> wrote: > > That you have non-unique rows in your data (as identified by the identifying variables). > Humm...OK - so I cast it with PL_Pos which has (in this data subset) a unique value for each experiment in this set. there are 25 experiments and there are 25 rows so each row in the output of cast should be unique, and indeed (although it won't survive email) there is only one EnTime now for each experiement and the 755 vs 950 reading of 25 is the number of 5 minute periods which is the observation rate of this data. > cast(MyResults,PL_Pos + ExNum + EnTime ~ ExTime) Aggregation requires fun.aggregate: length used as default    PL_Pos ExNum EnTime 950 1125 1155 1210 1245 1305 1310 1   -1420  23   1125   0  0  0  0  0   22  0 2   -1340  13  755 25  0  0  0  0  0  0 3   -1120  22  850   0   33  0  0  0  0  0 4   -1040    5  855   0  0  0  0   48  0  0 5  -830    8  800   0  0   49  0  0  0  0 6  -810  10  935   0  0  0   33  0  0  0 7  -550  14  950   0  0  0  0  0  0   42 8  -400  17  750   0  0  0  0  0  0   66 9  -340    3  945   0  0  0  0  0  0   43 10   -310  12  750   0  0  0  0  0  0   66 11   -280  11   1210   0  0  0  0  0  0   14 12  -60  19  810   0  0  0  0  0  0   62 13  110    6   1245   0  0  0  0  0  0  7 14  160    9   1155   0  0  0  0  0  0   17 15  180  24   1305   0  0  0  0  0  0  3 16  440  16  815   0  0  0  0  0  0   61 17  520    1  800   0  0  0  0  0  0   64 18  530    2  755   0  0  0  0  0  0   65 19  680    7  925   0  0  0  0  0  0   47 20  700  15  740   0  0  0  0  0  0   68 21   1060  20  740   0  0  0  0  0  0   68 22   1080  25  805   0  0  0  0  0  0   63 23   1120  21  755   0  0  0  0  0  0   65 24   1720  18   1210   0  0  0  0  0  0   14 25   2150    4  820   0  0  0  0  0  0   60 On the other hand, if I'm looking for a higher PL_Pos reading I can cast the same variables this way: Aggregation requires fun.aggregate: length used as default    EnTime PL_Pos ExNum 950 1125 1155 1210 1245 1305 1310 1    740  700  15   0  0  0  0  0  0   68 2    740   1060  20   0  0  0  0  0  0   68 3    750   -400  17   0  0  0  0  0  0   66 4    750   -310  12   0  0  0  0  0  0   66 5    755 -1340  13 25  0  0  0  0  0  0 6    755  530    2   0  0  0  0  0  0   65 7    755   1120  21   0  0  0  0  0  0   65 8    800   -830    8   0  0   49  0  0  0  0 9    800  520    1   0  0  0  0  0  0   64 10  805   1080  25   0  0  0  0  0  0   63 11  810  -60  19   0  0  0  0  0  0   62 12  815  440  16   0  0  0  0  0  0   61 13  820   2150    4   0  0  0  0  0  0   60 14  850 -1120  22   0   33  0  0  0  0  0 15  855 -1040    5   0  0  0  0   48  0  0 16  925  680    7   0  0  0  0  0  0   47 17  935   -810  10   0  0  0   33  0  0  0 18  945   -340    3   0  0  0  0  0  0   43 19  950   -550  14   0  0  0  0  0  0   42 20   1125 -1420  23   0  0  0  0  0   22  0 21   1155  160    9   0  0  0  0  0  0   17 22   1210   -280  11   0  0  0  0  0  0   14 23   1210   1720  18   0  0  0  0  0  0   14 24   1245  110    6   0  0  0  0  0  0  7 25   1305  180  24   0  0  0  0  0  0  3 then I might notice that experiments that start early (<830) and others that start late (>1130) might tend to have higher PL_Pos values. However I'd like to get PL_Pos into the table. Does that mean melt the data a second time? Thanks, Mark ------------------------------ Message: 97 Date: Wed, 8 Jul 2009 16:31:30 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <[hidden email]> Cc: R <[hidden email]>, Uwe Ligges    <[hidden email]>,   Farrel Buchinsky <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 No one really knows how many people are being affected. Also one can minimize the impact like this: 1. In Rtools, change find.exe to find2.exe. 2. In R, create a 'find' a variable in any script using find and at the top check for find2 and if found set the find variable to find2 otherwise set it to find. Then fix the script to use the find variable instead of find. That would work with systems having find2 or having find so new versions of R would work with both new and old versions of Rtools. The only combination that would not work would be old versions of R with new versions of the Rtools but that is not a likely combination and even if it does occur it would give an error so the user would know something is wrong which is far better than the current situation where a silent hard-to-diagnose risk that is entered onto your system. On Wed, Jul 8, 2009 at 3:51 PM, Duncan Murdoch<[hidden email]> wrote: > On 7/8/2009 3:39 PM, Gabor Grothendieck wrote: >> >> I understand what you wrote. Its just that I don't agree that that >> is a reasonable solution. >> >> What is wanted is something that works safely out of the box, >> not something with a built in danger that every single person >> that uses it must fix (and know about it to fix) in order to >> maintain the integrity of their system. > > As far as I know, you are the only person in the whole world who has been > affected by this. ?But fixing it would inconvenience hundreds of people, who > would have to install a new version of Rtools, if the make system suddenly > started looking for find2 instead of find. > > So it's unfortunate that Microsoft chose to use the name of the wrong Unix > utility when they wrote find, and it's unfortunate that the first version of > Rtools didn't fix this, but there you are: ?name clashes happen, and > sometimes you need to work around them. > > Duncan Murdoch > >> >> On Wed, Jul 8, 2009 at 3:30 PM, Duncan Murdoch<[hidden email]> >> wrote: >>> >>> On 7/8/2009 3:18 PM, Gabor Grothendieck wrote: >>>> >>>> To my mind its pretty serious that Rtools can make other >>>> software not work and the importance of using the word >>>> find in the tools is close to zero. ?Most people never even >>>> look at the scripts. >>> >>> You didn't read what I wrote. ?It could be called anything as far as the >>> scripts are concerned. ?I explained to you how to rename it and keep them >>> happy. >>> >>> Duncan Murdoch >>>> >>>> Why don't you just rename find.exe to find2.exe, say, in >>>> Rtools and adjust the other files accordingly. For the small >>>> number of people who ever look at the scripts it will be obvious >>>> that we are dealing with a find variant and the danger and need >>>> for kludges is eliminated. >>>> >>>> On Wed, Jul 8, 2009 at 12:55 PM, Duncan Murdoch<[hidden email]> >>>> wrote: >>>>> >>>>> On 08/07/2009 12:04 PM, Gabor Grothendieck wrote: >>>>>> >>>>>> Its safer just to temporarily add it to your path. >>>>>> >>>>>> Unfortunately Rtools has a find command that conflicts with >>>>>> the find command in Windows so if you add the Rtools >>>>>> bin directory to your path permanently then you could >>>>>> find other programs stop working. ?That actually happened >>>>>> to me once and it took the longest time until I discovered >>>>>> that Rtools was the culprit. >>>>> >>>>> That's true, but there is a workaround: you can manually rename the >>>>> find.exe >>>>> in Rtools, and adjust the entry in one of the R makefiles (MkRules), >>>>> and >>>>> it >>>>> will use the new name instead of "find". ?The reason you might not want >>>>> to >>>>> do this is you might expect find to act the way it does on Unix: ?the >>>>> Rtools >>>>> basically try to make Windows look a little bit like Unix. >>>>> >>>>> Duncan Murdoch >>>>> >>>>>> >>>>>> If you follow the advice I gave you normally won't have >>>>>> that problem. >>>>>> >>>>>> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >>>>>> wrote: >>>>>>> >>>>>>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>>>>>> >>>>>>>> Forgive my naivte, but how do I make windows find tar. In other >>>>>>>> words >>>>>>>> from >>>>>>>> where do I issue the command and what is the command. >>>>>>> >>>>>>> You need to install the toolset, and let the installer set your path. >>>>>>> >>>>>>> Duncan Murdoch >>>>>>> >>>>>>>> Farrel Buchinsky >>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>>>>>> >>>>>>>>>> I ?have previously read "R Installation and Administration". I >>>>>>>>>> read >>>>>>>>>> it >>>>>>>>>> again. It does not help me >>>>>>>>>> The relevant paragraph is below. But I need lower level >>>>>>>>>> instructions. >>>>>>>>>> Where >>>>>>>>>> can I find them. >>>>>>>>>> >>>>>>>>> Follow the link. ?If Windows can't find tar, your toolset is >>>>>>>>> installed >>>>>>>>> incorrectly. >>>>>>>>> >>>>>>>>> Duncan Murdoch >>>>>>>>> >>>>>>>>> >>>>>>>>>> R CMD INSTALL works in Windows to install source packages if you >>>>>>>>>> have >>>>>>>>>> the >>>>>>>>>> source-code package files (option ?Source Package Installation >>>>>>>>>> Files? >>>>>>>>>> in >>>>>>>>>> the >>>>>>>>>> installer) and toolset (see The Windows >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>>>>>>> >>>>>>>>>> installed. Installation of binary packages must be done by >>>>>>>>>> install.packages >>>>>>>>>> . R CMD INSTALL --help will tell you the current options under >>>>>>>>>> Windows >>>>>>>>>> (which differ from those on a Unix-alike): in particular there is >>>>>>>>>> a >>>>>>>>>> choice >>>>>>>>>> of the types of documentation to be installed. >>>>>>>>>> Farrel Buchinsky >>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>>>>>> >>>>>>>>>> ?See the manual "R Installation and Administration" for >>>>>>>>>> information >>>>>>>>>> on >>>>>>>>>> how >>>>>>>>>>> >>>>>>>>>>> to install source packages on Windows. >>>>>>>>>>> >>>>>>>>>>> Uwe Ligges >>>>>>>>>>> >>>>>>>>>>> Farrel Buchinsky wrote: >>>>>>>>>>> >>>>>>>>>>> ?After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting >>>>>>>>>>> an >>>>>>>>>>> error >>>>>>>>>>>> >>>>>>>>>>>> message >>>>>>>>>>>> 'tar' is not recongnized as an internal or external command, >>>>>>>>>>>> operable >>>>>>>>>>>> program or batch file. >>>>>>>>>>>> >>>>>>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>>>>>> download directory or should I do it in C:\Program >>>>>>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will >>>>>>>>>>>> the >>>>>>>>>>>> Rcmd >>>>>>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>>>>>> >>>>>>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>>>>>> <[hidden email]>wrote: >>>>>>>>>>>> >>>>>>>>>>>> ?I have haven't neen following this thread but: >>>>>>>>>>>> >>>>>>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>>>>>> that its not the same name as the built file about to be >>>>>>>>>>>>> created. >>>>>>>>>>>>> The second line detars it into the RGoogleDocs directory. ?The >>>>>>>>>>>>> third >>>>>>>>>>>>> builds >>>>>>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. ?The fourth >>>>>>>>>>>>> installs the built source file into R. ?I've assumed Windows. >>>>>>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>>>>>> >>>>>>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>>>> >>>>>>>>>>>>> or >>>>>>>>>>>>> >>>>>>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file >>>>>>>>>>>>> then >>>>>>>>>>>>> you >>>>>>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>>>>>> the others. >>>>>>>>>>>>> >>>>>>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel >>>>>>>>>>>>> Buchinsky<[hidden email]> >>>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> ?What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>>>>>> >>>>>>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>>>>> to? Or do you mean that I must create a directory called >>>>>>>>>>>>>> RGoogleDocs >>>>>>>>>>>>>> >>>>>>>>>>>>>> ?under >>>>>>>>>>>>> >>>>>>>>>>>>> ?Library and then change to that directory? >>>>>>>>>>>>>> >>>>>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>>>>>> >>>>>>>>>>>>>> ?[hidden email]> >>>>>>>>>>>>> >>>>>>>>>>>>> ?wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>> ?Finally enter into the Windows console: >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>>>>>> created by the build. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> ? ?[[alternative HTML version deleted]] >>>>>>>>>>>> >>>>>>>>>>>> ______________________________________________ >>>>>>>>>>>> [hidden email] mailing list >>>>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>>> >>>>>>>>>> ______________________________________________ >>>>>>>>>> [hidden email] mailing list >>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------ >>>>>>>> >>>>>>>> ______________________________________________ >>>>>>>> [hidden email] mailing list >>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>> PLEASE do read the posting guide >>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>> >>>>>>> ______________________________________________ >>>>>>> [hidden email] mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>> PLEASE do read the posting guide >>>>>>> http://www.R-project.org/posting-guide.html >>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>> >>>>>> >>>>>> ______________________________________________ >>>>>> [hidden email] mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>>> >>>> >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> > > ------------------------------ Message: 98 Date: Wed, 8 Jul 2009 16:36:48 -0400 From: suman Duvvuru <[hidden email]> Subject: [R] Unix commands on R To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain I am using R on unix. While in R how do I execute the unix shell commands? Is there a way to do it? I am executing a function in R and the matrix resulting from the function has to be passed on as an input to unix command.. Any directions will be helpful. Thanks, Suman    [[alternative HTML version deleted]] ------------------------------ Message: 99 Date: Wed, 8 Jul 2009 16:52:37 -0400 From: Justin Donaldson <[hidden email]> Subject: [R] rgtk2 colorbutton To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain How do you retrieve the color from a GtkColorButton in rgtk2? There seems to be a promising function gtkColorButtonGetColor However, the function doesn't return the current color, instead it *sets* a color that you pass to it. The function header looks like gtkColorButtonGetColor(color_button, color), and doesn't return anything. That's a bit convoluted, but manageable. I'll just create a "color", let gtkColorButtonGetColor set it, and then read the modified value However, you have to pass a *GdkColor* type to set "color".... The simplest way to create one seems to be: color = as.GdkColor('white') It seems I should be able to pass this color to the color button handler and see what the selected color is. HOWEVER, this still doesn't work. gtkColorButtonGetColor still does not modify the created color. >:( require rgtk2 b<-gtkColorButtonNew() gw <- gtkWindow(show=F) gw$Add(b) gw$Show() changeColor<-function(b){   color = as.GdkColor('white') # create a color to change   message('initial color value')   print(color)# print it out   gtkColorButtonGetColor(b,color) # this function should change 'color'   message('after gtkColorButtonGetColor()... on my machine the color is unchanged:')   print(color) } gSignalConnect(b, 'color-set',changeColor) Best, -Justin -- Justin Donaldson PhD Candidate, Informatics Indiana University http://www.scwn.net aim: iujjd    [[alternative HTML version deleted]] ------------------------------ Message: 100 Date: Wed, 08 Jul 2009 22:57:36 +0200 From: Uwe Ligges <[hidden email]> Subject: Re: [R] R2WinBUGS under Linux/WINE fails To: Harlan Harris <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Harlan Harris wrote: > Hi, > > I'm running wine-1.0.1, OpenBUGS 3.0.3, R 2.9.0, and R2WinBUGS on a Redhat > Enterprise Linux machine. > > Following various peoples' suggestions... > > This works perfectly (yay!): wine Z:/opt/OpenBUGS/winbugs.exe > > Within R, however, I get this: > > (setup the example from ?bugs, then....) > > R> schools.sim <- bugs(data, inits, parameters, model.file, n.chains=3, > n.iter=5000,bugs.directory="Z:/opt/OpenBUGS/") > Error in file(con, "rb") : cannot open the connection > In addition: Warning message: > In file(con, "rb") : >   cannot open file > '/home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc': > No such file or directory > Error in bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE = useWINE, > : >   WinBUGS executable does not exist in > /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS/ > > Trying to figure out these path issues: > >> ls /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS/ > BackBUGS.lnk    Compare  Docu   Graph      Lindev > Ole        Randnumseeds.odc Std   Updater > brugs.dll    Correl    Doodle  Host     Manuals > OpenBUGS.zip     Ranks        Summary Win > brugs.so      Dev    Examples Html     Maps > Plots       Samples       System   winbugs.exe > Bugs        Developer Form   libtaucs.dll Math > randnumseeds0.bmp Script.odc    Test    Xhtml > classicbugs.exe Deviance   GeoBUGS   Lin       Monitors > Randnumseeds.html Spatial       Text > >> ls /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc > ls: /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc: > No such file or directory > > So, the warning message is correct, but the error is not. winbugs.exe > clearly exists, and I'd expect bugs.run to find it... Can you please try to reinstall? BTW, which version of R2WinBUGS are we talking about, the most recent one? > > If I add "program="openbugs"", then I get the warning to install BRugs, > which no longer exists. (But it's not clear if that's necessary.) BRugs is available from the CRAN extras repository hosted by Brian Ripley. Is BRugs really working on your machine? I've not heared of many  working Linux installations. Best, Uwe Ligges > Is it possible to make this work? > > If not, I'm extremely thankful that I can use Bugs under Wine, but I'd [[elided Yahoo spam]] > [[elided Yahoo spam]] > > -Harlan > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 101 Date: Wed, 8 Jul 2009 17:03:58 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] Unix commands on R To: suman Duvvuru <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 ?system ?shQuote On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuru<[hidden email]> wrote: > I am using R on unix. While in R how do I execute the unix shell commands? > Is there a way to do it? I am executing a function in R and the matrix > resulting from the function has to be passed on as an input to unix command. > > > Any directions will be helpful. > > Thanks, > Suman > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 102 Date: Wed, 08 Jul 2009 22:53:00 +0200 From: Emmanuel Charpentier <[hidden email]> Subject: Re: [R] Unix commands on R To: [hidden email] Message-ID: <1247086380.4095.4.camel@PortableToshiba> Content-Type: text/plain; charset="UTF-8" Le mercredi 08 juillet 2009 ? 16:36 -0400, suman Duvvuru a ?crit : > I am using R on unix. While in R how do I execute the unix shell commands? > Is there a way to do it? I am executing a function in R and the matrix > resulting from the function has to be passed on as an input to unix command. > > > Any directions will be helpful. ?system ?capture ?textConnection These three functions (I'm not sure bout the real name of the second) should allow you to get the standard output of a Unix command line. Consider also cpturing your command output in a file (reusable...). HTH,                Emmanuel Charpentier ------------------------------ Message: 103 Date: Wed, 08 Jul 2009 23:19:24 +0200 From: Uwe Ligges <[hidden email]> Subject: Re: [R] system() how to make a program run a specific file -    RUN and   Output directory issues To: "Paulo E. Cardoso" <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Paulo E. Cardoso wrote: > I have a particular case where the program I'm calling needs a additional > instructions, to click a RUN button and set a output directory. Could these > options be controlled with system() function? system() just calls the program as started from the operating system's command line (or under Windows without an underlying shell). That implies that it cannot press buttons, you can "only" specify command line flags, if the program you are talking about accepts these ... Uwe Ligges > ____________ > Paulo E. Cardoso > > >> -----Mensagem original----- >> De: [hidden email] [mailto:[hidden email]] >> Em nome de Paulo E. Cardoso >> Enviada: quarta-feira, 8 de Julho de 2009 12:08 >> Para: [hidden email] >> Cc: [hidden email] >> Assunto: Re: [R] system() how to make a program run a specific file >> >> After all it's very easy: >> >> system(paste('"C:\\Program Files >> (x86)\\IrfanView\\i_view32.exe"','A:\\test.jpg')) >> >> ____________ >> Paulo E. Cardoso >> >> >>> -----Mensagem original----- >>> De: [hidden email] [mailto:r-help-bounces@r- >> project.org] >>> Em nome de Paulo E. Cardoso >>> Enviada: quarta-feira, 8 de Julho de 2009 10:59 >>> Para: [hidden email] >>> Cc: [hidden email] >>> Assunto: [R] system() how to make a program run a specific file >>> >>> I'd like to know how to call a program to run or open a specific >> file. >>> >>> >>> something like this: >>> >>> system('"C:\\Program Files (x86)\\IrfanView\\i_view32.exe"','-A:\\ >>> teste.jpg') is not working. >>> >>> >>> >>> any help will be appreciated >>> >>> ____________ >>> >>> Paulo E. Cardoso >>> >>> >>> >>> >>>    [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> [hidden email] mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting- >>> guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> Checked by AVG - www.avg.com >>> Version: 8.5.375 / Virus Database: 270.13.8/2223 - Release Date: >>> 07/07/09 17:54:00 >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting- >> guide.html >> and provide commented, minimal, self-contained, reproducible code. >> Checked by AVG - www.avg.com >> Version: 8.5.375 / Virus Database: 270.13.8/2223 - Release Date: >> 07/07/09 17:54:00 > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 104 Date: Thu, 9 Jul 2009 09:23:55 +1200 From: Rolf Turner <[hidden email]> Subject: Re: [R] how to read point shp file to R? To: Sunny <[hidden email]> Cc: "[hidden email]" <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset="US-ASCII"; delsp=yes; format=flowed On 8/07/2009, at 6:28 AM, Sunny wrote: > I am new with R and want do some analysis with a point vector data > file. Any > help is appreciate. Sunny See the vignette ``Handling shapefiles in the spatstat package'' from the spatstat package on CRAN.    cheers,       Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}} ------------------------------ Message: 105 Date: Wed, 8 Jul 2009 17:23:22 -0400 From: "Wouterse, Fleur \(IFPRI-Senegal\)" <[hidden email]> Subject: [R] truncated regression out-of-sample predictions To: <[hidden email]> Message-ID: <5C41B489BDE4614A9FA014D690BEB03F0C3F9238@IFPRIE> Content-Type: text/plain;   charset="us-ascii" Dear all, I am trying to implement Simar & Wilson's (2007) second algorithm and have the following question: If I use a truncated regression on the m<n observations, how do I get fitted values for all n observations, instead of for m observations, which is what the command fitted returns; I would need these to construct the left-truncation needed to draw n random deviates. Thanks for your help, Fleur -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Karina Boege Sent: Wednesday, July 08, 2009 11:18 AM To: [hidden email] Subject: [R] bootstrapping error message "Error in t.star[r, ] <- statistic(data, i[r, ], ...) : number of items to replace is not a multiple of replacement length" Hi, I am trying to run some bootstraps with the boot package. When I run it with 400 replicates it does it ok, but then I need to run the same analysis but with 89, 86, 102 and 106 samples (for four different environments), and then is when I get the error message: > mybootstrap <- boot(Datos, mystat, 2000) Error in t.star[r, ] <- statistic(data, i[r, ], ...) : number of items to replace is not a multiple of replacement length Anyone familiar with this error message? Does anyone knows the minimum sample size for boot package to run properly? Is there anyway to tell R how many samples should it pick for the resampling? If it helps, this is how my model looks like: mymodel = lm(Datos[,4]~Datos[,1]+ Datos[,8]+Datos[,9]+Datos[,10]+Datos[,11]+Datos[,12]) summary(mymodel) mystat <- function(a,b) f<- lm(a[b,4]~a[b,1]+a[b,8]+ a[b,9]+a[b,10]+a[b,11]+a[b,12])$coef mybootstrap <- boot(Datos, mystat, 2000) INT1<-boot.ci(mybootstrap, conf=0.95, type="all", index=1) INT2<-boot.ci(mybootstrap, conf=0.95, type="all", index=2) INT3<-boot.ci(mybootstrap, conf=0.95, type="all", index=3) INT4<-boot.ci(mybootstrap, conf=0.95, type="all", index=4) INT5<-boot.ci(mybootstrap, conf=0.95, type="all", index=5) INT6<-boot.ci(mybootstrap, conf=0.95, type="all", index=6) INT7<-boot.ci(mybootstrap, conf=0.95, type="all", index=7) Thanks for your help! I am new to bootstraps and to R, and I feel pretty lonely with this Karina Boege ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 106 Date: Wed, 8 Jul 2009 18:02:19 -0400 From: Harlan Harris <[hidden email]> Subject: Re: [R] R2WinBUGS under Linux/WINE fails To: Uwe Ligges <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Uwe, thanks for helping! After some poking around, I realized that the problem was that I had installed OpenBUGS instead of WinBUGS. I did an additional installation of WinBUGS, which also runs fine under Wine, and now [[elided Yahoo spam]] To clarify: both the OpenBUGS and WinBUGS distributions run nicely under Linux/Wine. However, despite the fact that R2WinBUGS 2.1-14 claims (in ?bugs) it can run both OpenBUGS and WinBUGS, this does not seem to be true under Linux/Wine. Only WinBUGS currently works with R2WinBUGS, at least for me. (I did figure out how to use CODA export from Win/OpenBUGS and the coda package to import into R, but it's a bit tedious...) -Harlan    [[alternative HTML version deleted]] ------------------------------ Message: 107 Date: Thu, 09 Jul 2009 00:05:06 +0200 From: Uwe Ligges <[hidden email]> Subject: Re: [R] R2WinBUGS under Linux/WINE fails To: Harlan Harris <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Harlan Harris wrote: > Uwe, thanks for helping! After some poking around, I realized that the > problem was that I had installed OpenBUGS instead of WinBUGS. I did an > additional installation of WinBUGS, which also runs fine under Wine, and now [[elided Yahoo spam]] > > To clarify: both the OpenBUGS and WinBUGS distributions run nicely under > Linux/Wine. However, despite the fact that R2WinBUGS 2.1-14 claims (in > ?bugs) it can run both OpenBUGS and WinBUGS, this does not seem to be true > under Linux/Wine. Only WinBUGS currently works with R2WinBUGS, at least for > me. This is because BRugs (the interface R2WinBUGS requires for OpenBUGS) simply does not work under (most) non-Windows operating systems. Best, Uwe > > (I did figure out how to use CODA export from Win/OpenBUGS and the coda > package to import into R, but it's a bit tedious...) > > -Harlan > ------------------------------ Message: 108 Date: Thu, 09 Jul 2009 00:11:33 +0200 From: Uwe Ligges <[hidden email]> Subject: Re: [R] \dQuote in packages To: Rebecca Sela <[hidden email]> Cc: r-help <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed The difference you are experiencing is the new Rd2 parser that is more picky now (but also prevents to produce wrong documentation files). If you make the code of the Rd available, someone might be able to help. [[elided Yahoo spam]] Best, Uwe Ligges Rebecca Sela wrote: > I am in the process of submitting a package to CRAN. R CMD check ran successfully on the package on my local computer, using R version 2.1.1. However, on the computers for CRAN (with version 2.10.0), the following errors occurred: > > Warning in parse_Rd("./man/predict.Rd", encoding = "unknown") : >   ./man/predict.Rd:28: unknown macro '\dquote' > *** error on file ./man/predict.Rd > Error : ./man/predict.Rd:28: Unrecognized macro \dquote > Warning in parse_Rd("./man/print.Rd", encoding = "unknown") : >   ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects' > Warning in parse_Rd("./man/simpleREEMdata.Rd", encoding = "unknown") : >   ./man/simpleREEMdata.Rd:10: unknown macro '\item' > > Are \dquote, \sideeffects, and \item not supported in newer versions of R? Is there some underlying problem that I should fix that makes these show up? > > Thank you very much. > > Rebecca > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 109 Date: Wed, 8 Jul 2009 14:00:48 -0600 From: Amy Wesolowski <[hidden email]> Subject: [R] R Help Question To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hi, I am currently working on reading large files into R. My files are text documents with four columns and around 10 million lines. Each line is set up as: string|integer|string|integer I have been trying to use read.table to read in the file, but I think I am reading too much into memory and the application quits. I want to be able to analyze the entire text document at once. I have thought about reading in the file, line by line, but I still want to store all the information together. I have also thought about writing each line of the file to a matrix, but I cannot seem to figure it out. Any help would be great. Thanks, Amy    [[alternative HTML version deleted]] ------------------------------ Message: 110 Date: Wed, 8 Jul 2009 14:47:46 -0700 (PDT) Subject: [R] A Lattice Question To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii To the Lattice expert - I am new to the lattice package and I would like to add a curve to the xyplot(). I know that I need to use panel function to add it. But it doesn't work. Is there anyone can help me out on how to transfer the data into the function? The following is my code and I would like to add lines for xx,yy xx <- seq(0,1,length = 100); yy <- mean(PS$theta)*(1-exp(mean(PS$k)*xx))/(1-exp(mean(PS$k))) ts1 <- xyplot(VCFB ~ Visit , groups = ID, data = CFB_M, type = c('g','l'),strip = strip.custom(style =4), as.table=TRUE,xlab = 'Time',ylab = 'FBG CFB',main = '3mg Change from Baseline FBG',panel=function (xx,yy,...) {     panel.xyplot(...);     panel.lines(xx,yy,...);}); Many thanks!! Best, Haoda ------------------------------ Message: 111 Date: Wed, 8 Jul 2009 13:46:49 -0600 From: Tracey Frescino <[hidden email]> Subject: [R] subsetting a dataframe with a string logical expression To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hi, I am trying to subset a dataset based on a filter defined by a user... I prompt the user for input.. resulting in a string logical expression ("X1 < 3"). I have tried using subset, but it is looking for a logical expression, not a character string. I keep getting the error: 'subset' must evaluate to logical. Example: x <- data.frame(matrix(1:15, nrow=5, ncol=3)) filter = "X1 < 3" subset(x, filter) Any ideas?? Thanks much, Tracey    [[alternative HTML version deleted]] ------------------------------ Message: 112 Date: Wed, 8 Jul 2009 13:25:22 -0700 (PDT) From: Olivella <[hidden email]> Subject: [R] Substituting numerical values using `apply' To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii Hello, I wish to perform a substitution of certain numerical values in a data matrix with the corresponding column name. For instance, if I have a data matrix V1 V2 V3 2  0  1 0  1  2 1  5  0 5  0  0 I want to substitute the `1' and the `2' for the corresponding column name, and make everything else `NA' like this V1  V2  V3 V1  NA  V3 NA  V2  V3 V1  NA  NA NA  NA  NA I have done this using an explicit `for' loop, but it takes a really long time to finish. Is there any way I can do this using `apply' or some form of implicit looping? Thank you for your help, SO -- View this message in context: http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 113 Date: Thu, 09 Jul 2009 08:38:53 +1200 From: Paul Murrell <[hidden email]> Subject: Re: [R] Tex fonts in R plots To: KARAVASILIS GEORGE <[hidden email]> Cc: "[hidden email]" <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi KARAVASILIS GEORGE wrote: > Hello, R users. > I would like to display the font of Math Mode of MikTex 2.3, WinEdt 5.4 > in R plots, e.g. in xlab, ylab or legend. > How can I do that? > Thank you in advance. See http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html and "Non-standard fonts in PostScript and PDF graphics" in http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf Paul > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [hidden email] http://www.stat.auckland.ac.nz/~paul/ ------------------------------ Message: 114 Date: Wed, 08 Jul 2009 22:53:00 +0200 From: Emmanuel Charpentier <[hidden email]> Subject: Re: [R] Unix commands on R To: suman Duvvuru <[hidden email]> Cc: [hidden email] Message-ID: <1247086380.4095.4.camel@PortableToshiba> Content-Type: text/plain; charset="UTF-8" Le mercredi 08 juillet 2009 ? 16:36 -0400, suman Duvvuru a ?crit : > I am using R on unix. While in R how do I execute the unix shell commands? > Is there a way to do it? I am executing a function in R and the matrix > resulting from the function has to be passed on as an input to unix command. > > > Any directions will be helpful. ?system ?capture ?textConnection These three functions (I'm not sure bout the real name of the second) should allow you to get the standard output of a Unix command line. Consider also cpturing your command output in a file (reusable...). HTH,                Emmanuel Charpentier ------------------------------ Message: 115 Date: Wed, 8 Jul 2009 17:05:37 -0400 From: Zhiliang Ma <[hidden email]> Subject: Re: [R] Unix commands on R To: suman Duvvuru <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 ?system On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuru<[hidden email]> wrote: > I am using R on unix. While in R how do I execute the unix shell commands? > Is there a way to do it? I am executing a function in R and the matrix > resulting from the function has to be passed on as an input to unix command. > > > Any directions will be helpful. > > Thanks, > Suman > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 116 Date: Wed, 8 Jul 2009 17:25:25 -0400 From: Zhiliang Ma <[hidden email]> Subject: Re: [R] Two-way ANOVA gives different results using    anova(lm())   than doing it by hand To: Lars Bergemann <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 the following works. i don't exactly what happens here. I guess "lm" might treat S1 and S2 as quantitative variables, not qualitative variables. cheers, Zhiliang S1 <- as.character(Data[,1]) S1 <- as.factor(S1) S2 <- as.character(Data[,2]) S2 <- as.factor(S2) data <- data.frame(S1=S1, S2=S2, ExM=Data[,4]) g <- lm(ExM ~ S1*S2, data) anova(g) Analysis of Variance Table Response: ExM        Df Sum Sq Mean Sq F value  Pr(>F) S1     5 4.7454 0.9491 961.66 < 2..2e-16 *** S2     5 4.9548 0.9910 1004.10 < 2.2e-16 *** S1:S2   25 1.2993 0.0520   52.66 < 2..2e-16 *** Residuals 180 0.1776 0.0010 --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 On Wed, Jul 8, 2009 at 10:34 AM, Lars Bergemann<[hidden email]> wrote: > > Hey! > > > > Could you please take a quick look at what I have done? Somehow I get wrong results using the anova(lm()) combination compared to doing a two way ANOVA by hand. > > > > Running: > > > > Data<-read.table("Data.txt"); > g<-lm(ExM~S1*S2,Data); > anova(g); > > > > Gives: > > > > Analysis of Variance Table > > Response: ExM > ? ? ? ? ? Df Sum Sq Mean Sq F value ? ?Pr(>F) > S1 ? ? ? ? ?1 4.3679 ?4.3679 167.045 < 2.2e-16 *** > S2 ? ? ? ? ?1 0.9427 ?0.9427 ?36.053 8.236e-09 *** > S1:S2 ? ? ? 1 0.3231 ?0.3231 ?12.357 0.0005371 *** > Residuals 212 5.5434 ?0.0261 > > > I compared it to the work done by hand, ie calculated all the different square sums using sum() and tapply(). > > So I know that anova(lm()) gets the degrees of freedom equal two 1, 1, 1 and 212 when it should be 5, 5, 25 and 180. Also, the square sums are quite different ... I get 4.xx, 4.xx, 1.xx, 0.xx ... as you see, what anova(lm()) gets is different. > > > > The data: S1 has 6 levels, so has S2. On average, each cell has 6 values, most cells have actually 6 values, and there are two of each: 5, 7, 4, 8 - so average 6. > > > > Could you please help me, why it does not work with anova(lm())? I tried quite a few thinks found with Google, but it all gave me the same result as anova(lm()) ... > > > > Thanks a lot! > > > > Lars > > _________________________________________________________________ > > > > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > ------------------------------ Message: 117 Date: Wed, 8 Jul 2009 15:38:53 -0700 From: "Guazzelli, Alex" <[hidden email]> Subject: [R] How to deploy statistical models built in R in real-time? To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain I am framing this as a question since I would like to know how folks are currently deploying the models they build in R. Say, you want to use the results of your model inside another application in real-time or on-demand, how do you do it? How do you use the decisions you get back from your models? As you may know, a PMML package is available for R that allows for many mining model to be exported into the Predictive Model Markup Language. PMML is the standard way to represent models and can be exported from most statistical packages (including SPSS, SAS, KNIME, ...). Once your model is represented as a PMML file, it can easily be moved around. PMML allows for true interoperability. We have recently published an article about PMML on The R Journal. It basically describes the PMML language and the package itself. If you are interested in finding out more about PMML and how to benefit from this standard, please check the link below. http://journal.r-project.org/2009-1/RJournal_2009-1_Guazzelli+et+al.pdf We have also wrote a paper about open standards and cloud computing for the SIGKDD Explorations newsletter. In this paper, we describe the ADAPA Scoring Engine which executes PMML models and is available as a service on the Amazon Cloud. ADAPA can be used to deploy R models in real-time from anywhere in the world. I believe it represents a revolution in data mining since it allows for anyone that uses R to make effective use of predictive models at a cost of less than $1/hour. http://www.zementis.com/docs/SIGKDD_ADAPA.pdf Thanks! Alex    [[alternative HTML version deleted]] ------------------------------ Message: 118 Date: Wed, 8 Jul 2009 18:55:09 -0400 From: Farrel Buchinsky <[hidden email]> Subject: [R] Getting value rather than formula in RGoogleDocs To: Duncan Temple Lang <[hidden email]>, R    <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain Is there an easy way to read the value of the cells rather than the formula?So for instance in a cell whose value was created by simply using the value from the cell immediately to the left in the Google spreadsheet I would prefer to get the value rather than =RC[-1] When one exports with Google Spreadsheets as a csv then that does not happen. I am using the following line of code in R y2009<-sheetAsMatrix(ts2$y2009,header=TRUE, as.data.frame=TRUE, trim=TRUE) Farrel Buchinsky Google Voice Tel: (412) 567-7870    [[alternative HTML version deleted]] ------------------------------ Message: 119 Date: Wed, 8 Jul 2009 19:15:03 -0400 From: Jorge Ivan Velez <[hidden email]> Subject: Re: [R] Substituting numerical values using `apply' To: Olivella <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Dear Olivella, Assuming that x is your data, here is one possible way to do what you want: t(    apply(x, 1, function(x){              index <- x %in% c(1,2)              x[index] <- cls[index]              x[!index] <- NA              x              }        )  ) How big is the data you are dealing with? HTH, Jorge On Wed, Jul 8, 2009 at 4:25 PM, Olivella <[hidden email]> wrote: > > Hello, > > I wish to perform a substitution of certain numerical values in a data > matrix with the corresponding column name. For instance, if I have a data > matrix > V1 V2 V3 > 2  0  1 > 0  1  2 > 1  5  0 > 5  0  0 > > I want to substitute the `1' and the `2' for the corresponding column name, > and make everything else `NA' like this > V1  V2  V3 > V1  NA  V3 > NA  V2  V3 > V1  NA  NA > NA  NA  NA > > I have done this using an explicit `for' loop, but it takes a really long > time to finish. Is there any way I can do this using `apply' or some form > of > implicit looping? > > Thank you for your help, > > SO > -- > View this message in context: > http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 120 Date: Wed, 8 Jul 2009 19:18:08 -0400 From: Jorge Ivan Velez <[hidden email]> Subject: Re: [R] Substituting numerical values using `apply' To: Olivella <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Arggghhhh! Forgot to add "cls" before the code. Here is the (hopefully) complete version: # column names cls <- colnames(x) # Transformation res <- t(      apply(x, 1, function(x){            index <- x %in% c(1,2)            x[index] <- cls[index]            x[!index] <- NA              x                 }          )        ) res HTH, Jorge On Wed, Jul 8, 2009 at 7:15 PM, Jorge Ivan Velez <[hidden email]>wrote: > Dear Olivella, > Assuming that x is your data, here is one possible way to do what you want: > > t( >  apply(x, 1, function(x){ >            index <- x %in% c(1,2) >            x[index] <- cls[index] >            x[!index] <- NA >            x >            } >      ) >   ) > > How big is the data you are dealing with? > > HTH, > > Jorge > > > On Wed, Jul 8, 2009 at 4:25 PM, Olivella <[hidden email]> wrote: > >> >> Hello, >> >> I wish to perform a substitution of certain numerical values in a data >> matrix with the corresponding column name. For instance, if I have a data >> matrix >> V1 V2 V3 >> 2  0  1 >> 0  1  2 >> 1  5  0 >> 5  0  0 >> >> I want to substitute the `1' and the `2' for the corresponding column >> name, >> and make everything else `NA' like this >> V1  V2  V3 >> V1  NA  V3 >> NA  V2  V3 >> V1  NA  NA >> NA  NA  NA >> >> I have done this using an explicit `for' loop, but it takes a really long >> time to finish. Is there any way I can do this using `apply' or some form >> of >> implicit looping? >> >> Thank you for your help, >> >> SO >> -- >> View this message in context: >> http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ------------------------------ Message: 121 Date: Wed, 08 Jul 2009 16:35:52 -0700 From: Duncan Temple Lang <[hidden email]> Subject: Re: [R] Getting value rather than formula in RGoogleDocs To: Farrel Buchinsky <[hidden email]> Cc: R <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Farrel Buchinsky wrote: > Is there an easy way to read the value of the cells rather than the formula?So > for instance in a cell whose value was created by simply using the value > from the cell immediately to the left in the Google spreadsheet I would > prefer to get the value rather than =RC[-1] > > When one exports with Google Spreadsheets as a csv then that does not > happen. > > I am using the following line of code in R > y2009<-sheetAsMatrix(ts2$y2009,header=TRUE, as.data.frame=TRUE, trim=TRUE) > and then retrieve it with RGoogleDocs, I get the values not the formula. So I'll need a sample spreadsheet from which you get the formula and not the value.    D. > > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 122 Date: Wed, 8 Jul 2009 20:37:30 -0300 From: Henrique Dallazuanna <[hidden email]> Subject: Re: [R] subsetting a dataframe with a string logical    expression To: Tracey Frescino <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Try this: subset(x, eval(parse(text=filter))) On Wed, Jul 8, 2009 at 4:46 PM, Tracey Frescino <[hidden email]> wrote: > Hi, > > I am trying to subset a dataset based on a filter defined by a user... > I prompt the user for input.. resulting in a string logical expression > ("X1 < 3"). > > I have tried using subset, but it is looking for a logical expression, not > a character string. > I keep getting the error: 'subset' must evaluate to logical. > > > Example: > x <- data.frame(matrix(1:15, nrow=5, ncol=3)) > filter = "X1 < 3" > subset(x, filter) > > > Any ideas?? > > > > Thanks much, > Tracey > >    [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 123 Date: Wed, 8 Jul 2009 16:50:02 -0700 (PDT) From: Ben Bolker <[hidden email]> Subject: Re: [R] nested model with random factors To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii Jeff DaCosta wrote: > > I am really having trouble with getting the right syntax for my > model. Here is a truncated version of my data: > > > data >   Ind Treatment Order   Date    PC1 > 1 PER14    SC   3rd 4-May-09 0.5704611 > 2 PER14    SH   1st 26-Apr-09 0.5329025 > 3 PER14    AC   2nd 29-Apr-09 2.1392279 > 4 PER25    SC   2nd 29-Apr-09 -0.2083382 > 5 PER25    SH   3rd 3-May-09 3.7818356 > 6 PER25    AC   1st 26-Apr-09 -1.9689733 > 7 PER30    SC   1st 24-Apr-09 -0.1255970 > 8 PER30    SH   2nd 27-Apr-09 2.1474393 > 9 PER30    AC   3rd 30-Apr-09 -1.8683396 > > > str(data) > 'data.frame':   9 obs. of 5 variables: >   $ Ind   : Factor w/ 3 levels "PER14","PER25",..: 1 1 1 2 2 2 3 3 3 >   $ Treatment: Factor w/ 3 levels "AC","SC","SH": 2 3 1 2 3 1 2 3 1 >   $ Order  : Factor w/ 3 levels "1st","2nd","3rd": 3 1 2 2 3 1 1 2 3 >   $ Date    : Factor w/ 7 levels "24-Apr-09","26-Apr-09",..: 7 2 4 4 > 5 2 1 3 6 >   $ PC1   : num 0.57 0.533 2.139 -0.208 3.782 ... > > > factor(Order, ordered=TRUE) > [1] 3rd 1st 2nd 2nd 3rd 1st 1st 2nd 3rd > Levels: 1st < 2nd < 3rd > > > factor(Date,ordered=TRUE) > [1] 4-May-09 26-Apr-09 29-Apr-09 29-Apr-09 3-May-09 26-Apr-09 24- > Apr-09 27-Apr-09 30-Apr-09 > Levels: 24-Apr-09 < 26-Apr-09 < 27-Apr-09 < 29-Apr-09 < 3-May-09 < 30- > Apr-09 < 4-May-09 > > "Ind" are different individuals in the study, each of which received > three "Treatment"s (SC, SH, and AC). The "Order" (ordered=TRUE) in > which each individual received a treatment was systematically > shuffled in the study, and the "Date" (ordered=TRUE) is simply when > each treatment was completed. The response variable are scores from > a principal components analysis ("PC1"). > > So I want to run a model where "PC1" is the response variable and > "Ind" is nested within "Treatment", and I also want to include > "Order" and "Date" as random factors. > > I have been struggling to describe the model with aov, lm, lme, and > lmer, and don't think I'm getting the syntax right. Suggestions? > > question is less likely to get lost in the noise. A few other thoughts: * "Order" might as well be treated as fixed, you probably won't be able to get a reliable estimate of its associated variance. * I'm not sure that you'll be able to make very much use of the ordering of the factors (unless you want to be extreme and treat them as continuous covariates, i.e. fit a linear trend) in the aov/lme/lmer world. * I would think that lmer(PC1 ~ Treatment*Order+(1|Ind)+(1|Date),data=data) would be a good start. Have you read Pinheiro and Bates 2000?  Ben Bolker -- View this message in context: http://www.nabble.com/nested-model-with-random-factors-tp24398026p24401470.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 124 Date: Wed, 8 Jul 2009 20:09:36 -0400 From: jim holtman <[hidden email]> Subject: Re: [R] R Help Question To: Amy Wesolowski <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 How big is the entire text file? What is the length of an average line? Have you tried to use 'scan' to read in the data? How much memory do you have? Are you paging? Here was a quick test I did with a file with about 5M lines (12|this is some text|12345|more test): > system.time(x <- scan('/tempxx.txt', what=list(0,'',0,''), sep="|")) Read 4460544 records    user system elapsed  50.70  1.04   54.16 > > str(x) List of 4 $ : num [1:4460544] 12 12 12 12 12 12 12 12 12 12 ... $ : chr [1:4460544] "this is some text" "this is some text" "this is some text" "this is some text" ... $ : num [1:4460544] 12345 12345 12345 12345 12345 ... $ : chr [1:4460544] "more test" "more test" "more test" "more test" ... > object.size(x) 107053288 bytes So some more details might help to evaluate what your problem is. Took less than a minute to read it in. On Wed, Jul 8, 2009 at 4:00 PM, Amy Wesolowski<[hidden email]> wrote: > Hi, > > I am currently working on reading large files into R. ?My files are text > documents with four columns and around 10 million lines. > Each line is set up as: > string|integer|string|integer > > I have been trying to use read.table to read in the file, but I think I am > reading too much into memory and the application quits. > > I want to be able to analyze the entire text document at once. > I have thought about reading in the file, line by line, but I still want to > store all the information together. ?I have also thought about writing each > line of the file to a matrix, but I cannot seem to figure it out. > > Any help would be great. > Thanks, > Amy > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/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? ------------------------------ Message: 125 Date: Thu, 9 Jul 2009 10:14:09 +1000 From: Jason Lessels <[hidden email]> Subject: [R] tkrplot installation problems To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hello, I'm running R 2.8.1 on Ubuntu Hardy. I'm trying to install tkrplot. Using r-cran-tkrplot from the repository, I'm getting the following error: > library(tkrplot) Loading required package: tcltk Loading Tcl/Tk interface ... done Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") : [tcl] version conflict for package "Tcl": have 8.5.0, need exactly 8.4. Error in library(tkrplot) : .First.lib failed for 'tkrplot' This tries to install tkrplot version 0.0.16 However, installing R2.8.1 from the repositories automatically installs tcl8.5. In fact, if I try and remove tcl8.5 using synaptic, it also removes R. I also tried to install the package from source, both by using install.packages as well as downloading source (tkrplot 0.0.18). This fails to install. Can someone please help. My ultimate objective is to use the TeachingDemos package. > sessionInfo() R version 2.8.1 (2008-12-22) i486-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] tcltk stats graphics grDevices utils datasets methods [8] base Thanks. Abhijit A little late but i just installed it using sudo apt-get r-cran-tkrplot followed these instructions<http://dreamlinuxforums.org/index.php/topic,4476.0.html> on ubuntu 9.04 64bit hope this helps Jason    [[alternative HTML version deleted]] ------------------------------ Message: 126 Date: Wed, 8 Jul 2009 17:34:46 -0700 (PDT) Subject: [R] Best way to export values from a function? To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. I would like to know the best way to export several doubles from a function, where the doubles are not an array. Here is a contrived function similar to my needs: multipleoutput<-function(x) {    squared<-x^2    cubed<-x^3    exponentioal<-exp(x)    factorialVal<-factorial(x)    } Thanks again for all your help. ------------------------------ Message: 127 Date: Wed, 8 Jul 2009 20:50:14 -0400 From: jim holtman <[hidden email]> Subject: Re: [R] Best way to export values from a function? Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 You can return a list, vector, or any other object: The last value is the return value unless you do an explicit return() > > Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. > > I would like to know the best way to export several doubles from a function, where the doubles are not an array. > > Here is a contrived function similar to my needs: > > multipleoutput<-function(x) > { > ? ? ? ?squared<-x^2 > ? ? ? ?cubed<-x^3 > ? ? ? ?exponentioal<-exp(x) > ? ? ? ?factorialVal<-factorial(x) > > } > > Thanks again for all your help. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/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? ------------------------------ Message: 128 Date: Wed, 08 Jul 2009 17:49:26 -0700 From: "Daniel Nordlund" <[hidden email]> Subject: Re: [R] Best way to export values from a function? To: <[hidden email]> Message-ID: <40A72A4F582E48A5A8392DB60EAD9036@Aragorn> Content-Type: text/plain; charset=us-ascii > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Jason Rupert > Sent: Wednesday, July 08, 2009 5:35 PM > To: [hidden email] > Subject: [R] Best way to export values from a function? > > > Maybe there is a great website out there or white paper that > discusses this but again my Google skills (or lack there of) > let me down. > > I would like to know the best way to export several doubles > from a function, where the doubles are not an array. > > Here is a contrived function similar to my needs: > > multipleoutput<-function(x) > { >    squared<-x^2 >    cubed<-x^3 >    exponentioal<-exp(x) >    factorialVal<-factorial(x) >    > } > multipleoutput<-function(x) {    squared<-x^2    cubed<-x^3    exponential<-exp(x)    factorialVal<-factorial(x)    return(list(squared=squared, cubed=cubed, exponential=exponential, factorialVal=factorialVal)) } Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA ------------------------------ Message: 129 Date: Wed, 8 Jul 2009 17:55:30 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] Best way to export values from a function? Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 > > Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. > > I would like to know the best way to export several doubles from a function, where the doubles are not an array. > > Here is a contrived function similar to my needs: > > multipleoutput<-function(x) > { > ? ? ? ?squared<-x^2 > ? ? ? ?cubed<-x^3 > ? ? ? ?exponentioal<-exp(x) > ? ? ? ?factorialVal<-factorial(x) > > } > > Thanks again for all your help. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > multipleoutput<-function(x) {    answer<- c(0,0,0,0)    MyFuncNames <- c("Squared","Cubed","Exp","Fac")    answer$squared<-x^2    answer$cubed<-x^3    answer$exponential<-exp(x)    answer$factorial<-factorial(x)    return(answer) } X = c(0,0,0,0) X mode(X) names(X) MyNames = c("Squared","Cubed","Exp","Fac") MyNames names(X) = MyNames X <- multipleoutput(2) X class(X) dim(X) ------------------------------ Message: 130 Date: Wed, 8 Jul 2009 20:57:33 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] Best way to export values from a function? Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 > > Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. Yeah, R is difficult to search for - I've had partial success with rseek.org, though. > > I would like to know the best way to export several doubles from a function, where the doubles are not an array. > > Here is a contrived function similar to my needs: > > multipleoutput<-function(x) > { > ? ? ? ?squared<-x^2 > ? ? ? ?cubed<-x^3 > ? ? ? ?exponentioal<-exp(x) > ? ? ? ?factorialVal<-factorial(x) > > } > multipleoutput <- function (x) { return (c(square = x^2, cube = x^3, exp = exp(x))) } But then you'd have to call it like so: > mapply(multipleoutput, c(0,1,2))      [,1]    [,2]    [,3] square  0 1.000000 4.000000 cube   0 1.000000 8.000000 exp     1 2.718282 7.389056 If you call it like so: > multipleoutput(c(0,1,2)) square1 square2 square3  cube1  cube2  cube3    exp1    exp2 0.000000 1.000000 4.000000 0.000000 1.000000 8.000000 1.000000 2.718282   exp3 7.389056 then R flattens the result. Weird. - Godmar ------------------------------ Message: 131 Date: Thu, 9 Jul 2009 00:35:08 +0100 From: tzygmund mcfarlane <[hidden email]> Subject: [R] Dantzig Selector To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Hi, I was wondering if there was an R package or routines for the Dantzig Selector (Candes & Tao, 2007). I know Emmanuel Candes has Matlab routines to do this but I was wondering if someone had ported those to R. Thanks, T ---Reference--- @article{candes2007dantzig,  title={{The Dantzig selector: statistical estimation when p is much larger than n}},  author={Candes, E. and Tao, T.},  journal={Annals of Statistics},  volume={35},  number={6},  pages={2313--2351},  year={2007},  publisher={Hayward, Calif.[etc] Institute of Mathematical Statistics [etc]} } ------------------------------ Message: 132 Date: Wed, 8 Jul 2009 19:28:46 -0500 From: Alfonso Rojas <[hidden email]> Subject: [R] Picante package 0.7 on mac To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed Hello, I tried to run the package but it shows me the following error: In addition: Warning message: package 'picante' was built under R version 2.10.0 Error in library(picante) : .First.lib failed for 'picante' What could I do to run picante in mac R version? ------------------------------ Message: 133 Date: Wed, 08 Jul 2009 19:19:23 -0600 From: Eric Vander Wal <[hidden email]> Subject: [R] Sampling a dataframe based on the length of a subset of    observations within To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Thank you in advance for your consideration. I have a dataframe of 2000+ observations with repeated measures across approximately 300 unique individuals An event either does or does not happen (1,0) and there is a suit of independent variables associated with the event. A simplified representation follows: my.df<-data.frame("id"=c("A","A","A","B","B","C","C","C", "C", "C"), event=c(0,0,1,0,1,0,0,1,1, 0)) _id_ _event_ A    0 A    0 A    1 B    0 B    1 C    0 C    0 C    1 C    1 C    0 I need to sample my.df to select the same number of observations with event = 0 as event = 1 for each unique id. I can reshape or tapply my.df to group id and determine what sample size I need. my.df.cast= library(reshape) my.df.melt<-melt(my.df, id="id") my.df.cast<-cast(my.df.melt, id~value, length, fill=0) my.df.cast      Event _id_   _0_   _1_ A    2    *1* B    1    *1* C    3    *2* Given the above dataframe I need to randomly select (sample) from my.df *one* observation from my.df[my.df$id==A & my.df$event==0], *one* from my.df[my.df$id==B & my.df$event==0], and* two* from my.df[my.df$id==C & my.df$event==0] and then rbind them to my.df[my.df$event == 1]. However, it is impractical to individually code each case. Alternatively if A in my.df matches A in my.df.cast then sample(my.df[my.df$id == A & my.df$event == 0], size=my.df.cast[1,3], replace=FALSE). I think I am close to a solution but I'm not sure how to code it to run through the entire dataframe. This is how my.new.df would look: _id event_ A    0 A    1 B    0 B    1 C    0 C    0 C    1 C    1 Thank you kindly for your help, Eric -- Eric Vander Wal Ph.D. Candidate University of Saskatchewan, Department of Biology, 112 Science Place, Saskatoon, SK., S7N 5E2 "Pluralitas non est ponenda sine neccesitate" ------------------------------ Message: 134 Date: Wed, 8 Jul 2009 21:40:02 -0400 (EDT) From: Rebecca Sela <[hidden email]> Subject: Re: [R] \dQuote in packages To: r-help <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain; charset="utf-8" That's good to know. I have attached three Rd files that gave errors (others gave identical errors). I would love to know what is wrong with them. I'm using 2.1.1 because that is what is installed on the Linux computer I have access to. (I haven't bothered figuring out how to assemble a package in Windows.) [[elided Yahoo spam]] Rebecca ----- Original Message ----- From: "Uwe Ligges" <[hidden email]> To: "Rebecca Sela" <[hidden email]> Cc: "r-help" <[hidden email]> Sent: Wednesday, July 8, 2009 6:11:33 PM GMT -05:00 US/Canada Eastern Subject: Re: [R] \dQuote in packages The difference you are experiencing is the new Rd2 parser that is more picky now (but also prevents to produce wrong documentation files). If you make the code of the Rd available, someone might be able to help. [[elided Yahoo spam]] Best, Uwe Ligges Rebecca Sela wrote: > I am in the process of submitting a package to CRAN. R CMD check ran successfully on the package on my local computer, using R version 2.1.1. However, on the computers for CRAN (with version 2.10.0), the following errors occurred: > > Warning in parse_Rd("./man/predict.Rd", encoding = "unknown") : >   ./man/predict.Rd:28: unknown macro '\dquote' > *** error on file ./man/predict.Rd > Error : ./man/predict.Rd:28: Unrecognized macro \dquote > Warning in parse_Rd("./man/print.Rd", encoding = "unknown") : >   ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects' > Warning in parse_Rd("./man/simpleREEMdata.Rd", encoding = "unknown") : >   ./man/simpleREEMdata.Rd:10: unknown macro '\item' > > Are \dquote, \sideeffects, and \item not supported in newer versions of R? Is there some underlying problem that I should fix that makes these show up? > > Thank you very much. > > Rebecca > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. Message: 135 Date: Thu, 09 Jul 2009 13:45:10 +1200 From: [hidden email] Subject: [R] Mysteriously vanishing LD_LIBRARY_PATH To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset="UTF-8" Using R-2.8.0 and R-2.8.1, I get behaviour like this: R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 [....] > Sys.getenv("LD_LIBRARY_PATH")                                              LD_LIBRARY_PATH "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/home/hrapgc/Rstuff/library/asreml/libs" > q() Save workspace image? [y/n/c]: n However: R version 2.9.1 (2009-06-26) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 [...] > Sys.getenv("LD_LIBRARY_PATH")                            LD_LIBRARY_PATH "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2" I'm particularly dismayed by the fact that there are now only three parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. Maybe that's a red herring since the former is a link to the latter. I would appreciate help getting the rest of LD_LIBRARY_PATH back. I set it in ~/.bash_profile in case that makes a difference to the possible cause of the phenomenon. $ uname -r 2.6.18-92.1.22.el5 The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5. TIA -- Patrick Connolly HortResearch Mt Albert Auckland New Zealand Ph: +64-9 925 7079 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ I have the world`s largest collection of seashells. I keep it on all the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ ------------------------------ Message: 136 Date: Wed, 8 Jul 2009 19:23:09 -0700 From: Mark Knecht <[hidden email]> Subject: Re: [R] Best way to export values from a function? Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 5:55 PM, Mark Knecht<[hidden email]> wrote: e: >> >> Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down. >> >> I would like to know the best way to export several doubles from a function, where the doubles are not an array. >> >> Here is a contrived function similar to my needs: >> >> multipleoutput<-function(x) >> { >> ? ? ? ?squared<-x^2 >> ? ? ? ?cubed<-x^3 >> ? ? ? ?exponentioal<-exp(x) >> ? ? ? ?factorialVal<-factorial(x) >> >> } >> >> Thanks again for all your help. >> This version runs a bit better than my last and I find it a bit more readable, but there's a warning for whatever the first computation is inside the function that I'd like to understand. - Mark multipleoutput <- function(x) {    answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0)    answer$Squ=x^2    answer$Cub<-x^3    answer$Exp<-exp(x)    answer$Fac<-factorial(x)    return(answer) } X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0) X mode(X) names(X) X[1,] <- multipleoutput(2) X class(X) <PRODUCES> > multipleoutput <- function(x) { + answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0) + answer$Squ=x^2 + answer$Cub<-x^3 + answer$Exp<-exp(x) + answer$Fac<-factorial(x) + return(answer) + } > > X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0) > X  Squared Cubed Exp Fac 1     0    0   0   0 > mode(X) [1] "list" > names(X) [1] "Squared" "Cubed"   "Exp"    "Fac" > > X[1,] <- multipleoutput(2) Warning message: In answer$Squ = x^2 : Coercing LHS to a list > > X  Squared Cubed   Exp Fac 1     4    8 7.389056   2 > class(X) [1] "data.frame" > > > ------------------------------ Message: 137 Date: Wed, 8 Jul 2009 22:29:48 -0400 From: Godmar Back <[hidden email]> Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH To: [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 R respects LD_LIBRARY_PATH, see /usr/lib/R/etc/ldpaths where it prepends its own path to any value in the environment when R is invoked: if test -z "${LD_LIBRARY_PATH}"; then  LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}" else  LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}" fi export LD_LIBRARY_PATH ===== Provide the output of echo $LD_LIBRARY_PATH or env | grep LD_LIBRARY_PATH to check that it's set correctly *BEFORE* you invoke R. - Godmar On Wed, Jul 8, 2009 at 9:45 PM, <[hidden email]> wrote: > Using R-2.8.0 and R-2.8.1, I get behaviour like this: > > R version 2.8.0 (2008-10-20) > Copyright (C) 2008 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > [....] > >> Sys.getenv("LD_LIBRARY_PATH") > > ? ? ? ? ?LD_LIBRARY_PATH > "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/home/hrapgc/Rstuff/library/asreml/libs" >> q() > Save workspace image? [y/n/c]: n > > > However: > > R version 2.9.1 (2009-06-26) > Copyright (C) 2009 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > [...] > >> Sys.getenv("LD_LIBRARY_PATH") > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LD_LIBRARY_PATH > "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2" > > > I'm particularly dismayed by the fact that there are now only three > parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of > /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. ?Maybe that's a red > herring since the former is a link to the latter. > > I would appreciate help getting the rest of LD_LIBRARY_PATH back. ?I > set it in ~/.bash_profile in case that makes a difference to the > possible cause of the phenomenon. > > $ uname -r > 2.6.18-92.1.22.el5 > > The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5. > > TIA > > -- > Patrick Connolly > HortResearch > Mt Albert > Auckland > New Zealand > Ph: +64-9 925 7079 > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ > I have the world`s largest collection of seashells. I keep it on all > the beaches of the world ... Perhaps you`ve seen it. ?---Steven Wright > ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 138 Date: Wed, 08 Jul 2009 21:40:58 -0500 From: Marc Schwartz <[hidden email]> Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH To: [hidden email] Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Jul 8, 2009, at 8:45 PM, [hidden email] wrote: > Using R-2.8.0 and R-2.8.1, I get behaviour like this: > > R version 2.8.0 (2008-10-20) > Copyright (C) 2008 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > [....] > >> Sys.getenv("LD_LIBRARY_PATH") > >     LD_LIBRARY_PATH > "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/ > home/hrapgc/Rstuff/library/asreml/libs" >> q() > Save workspace image? [y/n/c]: n > > > However: > > R version 2.9.1 (2009-06-26) > Copyright (C) 2009 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > [...] > >> Sys.getenv("LD_LIBRARY_PATH") >                           LD_LIBRARY_PATH > "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2" > > > I'm particularly dismayed by the fact that there are now only three > parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of > /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. Maybe that's a red > herring since the former is a link to the latter. > > I would appreciate help getting the rest of LD_LIBRARY_PATH back. I > set it in ~/.bash_profile in case that makes a difference to the > possible cause of the phenomenon. > > $ uname -r > 2.6.18-92.1.22.el5 > > The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5. > > TIA When I was using Fedora, several years ago I started to add any paths that I needed for LD_LIBRARY_PATH into /etc/ld.so.conf. Then run 'sudo ldconfig' to update the configuration. I got bit by the same issue that you are seeing when using RODBC with Oracle. I believe that it was Prof. Ripley who suggested that I use the above approach and did not have any problems after that. HTH, Marc Schwartz ------------------------------ Message: 139 Date: Thu, 09 Jul 2009 14:35:48 +1200 From: [hidden email] Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH To: Godmar Back <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset="UTF-8"; format="flowed" Quoting Godmar Back <[hidden email]>: > R respects LD_LIBRARY_PATH, see /usr/lib/R/etc/ldpaths where it > prepends its own path to any value in the environment when R is > invoked: > > if test -z "${LD_LIBRARY_PATH}"; then >   LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}" > else >   LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}" > fi > export LD_LIBRARY_PATH > > ===== > > Provide the output of > > echo $LD_LIBRARY_PATH > or > env | grep LD_LIBRARY_PATH > > to check that it's set correctly *BEFORE* you invoke R. workaround. When I see this: $ diff /home/hrapgc/local/R-2.8.1/etc/ldpaths /home/hrapgc/local/R-2.9.1/etc/ldpaths 2c2 < : ${R_JAVA_LD_LIBRARY_PATH=/usr/lib/gcj-4.1.2:/home/hrapgc/Rstuff/library/asreml/libs} --- > : ${R_JAVA_LD_LIBRARY_PATH=/usr/lib/gcj-4.1.2} I think a little editing job will do the trick. Presumably, that happened at compilation time and something screwy is happening with CentOS which doesn't happen with other OSs. The gcj thing IS a red herring, can we assume? Thanks > > - Godmar > > On Wed, Jul 8, 2009 at 9:45 PM, <[hidden email]> wrote: >> Using R-2.8.0 and R-2.8.1, I get behaviour like this: >> >> R version 2.8.0 (2008-10-20) >> Copyright (C) 2008 The R Foundation for Statistical Computing >> ISBN 3-900051-07-0 >> >> [....] >> >>> Sys.getenv("LD_LIBRARY_PATH") >> >> ? ? ? ? ?LD_LIBRARY_PATH >> "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/home/hrapgc/Rstuff/library/asreml/libs" >>> q() >> Save workspace image? [y/n/c]: n >> >> >> However: >> >> R version 2.9.1 (2009-06-26) >> Copyright (C) 2009 The R Foundation for Statistical Computing >> ISBN 3-900051-07-0 >> >> [...] >> >>> Sys.getenv("LD_LIBRARY_PATH") >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LD_LIBRARY_PATH >> "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2" >> >> >> I'm particularly dismayed by the fact that there are now only three >> parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of >> /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. ?Maybe that's a red >> herring since the former is a link to the latter. >> >> I would appreciate help getting the rest of LD_LIBRARY_PATH back. ?I >> set it in ~/.bash_profile in case that makes a difference to the >> possible cause of the phenomenon. >> >> $ uname -r >> 2.6.18-92.1.22.el5 >> >> The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5. >> >> TIA >> >> -- >> Patrick Connolly >> HortResearch >> Mt Albert >> Auckland >> New Zealand >> Ph: +64-9 925 7079 >> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ >> I have the world`s largest collection of seashells. I keep it on all >> the beaches of the world ... Perhaps you`ve seen it. ?---Steven Wright >> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~ >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> ------------------------------ Message: 140 Date: Wed, 8 Jul 2009 23:49:25 -0300 From: Henrique Dallazuanna <[hidden email]> Subject: Re: [R] Substituting numerical values using `apply' To: Olivella <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Try this: sapply(names(DF), function(n)ifelse(DF[,n] %in% c(1, 2), n, NA)) Where DF is your data.frame On Wed, Jul 8, 2009 at 5:25 PM, Olivella <[hidden email]> wrote: > > Hello, > > I wish to perform a substitution of certain numerical values in a data > matrix with the corresponding column name. For instance, if I have a data > matrix > V1 V2 V3 > 2  0  1 > 0  1  2 > 1  5  0 > 5  0  0 > > I want to substitute the `1' and the `2' for the corresponding column name, > and make everything else `NA' like this > V1  V2  V3 > V1  NA  V3 > NA  V2  V3 > V1  NA  NA > NA  NA  NA > > I have done this using an explicit `for' loop, but it takes a really long > time to finish. Is there any way I can do this using `apply' or some form > of > implicit looping? > > Thank you for your help, > > SO > -- > View this message in context: > http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O    [[alternative HTML version deleted]] ------------------------------ Message: 141 Date: Wed, 08 Jul 2009 19:53:38 -0700 From: Duncan Temple Lang <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Farrel Buchinsky <[hidden email]> Cc: R <[hidden email]>, Duncan Murdoch    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=windows-1252; format=flowed Farrel Buchinsky wrote: > ........ > Boy oh boy that process of getting source to binary was super painful. Now > that I have the package as binary I can share the whole folder with my > coworker and she is able to use RGoogleDocs. I intend to use the same > process for the other two windows machines that I use. I really do not want > to go through the same installation and path hassles all over again. > > Should I post my directory containing the binary files somewhere so that > others do not have to experience pain. Does etiquette dictate that I should > post the directory to help other or does etiquette dictate that it is Duncan > Temple Lang's code and thus it his prerogative to distribute his work as he > wishes? Both encourage you to help others and make the binary available to others. And indeed, I hope that Windows users do build binaries for others and remove the additional work from those who provide the software in the first place. Having seen this thread today, I did put a binary version of RGoogleDocs on the Omegahat repository so  install.packages("RGoogleDocs", repos = "http://www.omegahat.org/R") should install it and, if I had had time earlier, saved you the hardship of building the binary. Sorry to do it so soon after.  D. > > Farrel Buchinsky > Google Voice Tel: (412) 567-7870 > > > > On Wed, Jul 8, 2009 at 12:59, Farrel Buchinsky <[hidden email]> wrote: > >> Does changing the path in Windows work in real time or does one need to >> restart the computer for the changes to take effect. >> Farrel Buchinsky >> Google Voice Tel: (412) 567-7870 >> >> >> >> On Wed, Jul 8, 2009 at 12:04, Gabor Grothendieck <[hidden email]>wrote: >> >>> Its safer just to temporarily add it to your path. >>> >>> Unfortunately Rtools has a find command that conflicts with >>> the find command in Windows so if you add the Rtools >>> bin directory to your path permanently then you could >>> find other programs stop working. That actually happened >>> to me once and it took the longest time until I discovered >>> that Rtools was the culprit. >>> >>> If you follow the advice I gave you normally won't have >>> that problem. >>> >>> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >>> wrote: >>>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>>> Forgive my naivte, but how do I make windows find tar. In other words >>> from >>>>> where do I issue the command and what is the command. >>>> You need to install the toolset, and let the installer set your path. >>>> >>>> Duncan Murdoch >>>> >>>>> Farrel Buchinsky >>>>> Google Voice Tel: (412) 567-7870 >>>>> >>>>> >>>>> >>>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>> wrote: >>>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>>> >>>>>>> I have previously read "R Installation and Administration". I read >>> it >>>>>>> again. It does not help me >>>>>>> The relevant paragraph is below. But I need lower level instructions. >>>>>>> Where >>>>>>> can I find them. >>>>>>> >>>>>> Follow the link. If Windows can't find tar, your toolset is installed >>>>>> incorrectly. >>>>>> >>>>>> Duncan Murdoch >>>>>> >>>>>> >>>>>>> R CMD INSTALL works in Windows to install source packages if you have >>>>>>> the >>>>>>> source-code package files (option ?Source Package Installation Files? >>> in >>>>>>> the >>>>>>> installer) and toolset (see The Windows >>>>>>> >>>>>>> >>>>>>> >>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>>>>> installed. Installation of binary packages must be done by >>>>>>> install.packages >>>>>>> . R CMD INSTALL --help will tell you the current options under >>> Windows >>>>>>> (which differ from those on a Unix-alike): in particular there is a >>>>>>> choice >>>>>>> of the types of documentation to be installed. >>>>>>> Farrel Buchinsky >>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>> >>>>>>> >>>>>>> >>>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>>> >>>>>>> See the manual "R Installation and Administration" for information >>> on >>>>>>> how >>>>>>>> to install source packages on Windows. >>>>>>>> >>>>>>>> Uwe Ligges >>>>>>>> >>>>>>>> Farrel Buchinsky wrote: >>>>>>>> >>>>>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>>>> error >>>>>>>>> message >>>>>>>>> 'tar' is not recongnized as an internal or external command, >>> operable >>>>>>>>> program or batch file. >>>>>>>>> >>>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>>> download directory or should I do it in C:\Program >>>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the >>>>>>>>> Rcmd >>>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>>> >>>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>>> Farrel Buchinsky >>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>>> <[hidden email]>wrote: >>>>>>>>> >>>>>>>>> I have haven't neen following this thread but: >>>>>>>>> >>>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>>> that its not the same name as the built file about to be created.. >>>>>>>>>> The second line detars it into the RGoogleDocs directory. The >>> third >>>>>>>>>> builds >>>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>>>>>>> installs the built source file into R. I've assumed Windows. >>>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>>> >>>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>>> >>>>>>>>>> or >>>>>>>>>> >>>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then >>>>>>>>>> you >>>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>>> the others. >>>>>>>>>> >>>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky< >>> [hidden email]> >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>> to? Or do you mean that I must create a directory called >>> RGoogleDocs >>>>>>>>>>> under >>>>>>>>>> Library and then change to that directory? >>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>>> >>>>>>>>>>> [hidden email]> >>>>>>>>>> wrote: >>>>>>>>>>> Finally enter into the Windows console: >>>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>>> >>>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>>> created by the build. >>>>>>>>>>>> >>>>>>>>>>>>     [[alternative HTML version deleted]] >>>>>>>>> ______________________________________________ >>>>>>>>> [hidden email] mailing list >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>> ------------------------------------------------------------------------ >>>>>>> ______________________________________________ >>>>>>> [hidden email] mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>> >>>>> >>>>> >>>>> >>> ------------------------------------------------------------------------ >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>> ______________________________________________ >>>> [hidden email] mailing list >>>> https://stat.ethz.ch/mailman/listinfo/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]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 142 Date: Wed, 8 Jul 2009 22:01:21 -0500 From: William Revelle <[hidden email]> Subject: Re: [R] Best way to export values from a function? To: Mark Knecht <[hidden email]>, Jason Rupert Cc: [hidden email] Message-ID: <p06240849c67b0d19191a@[10.0.1.200]> Content-Type: text/plain; charset="us-ascii" ; format="flowed" Mark and Jason, At 7:23 PM -0700 7/8/09, Mark Knecht wrote: >On Wed, Jul 8, 2009 at 5:55 PM, Mark Knecht<[hidden email]> wrote: >> On Wed, Jul 8, 2009 at 5:34 PM, Jason Rupert<[hidden email]> wrote: >>> >>> Maybe there is a great website out there or white paper that >>>discusses this but again my Google skills (or lack there of) let >>>me down. >>> >>> I would like to know the best way to export several doubles from >>>a function, where the doubles are not an array. >>> >>> Here is a contrived function similar to my needs: >>> >>> multipleoutput<-function(x) >>> { >>>      squared<-x^2 >>>      cubed<-x^3 >>>      exponentioal<-exp(x) >>>      factorialVal<-factorial(x) >>> >>> } >>> >>> Thanks again for all your help. >>> > ><SNIP> > >This version runs a bit better than my last and I find it a bit more >readable, but there's a warning for whatever the first computation is >inside the function that I'd like to understand. > >- Mark > >multipleoutput <- function(x) { >   answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0) >   answer$Squ=x^2 >   answer$Cub<-x^3 >   answer$Exp<-exp(x) >   answer$Fac<-factorial(x) >   return(answer) >} > >X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0) >X >mode(X) >names(X) > >X[1,] <- multipleoutput(2) > >X >class(X) > ><PRODUCES> > >> multipleoutput <- function(x) { >+ answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0) >+ answer$Squ=x^2 >+ answer$Cub<-x^3 >+ answer$Exp<-exp(x) >+ answer$Fac<-factorial(x) >+ return(answer) >+ } >> >> X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0) >> X >   Squared Cubed Exp Fac >1     0    0   0   0 >> mode(X) >[1] "list" >> names(X) >[1] "Squared" "Cubed"   "Exp"    "Fac" >> >> X[1,] <- multipleoutput(2) >Warning message: >In answer$Squ = x^2 : Coercing LHS to a list >> >> X >   Squared Cubed   Exp Fac >1     4    8 7.389056   2 >> class(X) >[1] "data.frame" > > ?list e.g., multipleoutput <- function(x) {    answer = list()    answer$Squ=x^2    answer$Cub<-x^3    answer$Exp<-exp(x)    answer$Fac<-factorial(x)    return(answer) } Bill -- William Revelle      http://personality-project.org/revelle.html Professor         http://personality-project.org/personality.html Department of Psychology        http://www.wcas.northwestern.edu/psych/ Northwestern University   http://www.northwestern.edu/ Attend ISSID/ARP:2009         http://issid.org/issid.2009/ ------------------------------ Message: 143 Date: Wed, 8 Jul 2009 23:03:33 -0400 From: Steve Lianoglou <[hidden email]> Subject: Re: [R] Best way to export values from a function? Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Hi, On Jul 8, 2009, at 8:34 PM, Jason Rupert wrote: > > Maybe there is a great website out there or white paper that > discusses this but again my Google skills (or lack there of) let me > down. > > I would like to know the best way to export several doubles from a > function, where the doubles are not an array. > > Here is a contrived function similar to my needs: > > multipleoutput<-function(x) > { >    squared<-x^2 >    cubed<-x^3 >    exponentioal<-exp(x) >    factorialVal<-factorial(x) >    > } "normal" R way, so let's go ahead and use the "return a list" method (I think it's better than using the `c(squared=x^2, cubed=...)`). Here's an interesting way to receive the assignments. Check out this function: http://code.google.com/p/miscell/source/browse/rvalues/rvalues.r With that ':=' function loaded, you could do this: ============ multipleout <- function(x) {    list(squared=x^2, cubed=x^3, exponential=exp(x),     factorial=factorial(x)) } c(sq,cu,ex,fa) := multipleout(1:3) show(sq) [1] 1 4 9 show(cu) [1] 1 8 27 show(ex) [1] 2.718282 7.389056 20.085537 show(fa) [1] 1 2 6 ============= [I can't remember how I stumbled onto this code for the ':=' function (I think it was from a thread on the BioC list about package updates)] I'm not saying that you *should* do it this way, but it's kind of cool that you could ... -steve -- Steve Lianoglou Graduate Student: Physiology, Biophysics and Systems Biology Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos ------------------------------ Message: 144 Date: Thu, 9 Jul 2009 03:07:35 +0000 From: wapita wapita <[hidden email]> Subject: [R] change capital to small letters? To: <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain Hello R users, I have a string of characters in capital letters and I need to convert it in small letters, is there an easy way to do it? Thanks a lot Wapita _________________________________________________________________ Découvrez toutes les possibilités de communication avec vos proches    [[alternative HTML version deleted]] ------------------------------ Message: 145 Date: Thu, 9 Jul 2009 03:10:24 +0000 From: wapita wapita <[hidden email]> Subject: Re: [R] change capital to small letters? To: <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain ok, find! ?toupper ?tolower sorry!!! (but you have perhaps learned something...) From: [hidden email] To: [hidden email] Subject: change capital to small letters? Date: Thu, 9 Jul 2009 03:07:35 +0000 Hello R users, I have a string of characters in capital letters and I need to convert it in small letters, is there an easy way to do it? Thanks a lot Wapita Découvrez toutes les possibilités de communication avec vos proches _________________________________________________________________ r ! Téléchargez-le maintenant !    [[alternative HTML version deleted]] ------------------------------ Message: 146 Date: Wed, 8 Jul 2009 23:14:44 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] R regular expression to extract words with the query    string. To: [hidden email] Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 The solution below does not include the pid: string before it. This modification works: > strapply(i, paste("[^ ]*", "ENSP", "[^ ]*", sep = ""), c, simplify = unlist) [1] "pid:ENSP000012345" On Wed, Jul 8, 2009 at 10:08 AM, Gabor Grothendieck<[hidden email]> wrote: > Try this: > > library(gsubfn) > i <- "transcript:ENST0000112334 pid:ENSP000012345" > strapply(i, paste("\\w*", "ENSP", "\\w*", sep = ""), c, simplify = unlist) > > This says to match any number (possibly zero) of word > characters followed by ENSP followed by more word > characters. ?c just returns the match without > further processing and unlist unlists the result giving > a character vector (which otherwise would be a list). > > See http://gsubfn.googlecode.com for more info. > > On Wed, Jul 8, 2009 at 9:04 AM, Praveen > Surendran<[hidden email]> wrote: >> Hi, >> >> >> >> Is there a way in R to get the string which matches the expression, where >> the expression is a substring of the parent string. >> >> >> >> Lets say, I have $i <- "transcript:ENST0000112334 pid:ENSP000012345" >> >> What I need is the string "pid:ENSP000012345" from $i using the query >> "ENSP". >> >> >> >> Appreciate your comments. >> >> >> >> Praveen ?Surendran >> >> School of Medicine and Medical Sciences >> >> University College Dublin >> >> Belfiled, Dublin 4 >> >> Ireland. >> >> >> >> >> ? ? ? ?[[alternative HTML version deleted]] >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > ------------------------------ Message: 147 Date: Wed, 8 Jul 2009 22:26:06 -0500 From: jlfmssm <[hidden email]> Subject: [R] splint To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain I am trying to understand idea for splint, but it use Fortran code. Does anyone know how to see that Fortran code? Is splint a not-knot spline method? Thanks, jfm    [[alternative HTML version deleted]] ------------------------------ Message: 148 Date: Wed, 8 Jul 2009 23:45:06 -0400 From: Gabor Grothendieck <[hidden email]> Subject: Re: [R] R Help Question To: Amy Wesolowski <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 You could try something like this: library(sqldf) DF <- read.csv.sql("myfile.txt", sep = "|", header = FALSE) or possibly this, which is the same except instead of using an "in memory" database it uses an external database: DF <- read.csv.sql("myfile.txt", sep = "|", header = FALSE, dbname = "temp.db") In both cases it creates the database automatically and then destroys it automatically. You may need to adjust the arguments depending on what your data looks like. Since it does not use read.table underneath any limitations of read.table would not apply. You might want to test it out with the first few rows to get the arguments right and then if it seems to work try it with the full data. On Wed, Jul 8, 2009 at 4:00 PM, Amy Wesolowski<[hidden email]> wrote: > Hi, > > I am currently working on reading large files into R. ?My files are text > documents with four columns and around 10 million lines. > Each line is set up as: > string|integer|string|integer > > I have been trying to use read.table to read in the file, but I think I am > reading too much into memory and the application quits. > > I want to be able to analyze the entire text document at once. > I have thought about reading in the file, line by line, but I still want to > store all the information together. ?I have also thought about writing each > line of the file to a matrix, but I cannot seem to figure it out. > > Any help would be great. > Thanks, > Amy > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 149 Date: Wed, 8 Jul 2009 23:56:31 -0400 From: Farrel Buchinsky <[hidden email]> Subject: Re: [R] Reading from Google Docs To: Duncan Temple Lang <[hidden email]> Cc: R <[hidden email]>, Duncan Murdoch    <[hidden email]> Message-ID:    <[hidden email]> Content-Type: text/plain Dear Duncan On my home computer I was able to use install.packages("RGoogleDocs", repos = "http://www.omegahat.org/R") But, alas it would not read the data in the spreadsheet. It went back to its nasty ways Error in !includeEmpty : invalid argument type That is what I was getting with version 0.2-1.You then sent me link to 0.2-2 (in source code) which is what worked. Is it possible that that the windows binary version you put in omegahat was 0.2-1 and not 0.2-2? I did not know how to tell what version had been installed. Farrel Buchinsky Google Voice Tel: (412) 567-7870 On Wed, Jul 8, 2009 at 22:53, Duncan Temple Lang <[hidden email]>wrote: > > > Farrel Buchinsky wrote: > > > ........ > > Boy oh boy that process of getting source to binary was super painful. Now >> that I have the package as binary I can share the whole folder with my >> coworker and she is able to use RGoogleDocs. I intend to use the same >> process for the other two windows machines that I use. I really do not >> want >> to go through the same installation and path hassles all over again. >> >> Should I post my directory containing the binary files somewhere so that >> others do not have to experience pain. Does etiquette dictate that I >> should >> post the directory to help other or does etiquette dictate that it is >> Duncan >> Temple Lang's code and thus it his prerogative to distribute his work as >> he >> wishes? >> > > Etiquette is one thing and the license another. > Both encourage you to help others and make the > binary available to others. > And indeed, I hope that Windows users do build binaries > for others and remove the additional work from those > who provide the software in the first place. > > Having seen this thread today, I did put a binary > version of RGoogleDocs on the Omegahat repository > so > > install.packages("RGoogleDocs", repos = "http://www.omegahat.org/R") > > should install it and, if I had had time earlier, saved you the hardship > of building the binary. Sorry to do it so soon after. > > D. > > > > > >> Farrel Buchinsky >> Google Voice Tel: (412) 567-7870 >> >> >> >> On Wed, Jul 8, 2009 at 12:59, Farrel Buchinsky <[hidden email]> wrote: >> >> Does changing the path in Windows work in real time or does one need to >>> restart the computer for the changes to take effect. >>> Farrel Buchinsky >>> Google Voice Tel: (412) 567-7870 >>> >>> >>> >>> On Wed, Jul 8, 2009 at 12:04, Gabor Grothendieck < >>> [hidden email]>wrote: >>> >>> Its safer just to temporarily add it to your path. >>>> >>>> Unfortunately Rtools has a find command that conflicts with >>>> the find command in Windows so if you add the Rtools >>>> bin directory to your path permanently then you could >>>> find other programs stop working. That actually happened >>>> to me once and it took the longest time until I discovered >>>> that Rtools was the culprit. >>>> >>>> If you follow the advice I gave you normally won't have >>>> that problem. >>>> >>>> On Wed, Jul 8, 2009 at 11:21 AM, Duncan Murdoch<[hidden email]> >>>> wrote: >>>> >>>>> On 08/07/2009 10:13 AM, Farrel Buchinsky wrote: >>>>> >>>>>> Forgive my naivte, but how do I make windows find tar. In other words >>>>>> >>>>> from >>>> >>>>> where do I issue the command and what is the command. >>>>>> >>>>> You need to install the toolset, and let the installer set your path. >>>>> >>>>> Duncan Murdoch >>>>> >>>>> Farrel Buchinsky >>>>>> Google Voice Tel: (412) 567-7870 >>>>>> >>>>>> >>>>>> >>>>>> On Wed, Jul 8, 2009 at 10:09, Duncan Murdoch <[hidden email]> >>>>>> >>>>> wrote: >>>> >>>>> On 08/07/2009 10:02 AM, Farrel Buchinsky wrote: >>>>>>> >>>>>>> I have previously read "R Installation and Administration". I read >>>>>>>> >>>>>>> it >>>> >>>>> again. It does not help me >>>>>>>> The relevant paragraph is below. But I need lower level >>>>>>>> instructions. >>>>>>>> Where >>>>>>>> can I find them. >>>>>>>> >>>>>>>> Follow the link. If Windows can't find tar, your toolset is >>>>>>> installed >>>>>>> incorrectly. >>>>>>> >>>>>>> Duncan Murdoch >>>>>>> >>>>>>> >>>>>>> R CMD INSTALL works in Windows to install source packages if you >>>>>>>> have >>>>>>>> the >>>>>>>> source-code package files (option âSource Package Installation >>>>>>>> Filesâ >>>>>>>> >>>>>>> in >>>> >>>>> the >>>>>>>> installer) and toolset (see The Windows >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> toolset<file:///C:/Program%20Files/R/R-2.9.1/doc/manual/R-admin.html#The-Windows-toolset>) >>>> >>>>> installed. Installation of binary packages must be done by >>>>>>>> install.packages >>>>>>>> . R CMD INSTALL --help will tell you the current options under >>>>>>>> >>>>>>> Windows >>>> >>>>> (which differ from those on a Unix-alike): in particular there is a >>>>>>>> choice >>>>>>>> of the types of documentation to be installed. >>>>>>>> Farrel Buchinsky >>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> 2009/6/19 Uwe Ligges <[hidden email]> >>>>>>>> >>>>>>>> See the manual "R Installation and Administration" for information >>>>>>>> >>>>>>> on >>>> >>>>> how >>>>>>>> >>>>>>>>> to install source packages on Windows. >>>>>>>>> >>>>>>>>> Uwe Ligges >>>>>>>>> >>>>>>>>> Farrel Buchinsky wrote: >>>>>>>>> >>>>>>>>> After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an >>>>>>>>> error >>>>>>>>> >>>>>>>>>> message >>>>>>>>>> 'tar' is not recongnized as an internal or external command, >>>>>>>>>> >>>>>>>>> operable >>>> >>>>> program or batch file. >>>>>>>>>> >>>>>>>>>> Should I use my 7-zip to open up the archive? >>>>>>>>>> Where should I be doing this? For instance can I do it all in my >>>>>>>>>> download directory or should I do it in C:\Program >>>>>>>>>> Files\R\R-2.9.0\library or should I manually create C:\Program >>>>>>>>>> Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will >>>>>>>>>> the >>>>>>>>>> Rcmd >>>>>>>>>> INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me. >>>>>>>>>> >>>>>>>>>> Yes, you assumed correctly. I am using Windows XP. >>>>>>>>>> Farrel Buchinsky >>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck >>>>>>>>>> <[hidden email]>wrote: >>>>>>>>>> >>>>>>>>>> I have haven't neen following this thread but: >>>>>>>>>> >>>>>>>>>> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as >>>>>>>>>>> opposed to built source) then the first line renames it so >>>>>>>>>>> that its not the same name as the built file about to be created. >>>>>>>>>>> The second line detars it into the RGoogleDocs directory. The >>>>>>>>>>> >>>>>>>>>> third >>>> >>>>> builds >>>>>>>>>>> the built source file, RGoogleDocs_0.2-2.tar.gz. The fourth >>>>>>>>>>> installs the built source file into R. I've assumed Windows. >>>>>>>>>>> If you are on Linux replace rename with mv. >>>>>>>>>>> >>>>>>>>>>> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>> tar xvfz RgoogleDocs_0.2.2-src.tar.gz >>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>> >>>>>>>>>>> or >>>>>>>>>>> >>>>>>>>>>> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file >>>>>>>>>>> then >>>>>>>>>>> you >>>>>>>>>>> can just issue the last of the above lines and don't need >>>>>>>>>>> the others. >>>>>>>>>>> >>>>>>>>>>> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky< >>>>>>>>>>> >>>>>>>>>> [hidden email]> >>>> >>>>> wrote: >>>>>>>>>>> >>>>>>>>>>> What do you mean by "cd the.directory.containing.RGoogleDocs" >>>>>>>>>>> >>>>>>>>>>>> Do you mean the directory where I downloaded the >>>>>>>>>>>> RGoogleDocs_0.2-2.tar.gz >>>>>>>>>>>> to? Or do you mean that I must create a directory called >>>>>>>>>>>> >>>>>>>>>>> RGoogleDocs >>>> >>>>> under >>>>>>>>>>>> >>>>>>>>>>> Library and then change to that directory? >>>>>>>>>>> >>>>>>>>>>>> Farrel Buchinsky >>>>>>>>>>>> Google Voice Tel: (412) 567-7870 >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck < >>>>>>>>>>>> >>>>>>>>>>>> [hidden email]> >>>>>>>>>>>> >>>>>>>>>>> wrote: >>>>>>>>>>> >>>>>>>>>>>> Finally enter into the Windows console: >>>>>>>>>>>> >>>>>>>>>>>>> cd the.directory.containing.RGoogleDocs >>>>>>>>>>>>> Rcmd build RGoogleDocs >>>>>>>>>>>>> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz >>>>>>>>>>>>> >>>>>>>>>>>>> except replace RGoogleDocs_1.0.0.tar.gz with the filename >>>>>>>>>>>>> created by the build. >>>>>>>>>>>>> >>>>>>>>>>>>>   [[alternative HTML version deleted]] >>>>>>>>>>>>> >>>>>>>>>>>> ______________________________________________ >>>>>>>>>> [hidden email] mailing list >>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------ >>>> >>>>> ______________________________________________ >>>>>>>> [hidden email] mailing list >>>>>>>> https://stat.ethz.ch/mailman/listinfo/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]] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>> >>>>> ______________________________________________ >>>>>> [hidden email] mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>>> ______________________________________________ >>>>> [hidden email] mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/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]] >> >> >> >> ------------------------------------------------------------------------ >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > ------------------------------ Message: 150 Date: Thu, 9 Jul 2009 00:02:07 -0400 From: Patrick Gedeon <[hidden email]> Subject: [R] Save rgl plot3d Graph as Image To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Dear Users: I wish to save 3d scatter plots I have generated using the plot3d command in the rgl package. Any image format such as .tiff would work. Can anyone tell me how to do this? Thank you    [[alternative HTML version deleted]] ------------------------------ Message: 151 Date: Wed, 8 Jul 2009 23:24:39 -0500 From: "Victor Manuel Garcia Guerrero" <[hidden email]> Subject: [R] Population pyramids To: <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I have been trying all day long and I could not succed. Thanks... Victor ------------------------------ Message: 152 Date: Thu, 9 Jul 2009 00:32:31 -0400 From: Jorge Ivan Velez <[hidden email]> Subject: Re: [R] Population pyramids To: Victor Manuel Garcia Guerrero <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Hi Victor, See http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot.html <http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot..html> HTH, Jorge On Thu, Jul 9, 2009 at 12:24 AM, Victor Manuel Garcia Guerrero < [hidden email]> wrote: > Hi, I hope somebody can help me with this issue: I am doing population > pyramids using the barplot command, so in the left side I have male age > structure and in the right side the female age structure. To plot the male > age structure I put the data in negative numbers. Now, I want to change the > sign in the bar plot in such way that I have no-sign numbers, both in left > and right side of the graph. I have been trying all day long and I could not > succed. > > Thanks... > > Victor > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 153 Date: Thu, 9 Jul 2009 00:36:59 -0400 From: "Daniel Malter" <[hidden email]> Subject: Re: [R] Population pyramids To: "'Victor Manuel Garcia Guerrero'" <[hidden email]>,    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" have you tried the pyramid function in the epicalc package? best, daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Victor Manuel Garcia Guerrero Gesendet: Thursday, July 09, 2009 12:25 AM An: [hidden email] Betreff: [R] Population pyramids Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I have been trying all day long and I could not succed. Thanks... Victor ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 154 Date: Wed, 8 Jul 2009 23:44:46 -0500 From: "Victor Manuel Garcia Guerrero" <[hidden email]> Subject: Re: [R] Population pyramids To: "Jorge Ivan Velez" <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Thanks Jorge, this is a very good library, but I have been trying with barplot because I am doing population pyramids with confidence intervals. So, the pyramid function does not work with more than two colum matrix. -----Mensaje original----- De: Jorge Ivan Velez [mailto:[hidden email]] Enviado el: mi? 08/07/2009 11:32 Para: Victor Manuel Garcia Guerrero CC: [hidden email] Asunto: Re: [R] Population pyramids Hi Victor, See http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot.html <http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot..html> HTH, Jorge On Thu, Jul 9, 2009 at 12:24 AM, Victor Manuel Garcia Guerrero < [hidden email]> wrote: > Hi, I hope somebody can help me with this issue: I am doing population > pyramids using the barplot command, so in the left side I have male age > structure and in the right side the female age structure. To plot the male > age structure I put the data in negative numbers. Now, I want to change the > sign in the bar plot in such way that I have no-sign numbers, both in left > and right side of the graph. I have been trying all day long and I could not > succed. > > Thanks... > > Victor > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ------------------------------ Message: 155 Date: Thu, 9 Jul 2009 12:20:18 +1000 From: "Nathan S. Watson-Haigh" <[hidden email]> Subject: [R] Converting indices of a matrix subset To: "[hidden email]" <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset="ISO-8859-1" -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have two matrices: > m1 <- matrix(1,4,4) > m1     [,1] [,2] [,3] [,4] [1,]  1  1  1  1 [2,]  1  1  1  1 [3,]  1  1  1  1 [4,]  1  1  1  1 > m2 <- matrix(0,3,3) > diag(m2) <- 1 > m2     [,1] [,2] [,3] [1,]  1  0  0 [2,]  0  1  0 [3,]  0  0  1 I want to get indicies from m2 such that they match indicies as though they came from the lower right of m1. Here's how things work: > ind1 <- which(m1 == 1) > ind1 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 > ind2 <- which(m2 == 1) > ind2 [1] 1 5 9 I would like ind2 to be offset so they look like indicies from the lower right of m1: > ind2 [1] 6 11 16 I can be done with a simple offset when using arr.ind=TRUE: > ind2 <- which(m2 == 1, arr.ind=T) + 1 > ind2     row col [1,]   2   2 [2,]   3   3 [3,]   4   4 But I don't want to use this, as I eventually want to be able to do things like: > m1[-c(ind2)] <- 0 > m1     [,1] [,2] [,3] [,4] [1,]  0  0  0  0 [2,]  0  1  0  0 [3,]  0  0  1  0 [4,]  0  0  0  1 Any thoughts? Cheers, Nathan - -- - -------------------------------------------------------- Dr. Nathan S. Watson-Haigh OCE Post Doctoral Fellow CSIRO Livestock Industries Queensland Bioscience Precinct St Lucia, QLD 4067 Australia Tel: +61 (0)7 3214 2922 Fax: +61 (0)7 3214 2900 Web: http://www.csiro.au/people/Nathan.Watson-Haigh.html - -------------------------------------------------------- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkpVU+IACgkQ9gTv6QYzVL7ClgCgtFyeyZmPyyAQbgOWSjOKEGE0 LokAoLHc08EdpgE9jZ0k4D6TWR4tzzsn =e5pD -----END PGP SIGNATURE----- ------------------------------ Message: 156 Date: Wed, 8 Jul 2009 23:48:05 -0500 From: "Victor Manuel Garcia Guerrero" <[hidden email]> Subject: Re: [R] Population pyramids To: "Daniel Malter" <[hidden email]>, <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Yes, but my issue is because I need to plot a pop pyramid with confidence intervals, and the pyramid function does not work in that way. Thanks Daniel.. -----Mensaje original----- De: Daniel Malter [mailto:[hidden email]] Enviado el: mi? 08/07/2009 11:36 Para: Victor Manuel Garcia Guerrero; [hidden email] Asunto: AW: [R] Population pyramids have you tried the pyramid function in the epicalc package? best, daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Victor Manuel Garcia Guerrero Gesendet: Thursday, July 09, 2009 12:25 AM An: [hidden email] Betreff: [R] Population pyramids Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I have been trying all day long and I could not succed. Thanks... Victor ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 157 Date: Thu, 9 Jul 2009 01:15:29 -0400 From: "Daniel Malter" <[hidden email]> Subject: Re: [R] Population pyramids To: "'Victor Manuel Garcia Guerrero'" <[hidden email]>,    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Can you provide a self-contained example of what you did so far (i.e. code for simulating some data and code for the plot)? That would greatly help to help you find a solution. Daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: Victor Manuel Garcia Guerrero [mailto:[hidden email]] Gesendet: Thursday, July 09, 2009 12:48 AM An: Daniel Malter; [hidden email] Betreff: RE: [R] Population pyramids Yes, but my issue is because I need to plot a pop pyramid with confidence intervals, and the pyramid function does not work in that way. Thanks Daniel. -----Mensaje original----- De: Daniel Malter [mailto:[hidden email]] Enviado el: mi? 08/07/2009 11:36 Para: Victor Manuel Garcia Guerrero; [hidden email] Asunto: AW: [R] Population pyramids have you tried the pyramid function in the epicalc package? best, daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Victor Manuel Garcia Guerrero Gesendet: Thursday, July 09, 2009 12:25 AM An: [hidden email] Betreff: [R] Population pyramids Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I have been trying all day long and I could not succed. Thanks... Victor ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 158 Date: Thu, 9 Jul 2009 08:18:44 +0300 From: Lauri Nikkinen <[hidden email]> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Henrique Dallazuanna <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=windows-1252 Thanks again. That did not work either. I get > library(RDCOMClient) > xl <- COMCreate("Excel.Application") > wk <- xl$Workbooks() > sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > > wk$Close() [1] TRUE > xl$Quit() NULL > and there is still Excel process open in the Task manager (and sample_file.xls won't open). -L 2009/7/8 Henrique Dallazuanna <[hidden email]>: > Then, you can try this: > > xl <- COMCreate("Excel.Application") > wk? <- xl$Workbooks() > sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count() > > wk$Close() > xl$Quit() > > > > On Wed, Jul 8, 2009 at 10:19 AM, Lauri Nikkinen <[hidden email]> > wrote: >> >> Thanks but that did not work. xl$Quit() does not kill the Excel >> process and sample_file.xls will not open. >> >> I'm using Windows XP SP2 and R 2.8.1 >> >> -L >> >> 2009/7/8 Henrique Dallazuanna <[hidden email]>: >> > Try this: >> > >> > xl$Quit() >> > >> > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <[hidden email]> >> > wrote: >> >> >> >> Hi, >> >> >> >> I?m using R package RDCOMClient (http://www.omegahat.org/RDCOMClient/) >> >> to retrieve data from MS Excel workbook. I?m using the code below to >> >> count the number of sheets in the workbook and then loop the data from >> >> sheets in to a list. >> >> >> >> ############# R code ################### >> >> library(gdata) >> >> library(RDCOMClient) >> >> >> >> xl <- COMCreate("Excel.Application") >> >> sh <- >> >> xl$Workbooks()$Open(normalizePath("sample_file.xls"))$Sheets()$Count() >> >> >> >> DF.list <- list() >> >> for (i in 1:sh) { >> >> ? DF.list[[i]] <- read.xls("sample_file.xls", sheet=i, >> >> stringsAsFactors = FALSE) >> >> ? } >> >> ###################################### >> >> >> >> COMCreate opens Excel process and it can be seen from Windows Task >> >> Manager. When I try to open sample_file.xls in Excel, it just flashes >> >> in the screen and shuts down. When I kill (via task manager) the Excel >> >> process COMCreate started, sample_file.xls will open normally. >> >> >> >> The question is, how can I close the Excel process COMCreate started. >> >> xl$Close() doesn?t seem to work. The same problem have been presented >> >> in this post to R-help: >> >> http://tolstoy.newcastle.edu.au/R/help/06/04/25990.html >> >> >> >> -L >> >> >> >> ______________________________________________ >> >> [hidden email] mailing list >> >> https://stat.ethz.ch/mailman/listinfo/r-help >> >> PLEASE do read the posting guide >> >> http://www.R-project.org/posting-guide.html >> >> and provide commented, minimal, self-contained, reproducible code. >> > >> > >> > >> > -- >> > Henrique Dallazuanna >> > Curitiba-Paran?-Brasil >> > 25? 25' 40" S 49? 16' 22" O >> > > > > > -- > Henrique Dallazuanna > Curitiba-Paran?-Brasil > 25? 25' 40" S 49? 16' 22" O > ------------------------------ Message: 159 Date: Thu, 9 Jul 2009 00:43:32 -0500 From: "Victor Manuel Garcia Guerrero" <[hidden email]> Subject: Re: [R] Population pyramids To: "Daniel Malter" <[hidden email]>, <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain;   charset="iso-8859-1" Yes the code is the next: par(mfrow=c(1,2),bty="n",mai=c(0.5, 0.25, 0.25, 0.25)) barplot(height=t(icNM2005.dat), width = 0.825, space = NULL,     names.arg = NULL, legend.text = NULL, beside = FALSE,     horiz = TRUE, density = NULL, angle = 0,     col = c("yellow","Blue","orange"), border = par("fg"),     main = "Hombres",     xlim =NULL, ylim = NULL, xpd = TRUE, log = "",     axes = FALSE, axisnames = FALSE,cex.axis=0.75)     axis(1,pretty(c(-1200,0),n=12),     hadj=NA,padj=NA,cex.axis=0.75,las=2) barplot(height=t(icNF2005.dat), width = 0.825, space = NULL,     names.arg = NULL, legend.text = c("Inf 95%","Mediana","Sup 95%"),     beside = FALSE,     horiz = TRUE, density = NULL, angle = 0,     col = c("yellow","Blue","orange"), border = par("fg"),     main = "Mujeres",     xlim =NULL, ylim = NULL, xpd = TRUE, log = "",     axes = FALSE, axisnames = FALSE,cex.axis=0.75)     axis(2,pretty(c(0:105),n=21),hadj=0.5,padj=0.5,cex.axis=0.75,     las=2)     axis(1,pretty(c(0:1200),n=5),     hadj=NA,padj=NA,cex.axis=0.5,las=1)     V?ctor Manuel Garc?a Guerrero Doctorado en Estudios de Poblaci?n, CEDUA, COLMEX Camino al Ajusco N? 20, Pedregal de Sta. Teresa C.P.10740, Tlalpan, M?xico, D.F. * : [hidden email] ( : 5617-9016 -----Mensaje original----- De: Daniel Malter [mailto:[hidden email]] Enviado el: jue 09/07/2009 12:15 Para: Victor Manuel Garcia Guerrero; [hidden email] Asunto: AW: [R] Population pyramids Can you provide a self-contained example of what you did so far (i.e. code for simulating some data and code for the plot)? That would greatly help to help you find a solution. Daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: Victor Manuel Garcia Guerrero [mailto:[hidden email]] Gesendet: Thursday, July 09, 2009 12:48 AM An: Daniel Malter; [hidden email] Betreff: RE: [R] Population pyramids Yes, but my issue is because I need to plot a pop pyramid with confidence intervals, and the pyramid function does not work in that way. Thanks Daniel. -----Mensaje original----- De: Daniel Malter [mailto:[hidden email]] Enviado el: mi? 08/07/2009 11:36 Para: Victor Manuel Garcia Guerrero; [hidden email] Asunto: AW: [R] Population pyramids have you tried the pyramid function in the epicalc package? best, daniel ------------------------- cuncta stricte discussurus ------------------------- -----Urspr?ngliche Nachricht----- Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Victor Manuel Garcia Guerrero Gesendet: Thursday, July 09, 2009 12:25 AM An: [hidden email] Betreff: [R] Population pyramids Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I have been trying all day long and I could not succed. Thanks... Victor ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 160 Date: Thu, 09 Jul 2009 11:46:27 +0530 From: utkarshsinghal <[hidden email]> Subject: Re: [R] bigglm() results different from glm()+Another    question To: Greg Snow <[hidden email]> Cc: r help <[hidden email]>, Thomas Lumley    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain That was definitely helpful. "if you change your seq to: seq(chunksize, 10000-chunksize, chunksize) then you won't get the error messages" Even previously, I was not getting any error messages or warnings at all, i.e., "update" removes the extra NA rows silently, for example: set.seed(1) xx = data.frame(x1=runif(10000,0,10), x2=runif(10000,0,10), x3=runif(10000,0,10)) xx$y = 3 + xx$x1 + 2*xx$x2 + 3*xx$x3 + rnorm(10000) fit1 = biglm(y~x1+x2+x3, data=xx[1:7000,]) fit2 = update(fit1, moredata=xx[7001:10000,]) fit3 = update(fit2, moredata=xx[7001:14000,]) Here fit2 and fit3 are exactly same. Also if the number of rows is not a multiple of chunksize then your sequence will not accommodate the last small chunk of data . Regards Utkarsh Greg Snow wrote: > > OK, it appears that the problem is the df.resid component of the biglm > object. Everything else is being updated by the update function > except the df.resid piece, so it is based solely on the initial fit > and the chunksize used there. The df.resid piece is then used in the > computation of the AIC and hence the differences that you see. There > could also be a difference in the p-values and confidence intervals, > but at those high of numbers, the differences are smaller than can be > seen at the level of rounding done. > > > > This appears to be a bug/overlooked piece to me, Thomas is cc'd on > this so he should be able to fix this. > > > > A work around in the meantime is to do something like: > > > fit$df.resid <- 10000-4 > > > > Then compute the AIC. > > > > Also as an aside, if you change your seq to: seq(chunksize, > 10000-chunksize, chunksize) then you won't get the error messages. > > > > Hope this helps, > > > > -- > > Gregory (Greg) L. Snow Ph.D. > > Statistical Data Center > > Intermountain Healthcare > > [hidden email] > > 801.408.8111 > > > > *From:* utkarshsinghal [mailto:[hidden email]] > *Sent:* Wednesday, July 08, 2009 2:24 AM > *To:* Greg Snow > *Cc:* Thomas Lumley; r help > *Subject:* Re: [R] bigglm() results different from glm()+Another question > > > > Hi Greg, > > Many thanks for your precious time. Here is a workable code: > > set.seed(1) > xx = data.frame(x1=runif(10000,0,10), x2=runif(10000,0,10), > x3=runif(10000,0,10)) > xx$y = 3 + xx$x1 + 2*xx$x2 + 3*xx$x3 + rnorm(10000) > > chunksize = 500 > fit = biglm(y~x1+x2+x3, data=xx[1:chunksize,]) > for(i in seq(chunksize,10000,chunksize)) fit=update(fit, > moredata=xx[(i+1):(i+chunksize),]) > AIC(fit) > [1] 28956.91 > > And the AIC for other chunksizes: > chunksize  AIC > 500     28956.91 > 1000    27956.91 > 2000    25956.91 > 2500    24956.91 > 5000    19956.91 > 10000    9956.91 > > Also I noted that the estimated coefficients are not dependent on > chunksize and AIC is exactly a linear function of chunksize. So I > guess it is some problem with the calculation of AIC, may be in some > degree of freedom or adding some constant somewhere. > > And my comments below. > > > Regards > Utkarsh > > > Greg Snow wrote: > > How many rows does xx have? > >    Let's look at your example for chunksize 10000, you initially fit >    the first 10000 observations, then the seq results in just the >    value 10000 which means that you do the update based on vaues >    10001 through 20000, if xx only has 10000 rows, then this should >    give at least one error. If xx has 20000 or more rows, then only >    chunksize 10000 will ever see the 20000^th value, the other >    chunksizes will use less of the data. > > Understood your point and apologize that you had to spend time going > into the logic inside for loop. I definitely thought of that but my > actual problem was the variation in AICs (which I was sure about), so > to ignore this loop problem (temporarily), I deliberately chose the > chunksizes such that the number of rows is a multiple of chunksize. I > knew there is still one extra iteration happening and I checked that > it was not causing any problem, the "moredata" in the last iteration > will be all NA's and "update" does nothing in such a case. > > For example: > Let's say chunksize=5000, even though "xx" has only 10000 rows, "fit2" > and "fit3" below are exactly same. > > fit1 = biglm(y~x1+x2+x3, data=xx[1:5000,]) > fit2 = update(fit1, moredata=xx[5001:10000,]) > fit3 = update(fit2, moredata=xx[10001:15000,]) > AIC(fit1); AIC(fit2); AIC(fit3) > [1] 5018.282 > [1] 19956.91 > [1] 19956.91 > > (The AIC matches with the table above and no warnings at all) > > I checked all these things before sending my first mail and dropped > the idea of refining the for loop as this will save me a few lines of > code and also the loop looks good and easy to understand. Moreover it > is neither taking any extra run time nor producing any warnings or errors.. > > > > > Also looking at the help for update.biglm, the 2^nd argument is > "moredata" not "data", so if the code below is the code that you > actually ran, then the new data chunks are going into the "..." > argument (and being ignored as that is there for future expansion and > does nothing yet) and the "moredata" argument is left empty, which > should also be giving an error. For the code below, the model is only > being fit to the initial chunk and never updated, so with different > chunk sizes, there is different amounts of data per model. You can > check this by doing summary(fit) and looking at the sample size in the > 2^nd line. > > My fault in writing the mail. In the actual code, I gave "update(fit, > xx[(i+1):(i+chunksize),])" ,i.e., I just passed the new chunk as the > 2nd argument without mentioning the argument name, which is correct, > but while writing the mail I added the argument name as "data" without > checking what it is. > > > > > It is easier for us to help you if you provide code that can be run by > copying and pasting (we don't have xx, so we can't just run the code > below, you could include a line to randomly generate an xx, or a link > to where a copy of xx can be downloaded from). It also helps if you > mention any errors or warnings that you receive in the process of > running your code. > > > > Hope this helps, > > > > -- > > Gregory (Greg) L. Snow Ph.D. > > Statistical Data Center > > Intermountain Healthcare > > [hidden email] <mailto:[hidden email]> > > 801.408.8111 > > > > *From:* utkarshsinghal [mailto:[hidden email]] > *Sent:* Tuesday, July 07, 2009 12:10 AM > *To:* Greg Snow > *Cc:* Thomas Lumley; r help > *Subject:* Re: [R] bigglm() results different from glm()+Another question > > > > Trust me, it is the same total data I am using, even the chunksizes > are all equal. I also crosschecked by manually creating the chunks and > updating as in example given on biglm help page. > > ?biglm > > > Regards > Utkarsh > > > > Greg Snow wrote: > > Are you sure that you are fitting all the models on the same total > data? A first glance looks like you may be including more data in > some of the chunk sizes, or be producing an error that update does not > know how to deal with. > > > > -- > > Gregory (Greg) L. Snow Ph.D. > > Statistical Data Center > > Intermountain Healthcare > > [hidden email] <mailto:[hidden email]> > > 801.408.8111 > > > > *From:* utkarshsinghal [mailto:[hidden email]] > *Sent:* Monday, July 06, 2009 8:58 AM > *To:* Thomas Lumley; Greg Snow > *Cc:* r help > *Subject:* Re: [R] bigglm() results different from glm()+Another question > > > > > The AIC of the biglm models is highly dependent on the size of chunks > selected (example provided below). This I can somehow expect because > the model error will increase with the number of chunks. > > It will be helpful if you can provide your opinion for comparing > different models in such cases: > >    * can I compare two models fitted with different chunksizes, or >     should I always use the same chunk size. > >    * although I am not going to use AIC at all in my model selection, >     but I think any other model parameters will also vary in the >     same way. Am I right? >    * what would be the ideal chunksize? should it be the maximum >     possible size R and my system's RAM is able to handle? > > Any comments will be helpful. > > > *Example of AIC variation with chunksize:* > > I ran the following code on my data which has 10000 observations and 3 > independent variables > > > chunksize = 500 > > fit = biglm(y~x1+x2+x3, data=xx[1:chunksize,]) > > for(i in seq(chunksize,10000,chunksize)) fit=update(fit, > data=xx[(i+1):(i+chunksize),]) > > AIC(fit) > [1] 30647.79 > > Here are the AIC for other chunksizes: > chunksize  AIC > 500     30647.79 > 1000    29647.79 > 2000    27647.79 > 2500    26647.79 > 5000    21647.79 > 10000   11647.79 > > > Regards > Utkarsh > > > > > utkarshsinghal wrote: > > Thank you Mr. Lumley and Mr. Greg. That was helpful. > > Regards > Utkarsh > > > > Thomas Lumley wrote: > > > > On Fri, 3 Jul 2009, utkarshsinghal wrote: > > > > > > Hi Sir, > > Thanks for making package available to us. I am facing few problems if > you can give some hints: > > Problem-1: > The model summary and residual deviance matched (in the mail below) > but I didn't understand why AIC is still different. > > > > > AIC(m1) > > [1] 532965 > > > > > AIC(m1big_longer) > > [1] 101442.9 > > > That's because AIC.default uses the unnormalized loglikelihood and > AIC.biglm uses the deviance. Only differences in AIC between models > are meaningful, not individual values. > > > > > > Problem-2: > chunksize argument is there in bigglm but not in biglm, consequently, > udate.biglm is there, but not update.bigglm > Is my observation correct? If yes, why is this difference? > > > Because update.bigglm is impossible. > > Fitting a glm requires iteration, which means that it requires > multiple passes through the data. Fitting a linear model requires only > a single pass. update.biglm can take a fitted or partially fitted > biglm and add more data. To do the same thing for a bigglm you would > need to start over again from the beginning of the data set. > > To fit a glm, you need to specify a data source that bigglm() can > iterate over. You do this with a function that can be called > repeatedly to return the next chunk of data. > >     -thomas > > Thomas Lumley      Assoc. Professor, Biostatistics > [hidden email] <mailto:[hidden email]>  > University of Washington, Seattle > > > > > > > I don't know why the AIC is different, but remember that there are > multiple definitions for AIC (generally differing in the constant > added) and it may just be a difference in the constant, or it could be > that you have not fit the whole dataset (based on your other question). > > For an lm model biglm only needs to make a single pass through the > data. This was the first function written for the package and the > update mechanism was an easy way to write the function (and still > works well). > > The bigglm function came later and the models other than Gaussian > require multiple passes through the data so instead of the update > mechanism that biglm uses, bigglm requires the data argument to be a > function that returns the next chunk of data and can restart to the > beginning of the dataset. > > Also note that the bigglm function usually only does a few passes > through the data, usually this is good enough, but in some cases you > may need to increase the number of passes. > > Hope this helps, > > > > > > >    [[alternative HTML version deleted]] ------------------------------ Message: 161 Date: Wed, 8 Jul 2009 23:45:41 -0700 (PDT) Subject: Re: [R] Extracting a column name in loop? To: [hidden email], mister_bluesman    <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=utf-8 If df is your dataframe then names(df) contains the column names and so names(df)[i] is the name of i-th column. --- On Thu, 9/7/09, mister_bluesman <[hidden email]> wrote: > From: mister_bluesman <[hidden email]> > Subject: [R] Extracting a column name in loop? > To: [hidden email] > Received: Thursday, 9 July, 2009, 1:41 AM > > Hi, > > I am writing a script that will address columns using > syntax like: > > data_set[,1] > > to extract the data from the first column of my data set, > for example. This > code will be placed in a loop (where the column reference > will be placed by > a variable). > > What I also need to do is extract the column NAME for a > given column being > processed in the loop. The dataframe has been set so that R > knows that the > top line refers to column headers. > > Can anyone help me understand how to do this? > > Thanks. > -- > View this message in context: http://www.nabble.com/Extracting-a-column-name-in-loop--tp24393160p24393160.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] > mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. > ------------------------------ Message: 162 Date: Thu, 9 Jul 2009 07:15:58 +0000 (GMT) From: kende jan <[hidden email]> Subject: [R] Cuminc Plot To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain Dear All, here is the example for cumulative incidence analysis with cmprsk package: set.seed(2) ss <- rexp(100) gg <- factor(sample(1:3,100,replace=TRUE),1:3,c('a','b','c')) cc <- sample(0:2,100,replace=TRUE) strt <- sample(1:2,100,replace=TRUE) print(xx <- cuminc(ss,cc,gg,strt)) plot(xx,lty=1,color=1:6) When I perform this example, I have 6 curves. a 1 b 1 c 1 a 2 b 2 c 2 I would like to plot only 3 first curves of risk cc=1 not all of 6 curves. a 1 b 1 c 1 How I can do this with R ? Many thanks Jan       [[alternative HTML version deleted]] ------------------------------ Message: 163 Date: Thu, 9 Jul 2009 00:17:14 -0700 (PDT) From: nyk <[hidden email]> Subject: [R] Node colors in pvclust To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii Is there a way to assign color to nodes as with hclust/as.dendrogram/dendrapply when using pvclust? The problem is that as.dendrogram isn't working on the pvclust objects. library(pvclust) pvc <- pvclust(matrix, nboot=1000) plot(pvc) -- View this message in context: http://www.nabble.com/Node-colors-in-pvclust-tp24405329p24405329.html Sent from the R help mailing list archive at Nabble.com. ------------------------------ Message: 164 Date: Thu, 9 Jul 2009 00:42:31 -0700 (PDT) Subject: Re: [R] print() to file? To: [hidden email], Steve Jaffe <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain; charset=utf-8 One possibility is to use sink (see ?sink). --- On Thu, 9/7/09, Steve Jaffe <[hidden email]> wrote: > From: Steve Jaffe <[hidden email]> > Subject: [R] print() to file? > To: [hidden email] > Received: Thursday, 9 July, 2009, 5:03 AM > > I'd like to write some objects (eg arrays) to a log file. > cat() flattens them > out. I'd like them formatted as in 'print' but print only > writes to stdout. > Is there a simple way to achieve this result? > > Thanks > > -- > View this message in context: http://www.nabble.com/print%28%29-to-file--tp24397445p24397445.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] > mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. > ------------------------------ Message: 165 Date: Thu, 9 Jul 2009 10:26:14 +0200 From: Petr PIKAL <[hidden email]> Subject: Re: [R] error: no such index at level 2 To: Godmar Back <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]>    Content-Type: text/plain; charset="US-ASCII" Hi Godmar Back <[hidden email]> napsal dne 08.07.2009 15:28:50: > On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL <[hidden email]> wrote: > Hi > > [hidden email] napsal dne 07.07.2009 19:06:17: > > > Hi, > > > > I am confused about how to select elements from a list. > > > > I'm trying to select all rows of a table 'crossRsorted' such that the > > mean of a related vector is > 0. The related vector is accessible as > > a list element l[[i]] where i is the row index. > > > > I thought this would work: > > > > > crossRsorted[mean(q[[ crossRsorted[,1] ]], na.rm = TRUE) > 0, ] > > Error in q[[crossRsorted[, 1]]] : no such index at level 2 > Strange, I got completely different error. Couldn't be that only > have crossRsorted? > > Ok, fair enough. I'm still thinking of a language in which the meaning of > operators is apparent from their syntactical structure - probably need to read > more of "The R Inferno". > > Here's an example that reproduces the problem, I think (though the error > message is slightly different): > > > q<-list() > > q[[105]] <- as.numeric(c(0,0,1)) > > q[[104]] <- as.numeric(c(1,1,1)) > > q[[10]] <- as.integer(c(3,3,1)) > > crossRsorted <- data.frame(i = c(105, 104,10)) > > q[[ crossRsorted[,1] ]] > Error in q[[crossRsorted[, 1]]] : recursive indexing failed at level 2 for that q[crossRsorted[,1]] works but your real list is much more complicated. > > Even though the list 'q' has component 105, 104, and 10, the expression q[[ > crossRsorted[,1] ]] causes an error. > Why? > > And why does this work: > > > q[[c(105)]] > [1] 0 0 1 > > but not this: > > > q[[c(105,104)]] > Error in q[[c(105, 104)]] : subscript out of bounds > > q[[c(105,104,10)]] > Error in q[[c(105, 104, 10)]] : recursive indexing failed at level 2 > > even though q[[105]], q[[104], and q[[10]] are perfectly legitimate > > Coming back to my question, how to I express "select all i in a vector > which q[[i]] meets some predicate, where q is a list?" > > Thank you for the tip about 'str' - that's the typeof function I've been > craving. (I thought 'attributes' or 'summary' was all there was...) > The output for str in the original problem: > > In my original problem, the output is: > > > > str(crossRsorted) > 'data.frame':   15750 obs. of 5 variables: > $ i    : num 105 104 9 8 10 9 98 97 10 8 ... > $ j    : num 104 105 8 9 9 10 97 98 8 10 ... > $ r    : num -0.973 -0.973 0.764 0.764 0..744 ... > $ n    : num 135 135 138 138 138 138 136 136 138 138 ... > $ pvalue: num 2.90e-86 2.90e-86 0.00 0.00 0.00 ... > > and > > > str(q) > List of 165 > $ : NULL > $ : NULL > $ : NULL > $ : NULL > $ :'data.frame':     138 obs. of 1 variable: >   ..$ howdidyouhear: chr [1:138] "0 3" "3" "3" "3" ... > $ :'data.frame':     138 obs. of 1 variable: >   ..$ approximatelywhendidyoustart: int [1:138] 0 0 5 1 5 5 1 2 6 0 ... > [ main body deleted ] > $ :'data.frame':     138 obs. of 1 variable: >   ..$ revisiontestpage: num [1:138] 0 0 0 0 0 0 0 0 0 0 .... This appears to be doing something different. For instance, my 'q' has 165 components, but what you suggest has 15750: > length(q) [1] 165 > length(q[ crossRsorted[,1] ]) [1] 15750 hardly what I want. but this is what you asked for. crossRsorted has 15750 items and all has been selected from q. length(q[ unique(crossRsorted[,1] ])) could be what you are looking for. However the result is probably a list of data frames not a data frame with "rows". Regards Petr > > basically - a heterogeneous sparse list of NULL and data.frames of types > character, num, and int. > > However - by construction - the q[[i]] for i in crossRsorted[,1] are all non- > NULL, as in my small reproducible example above. > with data frame and list > > df1[sapply(list1,mean)>0,] > > selects rows of df1 which correspond to list elements with mean >0 > > I can't run 'sapply' over my list because sapply will also iterate over the > NULLs. I want to access only those components in list1 that occur in df1[1,]. > > - Godmar > ------------------------------ Message: 166 Date: Thu, 9 Jul 2009 20:27:18 +1200 From: Patrick Connolly <[hidden email]> Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH To: Marc Schwartz <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=us-ascii On Wed, 08-Jul-2009 at 09:40PM -0500, Marc Schwartz wrote: [....] > When I was using Fedora, several years ago I started to add any > paths that I needed for LD_LIBRARY_PATH into /etc/ld.so.conf. Then > run 'sudo ldconfig' to update the configuration. Since I don't have root access to the CentOS machine, I can't make use of that suggestion. However, by modifying the ldpaths file in my home directory where R is instaled, I could make it the same as it was in the 2.8.1 installation. Just why that wasn't a problem before R-2.9.0 and only with CentOS, I'm no closer to understanding, but I know how to get around the problem. [....] Thanks for the suggestion and the one from Godmar Back. I have it working. best -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.      ___  Patrick Connolly   {~._.~}           Great minds discuss ideas  _( Y )_          Average minds discuss events (:_~*~_:)         Small minds discuss people (_)-(_)               ..... Eleanor Roosevelt     ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ------------------------------ Message: 167 Date: Thu, 9 Jul 2009 10:37:38 +0200 From: "Benoit Boulinguiez" <[hidden email]> Subject: [R] ggplot2: geom_errorbarh() To: <[hidden email]> Message-ID: <B35F4FCBCF7442A492541599B1E043C6@PR017080> Content-Type: text/plain Hi all, quick question: is the optional command "width" effective in the geom_errorbarh() layer of ggplot? Cause I can't get it works on this graph http://www.4shared.com/file/116919103/93488d88/iso_2PrsH.html pdf(file = "iso_2PrsH.pdf", width = 7, height = 7) NC60.iso.graph<-ggplot( NC60.DATA ,aes(Ce,Qe)) + geom_point(col=MaCouleur1, size=4) + geom_errorbar(  aes(ymax = NC60.DATA$Qe+NC60.DATA$sdQe    ,ymin=NC60.DATA$Qe-NC60.DATA$sdQe)    ,colour=alpha("black",0.4)    ,width=1) + geom_errorbarh(  aes(xmax = NC60.DATA$Ce+NC60.DATA$sdCe    ,xmin=NC60.DATA$Ce-NC60.DATA$sdCe)    ,colour=alpha("black",0.4)    ,width=1) + geom_line(data=NC60.Res4.curve  ,aes(x,y)  ,size=1  ,colour=alpha("black",0.5)) + xlab(C[e]~(mmol/m^3)) + ylab(q[e]~(mmol/m^3)) print(NC60.iso.graph) dev.off() Regards/Cordialement ------------- Benoit Boulinguiez Ph.D student Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes" Avenue du Général Leclerc CS 50837 35708 Rennes CEDEX 7 Tel 33 (0)2 23 23 80 83 Fax 33 (0)2 23 23 81 20 <http://www.ensc-rennes.fr/> http://www.ensc-rennes.fr/    [[alternative HTML version deleted]] ------------------------------ Message: 168 Date: Thu, 9 Jul 2009 10:50:29 +0200 From: Petr PIKAL <[hidden email]> Subject: Re: [R] Best way to export values from a function? To: Godmar Back <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]>    Content-Type: text/plain; charset="US-ASCII" Hi [hidden email] napsal dne 09.07.2009 02:57:33: wrote: > > > > Maybe there is a great website out there or white paper that discusses this > but again my Google skills (or lack there of) let me down. > > Yeah, R is difficult to search for - I've had partial success with > rseek.org, though. > > > > > I would like to know the best way to export several doubles from a function, > where the doubles are not an array. > > > > Here is a contrived function similar to my needs: > > > > multipleoutput<-function(x) > > { > >    squared<-x^2 > >    cubed<-x^3 > >    exponentioal<-exp(x) > >    factorialVal<-factorial(x) > > > > } > > You can always do: > > > multipleoutput <- function (x) { return (c(square = x^2, cube = x^3, > > But then you'd have to call it like so: > > > mapply(multipleoutput, c(0,1,2)) >    [,1]    [,2]    [,3] > square  0 1.000000 4.000000 > cube   0 1.000000 8.000000 > exp     1 2.718282 7.389056 > > If you call it like so: > > > multipleoutput(c(0,1,2)) > square1 square2 square3  cube1  cube2  cube3    exp1    exp2 > 0.000000 1.000000 4.000000 0.000000 1.000000 8.000000 1.000000 2.718282 >    exp3 > 7.389056 > > then R flattens the result. Weird. c(1:5, 10:20, 30:50) That is basically what your function do. With slight modification you can get tabular output without mapply multipleoutput <- function (x) { result.s <- x^2 result.c <- x^3 result.e <- exp(x) cbind(square=result.s, cube=result.c, exp=result.e) } If the output could be mixed type }numeric, character, ...) use data.frame instead of cbind Regards Petr > > - Godmar > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ Message: 169 Date: Thu, 9 Jul 2009 08:56:08 +0000 (GMT) From: justin bem <[hidden email]> Subject: [R] IIA test To: R Maillist <[hidden email]> Message-ID: <[hidden email]> Content-Type: text/plain Dear all, I'am using mlogit to test IIA hypothesis. I'get the test statistique who is negative, a p-value of 1, and a text saying that the IIA hypothesis is rejeted. Does a negative value mean that constraint model is more efficient that that the full model ? what to do in this case ? Sincerly. Justin BEM BP 1917 Yaoundé Tél (237) 76043774       [[alternative HTML version deleted]] ------------------------------ Message: 170 Date: Thu, 9 Jul 2009 10:00:13 +0100 From: "Chrysanthi A." <[hidden email]> Subject: Re: [R] heatmap.2: question regarding the "raw z-score" To: "James W. MacDonald" <[hidden email]> Cc: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain Thanks a lot..! What exactly the sweep function is doing? Also, is there a possibility instead of using the mean of the whole row to get only the mean of a group of the row values? So the values in the matrix (heat map) used in the comparison are z-scores and not the intensities of the gene expressions, right? Also, as I can understand from the code, heatmap is using distfun function for the clusering. Can I use pearson correlation for the clustering? My main object of using the heatmap is to examine the expression levels of the marker genes and to confirm that the marker genes are clearly differentially expressed in the two subtypes of the disease that I examine. Many thanks, Chrysanthi. 2009/7/8 James W. MacDonald <[hidden email]> > Hi Chrysanthi, > > > Chrysanthi A. wrote: > >> Hi, >> >> I am analysing gene expression data using the heatmap.2 function in R and >> I >> was wondering what is the formula of the "raw z-score" bar which shows the >> colors for each pixel. >> According to that post: >> https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html, >> it >> is the >> >> (actual value - mean of the group) / standard deviation. >> >> But, mean of which group? Mean of the gene vector? And actual value of >> that >> gene on a sample? I would be grateful if you could give me some more >> details about it or even if there is a book/manual that I could address >> to.. >> > > How about looking at the code? > >  if (scale == "row") { >    retval$rowMeans <- rm <- rowMeans(x, na.rm = na.rm) >    x <- sweep(x, 1, rm) >    retval$rowSDs <- sx <- apply(x, 1, sd, na.rm = na.rm) >    x <- sweep(x, 1, sx, "/") >  } >  else if (scale == "column") { >    retval$colMeans <- rm <- colMeans(x, na.rm = na.rm) >    x <- sweep(x, 2, rm) >    retval$colSDs <- sx <- apply(x, 2, sd, na.rm = na.rm) >    x <- sweep(x, 2, sx, "/") >  } > > So the z-score is calculated on either the row or column (or the default of > "none"). > > I don't see how you can get something saying 'raw z-score'. I get either > 'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row Z-Score, then > the rows are centered and scaled by subtracting the mean of the row from > every value and then dividing the resulting values by the standard deviation > of the row. > > Best, > > Jim > > > >> Thanks a lot, >> >> Chrysanthi. >> >> * >> * >> >>    [[alternative HTML version deleted]] >> >> ______________________________________________ >> [hidden email] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > -- > James W. MacDonald, M.S. > Biostatistician > Douglas Lab > University of Michigan > Department of Human Genetics > 5912 Buhl > 1241 E. Catherine St. > Ann Arbor MI 48109-5618 > 734-615-7826 > ------------------------------ Message: 171 Date: Thu, 09 Jul 2009 11:05:54 +0200 From: Marc Jekel <[hidden email]> Subject: [R] r bug (?) display of data To: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Hi R Fans, I stumbled across a strange (I think) bug in R 2.9.1. I have read in a data file with 5934 rows and 9 columns with the commands: daten = data.frame(read.table("C:/fussball.dat",header=TRUE)) Then I needed a subset of the data file: newd = daten[daten[,1]!=daten[,2],] --> two values do not meet the logical specification and are dropped. The strange thing about it: When I print the newd in the R Console, the output still shows 5934 rows. When I check the number of rows with NROW(newd) , I get 5932 as output. When I print newd[5934, ], I get NAs. When I print newd[5932, ] I get the row that is listed in line 5934 when I just type in newd. This is totally crazy! Has anyone had the same problem? Thanks for a post. Marc ------------------------------ Message: 172 Date: Thu, 9 Jul 2009 11:21:22 +0200 From: Sergey Goriatchev <[hidden email]> Subject: [R] Ordering zoo-object by its index To: [hidden email] Message-ID:    <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1 Hello everyone, Say I have zoo object x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1 x <- zoo(rnorm(5), x.Date) y <- zoo(rt(5, df=2), x.Date) z <- zoo(rt(5, df=5), x.Date) Data <- merge(x,y,z) What should I do to make the latest values appear at the top? [[elided Yahoo spam]] Regards, Sergey ------------------------------ Message: 173 Date: Thu, 09 Jul 2009 11:39:39 +0200 From: Peter Dalgaard <[hidden email]> Subject: Re: [R] r bug (?) display of data To: Marc Jekel <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Marc Jekel wrote: > Hi R Fans, > > I stumbled across a strange (I think) bug in R 2.9.1. I have read in a > data file with 5934 rows and 9 columns with the commands: > > daten = data.frame(read.table("C:/fussball.dat",header=TRUE)) > > Then I needed a subset of the data file: > > newd = daten[daten[,1]!=daten[,2],] > > --> two values do not meet the logical specification and are dropped. > > The strange thing about it: When I print the newd in the R Console, the > output still shows 5934 rows. When I check the number of rows with > NROW(newd) , I get 5932 as output. When I print newd[5934, ], I get NAs. > When I print newd[5932, ] I get the row that is listed in line 5934 when > I just type in newd. This is totally crazy! Has anyone had the same > problem? Thanks for a post. you actually count the number of lines? Thought so... It isn't any stranger than this: > data.frame(x=rnorm(6),y=rnorm(6))[-5,]       x     y 1 0.9457385 -1.1398275 2 -1.1683732 -0.7269941 3 0.9942821 0.9310146 4 -2.0839580 -0.6261567 6 1.7225233 0.2457897 --   O__ ---- Peter Dalgaard        ?ster Farimagsgade 5, Entr.B    c/ /'_ --- Dept. of Biostatistics    PO Box 2099, 1014 Cph. K  (*) \(*) -- University of Copenhagen   Denmark   Ph: (+45) 35327918 ~~~~~~~~~~ - ([hidden email])       FAX: (+45) 35327907 ------------------------------ Message: 174 Date: Thu, 09 Jul 2009 11:41:13 +0200 From: Uwe Ligges <[hidden email]> Subject: Re: [R] r bug (?) display of data To: Marc Jekel <[hidden email]> Cc: [hidden email] Message-ID: <[hidden email]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Marc Jekel wrote: > Hi R Fans, > > I stumbled across a strange (I think) bug in R 2.9.1. I have read in a > data file with 5934 rows and 9 columns with the commands: > > daten = data.frame(read.table("C:/fussball.dat",header=TRUE)) > > Then I needed a subset of the data file: > > newd = daten[daten[,1]!=daten[,2],] > > --> two values do not meet the logical specification and are dropped. > > The strange thing about it: When I print the newd in the R Console, the > output still shows 5934 rows. Uwe Ligges When I check the number of rows with > NROW(newd) , I get 5932 as output. When I print newd[5934, ], I get NAs. > When I print newd[5932, ] I get the row that is listed in line 5934 when > I just type in newd. This is totally crazy! Has anyone had the same > problem? Thanks for a post. > > Marc > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ------------------------------ _______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. End of R-help Digest, Vol 77, Issue 9 ************************************* [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
||||||||||||||||
|
Rolf Turner
|
On 10/07/2009, at 2:55 AM, Gaurav Kumar wrote: > Hi, > > I'm new to R and would like to know, how one can populate the list > with array data. > I'm reading a tab separated table in R. The data in the table looks > something like this. > > #Table Data > Comp A B C > Extracellular 103 268 535759 > Nucleus 45603 47783 442744 > > #R code > myData <- read.table("table.data", > header=T, > sep="\t", > comment.char = "#" > ); > inp <- scan("table.data", what=list(comp=" ", A="", B="", C="")); > n <- c(0:length(inp$comp)); > myList=list(); > for(i in n-1) > { > obj <-c(as.numeric(myData$A[i]),as.numeric(myData$B > [i]),as.numeric(myData$C[i])); > > } > > Need help to know if there is any function in R to push obj to myList (a) You apparently ``replied'' to an R-help digest, and included megabytes of totally irrelevant material in your post. It took me several minutes to delete it. STEP ONE: LEARN HOW TO USE EMAIL!!! (b) Do the following: myList <- list(); for(i in n-1) { myList[[i]] <-c(as.numeric(myData$A[i]),as.numeric(myData$B [i]),as.numeric(myData$C[i])); } cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}} ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
||||||||||||||||
|
Gaurav Kumar-7
|
In reply to this post
by Gaurav Kumar-7
Hi Rolf,
My apologies for the inconvenience caused due to my reply @ "R-help diges". Thanks for providing me a clue to solve the problem . I modify a bit to populate a list. This is throwing an error ##### Error in `*tmp*`[[j]] : subscript out of bounds" myData <- read.table("table.data", header=T, sep="\t", comment.char = "#" ); inp <- scan("table.data", what=list(comp=" ", A="", B="", C="")); n <- c(0:length(inp$comp)); myList=list(); for(i in n-1) { if(i < length(inp$comp)) { j=i+1; myList[[j]][1] <-c(as.numeric(myData$A[i])); myList[[j]][2] <-c(as.numeric(myData$B[i])); myList[[j]][2] <-c(as.numeric(myData$C[i])); } } print(myList); Any idea where i'm doing a mistake which is causing this error. Thanks in advance. regards Gaurav Kumar --- On Fri, 10/7/09, Rolf Turner <[hidden email]> wrote: From: Rolf Turner <[hidden email]> Subject: Re: [R] How to Populate List To: "[hidden email]" <[hidden email]> Cc: "[hidden email]" <[hidden email]> Date: Friday, 10 July, 2009, 1:39 AM On 10/07/2009, at 2:55 AM, Gaurav Kumar wrote: > Hi, > > I'm new to R and would like to know, how one can populate the list with array data. > I'm reading a tab separated table in R. The data in the table looks something like this. > > #Table Data > Comp A B C > Extracellular 103 268 535759 > Nucleus 45603 47783 442744 > > #R code > myData <- read.table("table.data", > header=T, > sep="\t", > comment.char = "#" > ); > inp <- scan("table.data", what=list(comp=" ", A="", B="", C="")); > n <- c(0:length(inp$comp)); > myList=list(); > for(i in n-1) > { > obj <-c(as.numeric(myData$A[i]),as.numeric(myData$B[i]),as.numeric(myData$C[i])); > > } > > Need help to know if there is any function in R to push obj to myList of totally irrelevant material in your post. It took me several minutes to delete it. STEP ONE: LEARN HOW TO USE EMAIL!!! (b) Do the following: myList <- list(); for(i in n-1) { myList[[i]] <-c(as.numeric(myData$A[i]),as.numeric(myData$B[i]),as.numeric(myData$C[i])); } cheers, Rolf Turner ###################################################################### Attention:This e-mail message is privileged and confidential. If you are not theintended recipient please delete the message and notify the sender.Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshalwww.marshalsoftware.com ###################################################################### [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
Rolf Turner
|
On 10/07/2009, at 5:25 PM, Gaurav Kumar wrote: > Hi Rolf, > > My apologies for the inconvenience caused due to my reply @ "R- > help diges". > Thanks for providing me a clue to solve the problem . > > I modify a bit to populate a list. This is throwing an error > ##### Error in `*tmp*`[[j]] : subscript out of bounds" > > myData <- read.table("table.data", > header=T, > sep="\t", > comment.char = "#" > ); > inp <- scan("table.data", what=list(comp=" ", A="", B="", C="")); > n <- c(0:length(inp$comp)); > myList=list(); > for(i in n-1) > { > if(i < length(inp$comp)) > { > j=i+1; > myList[[j]][1] <-c(as.numeric(myData$A[i])); > myList[[j]][2] <-c(as.numeric(myData$B[i])); > myList[[j]][2] <-c(as.numeric(myData$C[i])); > } > > } > print(myList); > > Any idea where i'm doing a mistake which is causing this error. When you're having difficulty, construct a very simple example that reproduces the problem. E.g. myList <- list() for(i in 1:10) { myList[[i]][1] <- 42 } You'll get the same ``subscript out of bounds'' error. Now ***think*** a bit!!! Strangely enough ( :-) ) the error message means ***exactly*** what it says. The subscript is out of bounds! You are trying to assign a value to the 1st, and 2nd, and ... 2nd, but I guess you mean the 3rd, components of myList[[j]]. But at this stage myList[[j]] ***DOESN'T HAVE ANY COMPONENTS***. It doesn't exist yet. How could it have components? There are a couple of ways you could go to do it right. (1) (Sticking with your original syntax, more or less.) if(i < length(inp$comp)) { j=i+1; myList[[j]] <- numeric(3) # Now myList[[j]] ***does*** have components, and all is well. myList[[j]][1] <- as.numeric(myData$A[i]) myList[[j]][2] <- as.numeric(myData$B[i]) myList[[j]][2] <- as.numeric(myData$C[i]) } NOTE: The ``c()'' construction you were using is unnecessary and confusing. What on earth do you think ``c()'' means, anyway? Also the semicolons are unnecessary and confusing. This is ***R*** not SAS or C!!! (2) (Better.) if(i < length(inp$comp)) { j=i+1; myList[[j]] <- c(as.numeric(myData$A[i]), as.numeric(myData$B[i]), as.numeric(myData$C[i])) } NOTE: The foregoing is an ***appropriate*** use of ``c()''!!! cheers, Rolf ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}} ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |