|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
How to Populate ListHi,
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, r-help-request@... <r-help-request@...> wrote: From: r-help-request@... <r-help-request@...> Subject: R-help Digest, Vol 77, Issue 9 To: r-help@... Date: Thursday, 9 July, 2009, 3:30 PM Send R-help mailing list submissions to    r-help@... 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    r-help-request@... You can reach the person managing the list at    r-help-owner@... 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? (rgunton@...)  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? (rmailbox@...)  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    (p_connolly@...)  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    (p_connolly@...)  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" <pecardoso@...> Subject: [R] system() how to make a program run a specific file To: <r-help@...> Cc: r-help@... Message-ID:    <!&!AAAAAAAAAAAYAAAAAAAAAK2N38q7o51Ejb8q0JfvLrBiggAAEAAAALpNHGSDjehOuS+QkkOFWe4BAAAAAA==@...>    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 <wapita@...> Subject: [R] RODBC and sqlSave issue To: <r-help@...> Message-ID: <BAY124-W219EF0E05D12D89E58F635D5290@...> 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 <ggrothendieck@...> Subject: Re: [R] Dump plots to powerpoint? To: Thomas <aiktocke@...> Cc: r-help@... Message-ID:    <971536df0907080321m5efbe72fu527eaaf479c4c998@...> 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<aiktocke@...> 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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)    <enrique.bengoechea@...> Subject: Re: [R] Dump plots to powerpoint? To: <r-help@...> Message-ID:    <19811401A1D8174CB3EAD7F6072E9B50023F3931@...> 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 <aiktocke@...> Subject: [R] Dump plots to powerpoint? To: r-help@... Message-ID: <254923.51562.qm@...> 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" <pecardoso@...> Subject: Re: [R] system() how to make a program run a specific file To: <r-help@...> Cc: r-help@... Message-ID:    <!&!AAAAAAAAAAAYAAAAAAAAAK2N38q7o51Ejb8q0JfvLrBiggAAEAAAAN3ZTD6PthRJg+0gw9qpt8MBAAAAAA==@...>    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: r-help-bounces@... [mailto:r-help-bounces@...] > Em nome de Paulo E. Cardoso > Enviada: quarta-feira, 8 de Julho de 2009 10:59 > Para: r-help@... > Cc: r-help@... > 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <jim@...> Subject: Re: [R] Fitting a trend-line To: anupam sinha <anupam.contact@...> Cc: r-help@... Message-ID: <4A5482C7.9020600@...> 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 <michael@...> Subject: [R] stats::decompose - Problem finding seasonal component    without trend To: r-help@... Message-ID: <24389771.post@...> 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 <r.aluizio@...> Subject: [R] Import xlsx file in Ubuntu 9.04 To: r-help@... Message-ID:    <71ea40f60907080456j771ce866h51cdf3d4cbf13f6d@...> 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 <jholtman@...> Subject: Re: [R] R 2.9.0 plot still forcing current time zone To: Britton Stephens <stephens@...> Cc: r-help@... Message-ID:    <644e1f320907080508q2f2cae99sac43e6e6011ad7c8@...> 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<stephens@...> 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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <deepayan.sarkar@...> Subject: Re: [R] How to re-order panels and y-axis values in trellis    display   using lattice To: Peter_Kappes@... Cc: r-help@... Message-ID:    <eb555e660907080520h2781e48ak91c297fba0057949@...> Content-Type: text/plain; charset=UTF-8 On Tue, Jul 7, 2009 at 3:03 PM, <Peter_Kappes@...> 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 <evrim.akar@...> Subject: [R] linear regression and testing the slope To: r-help@... Message-ID:    <35b900550907080529s6b5faaf4v91dc24ae9283f056@...> 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 <azzalini@...> Subject: [R] transform multi skew-t to uniform distribution Cc: r-help@... Message-ID: <20090708144039.488a5de7.azzalini@...> 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 <azzalini@...> 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 <markknecht@...> Subject: Re: [R] ReShape to create Time from Observations? To: jim holtman <jholtman@...> Cc: r-help <r-help@...> Message-ID:    <5bdc1c8b0907080602q70ff388dv75d6bac1055ed5be@...> Content-Type: text/plain; charset=UTF-8 On Tue, Jul 7, 2009 at 4:22 PM, jim holtman<jholtman@...> 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 <praveen.surendran@...> Subject: [R] R regular expression to extract words with the query    string. To: r-help@... Message-ID: <002501c9ffcc$a7d51260$f77f3720$%surendran@...> 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" <pecardoso@...> Subject: [R] system() how to make a program run a specific file - RUN    and   Output directory issues To: <r-help@...> Cc: r-help@... Message-ID:    <!&!AAAAAAAAAAAYAAAAAAAAAK2N38q7o51Ejb8q0JfvLrBiggAAEAAAAJ4Lc5ACanJEjmr/JpW5L9IBAAAAAA==@...>    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: r-help-bounces@... [mailto:r-help-bounces@...] > Em nome de Paulo E. Cardoso > Enviada: quarta-feira, 8 de Julho de 2009 12:08 > Para: r-help@... > Cc: r-help@... > 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: r-help-bounces@... [mailto:r-help-bounces@r- > project.org] > > Em nome de Paulo E. Cardoso > > Enviada: quarta-feira, 8 de Julho de 2009 10:59 > > Para: r-help@... > > Cc: r-help@... > > 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]] > > > > ______________________________________________ > > R-help@... mailing list > > https://stat.ethz.ch/mailman/listinfo/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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <lauri.nikkinen@...> Subject: [R] RDCOMClient: how to close Excel process? To: r-help@... Message-ID:    <ba8c09910907080606n29b8a537uac5ba1788376ff42@...> 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 <wwwhsd@...> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Lauri Nikkinen <lauri.nikkinen@...> Cc: r-help@... Message-ID:    <da79af330907080611p2554a888x2bdb3a73b99fb6e7@...> Content-Type: text/plain Try this: xl$Quit() On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...>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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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) <Ted.Harding@...> Subject: Re: [R] linear regression and testing the slope To: r-help@... Message-ID: <XFMail.090708141755.Ted.Harding@...> 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) <Ted.Harding@...> 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 <wwwhsd@...> Subject: Re: [R] R regular expression to extract words with the query    string. To: praveen.surendran@... Cc: r-help@... Message-ID:    <da79af330907080618k1e2b6d6aydcd711ec9f84bd50@...> 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 <praveen.surendran@... > 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <lauri.nikkinen@...> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Henrique Dallazuanna <wwwhsd@...> Cc: r-help@... Message-ID:    <ba8c09910907080619j7281ec4dg8dbda47fca4557ab@...> 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 <wwwhsd@...>: > Try this: > > xl$Quit() > > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...> > 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 >> >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/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 <wwwhsd@...> Subject: Re: [R] RDCOMClient: how to close Excel process? To: Lauri Nikkinen <lauri.nikkinen@...> Cc: r-help@... Message-ID:    <da79af330907080624t7b952c3brf14a910f4b67d260@...> 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 <lauri.nikkinen@...>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 <wwwhsd@...>: > > Try this: > > > > xl$Quit() > > > > On Wed, Jul 8, 2009 at 10:06 AM, Lauri Nikkinen <lauri.nikkinen@...> > > 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 > >> > >> ______________________________________________ > >> R-help@... mailing list > >> https://stat.ethz.ch/mailman/listinfo/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 <praveen.surendran@...> Subject: [R] R regular expression to extract words with the query    string. To: r-help@... Message-ID: <004401c9ffcf$d16bb5e0$744321a0$%surendran@...> 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:wwwhsd@...] Sent: 08 July 2009 14:18 To: praveen.surendran@... Cc: r-help@... 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 <praveen.surendran@...> 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]] ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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 <godmar@...> Subject: Re: [R] error: no such index at level 2 To: Petr PIKAL <petr.pikal@...> Cc: r-help@... Message-ID:    <719dced30907080628k145f68eckb5893beca07055@...> Content-Type: text/plain On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL <petr.pikal@...> wrote: > Hi > > r-help-bounces@... 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 <wwwhsd@...> Subject: Re: [R] error: no such index at level 2 To: Godmar Back <godmar@...> Cc: r-help@..., Petr PIKAL <petr.pikal@...> Message-ID:    <da79af330907080640x138ffcf4saa99cf322dc8a222@...> 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 <godmar@...> wrote: > On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL <petr.pikal@...> wrote: > > > Hi > > > > r-help-bounces@... 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <armstrong.whit@...> Subject: [R] functions to calculate t-stats, etc. for lm.fit objects? To: r-help <r-help@...> Message-ID:    <8ec76080907080651y79bfd52cgda42bc9a5bd906f3@...> 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 <marc_schwartz@...> Subject: Re: [R] Import xlsx file in Ubuntu 9.04 To: Rodrigo Aluizio <r.aluizio@...> Cc: r-help@... Message-ID: <60F64BC2-1720-4881-B604-DED2C6C49F5F@...> 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 <godmar@...> Subject: Re: [R] error: no such index at level 2 To: Henrique Dallazuanna <wwwhsd@...> Cc: r-help@..., Petr PIKAL <petr.pikal@...> Message-ID:    <719dced30907080658j5962bdddle84f10f60a669aa6@...> Content-Type: text/plain On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <wwwhsd@...>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 <fjbuch@...> Subject: Re: [R] Reading from Google Docs To: Uwe Ligges <ligges@...> Cc: R <r-help@...> Message-ID:    <bd93cdad0907080702j2da9b85fib18be515e65e3a30@...> 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 <ligges@...> > 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 >> <ggrothendieck@...>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<fjbuch@...> >>> 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 < >>>> >>> ggrothendieck@...> >>> >>>> 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]] >> >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/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 <jorgeivanvelez@...> Subject: Re: [R] R regular expression to extract words with the query    string. To: praveen.surendran@... Cc: r-help@... Message-ID:    <317737de0907080705t75becb0eu2c6b60b3399be318@...> 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 <praveen.surendran@...>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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <ggrothendieck@...> Subject: Re: [R] R regular expression to extract words with the query    string. To: praveen.surendran@... Cc: r-help@... Message-ID:    <971536df0907080708i1622cea7me05821d3638969e3@...> 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<praveen.surendran@...> 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <murdoch@...> Subject: Re: [R] Reading from Google Docs To: Farrel Buchinsky <fjbuch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...> Message-ID: <4A54A897.1020501@...> 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 <ligges@...> > >> 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 >>> <ggrothendieck@...>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<fjbuch@...> >>>> 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 < >>>>> >>>> ggrothendieck@...> >>>> >>>>> 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]] >>> >>> ______________________________________________ >>> R-help@... mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> > >    [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <fjbuch@...> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <murdoch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...> Message-ID:    <bd93cdad0907080713l6b938a23xf93b9c0508add162@...> 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 <murdoch@...> 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 <ligges@...> >> >> 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 >>>> <ggrothendieck@...>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<fjbuch@...> >>>>> 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 < >>>>>> >>>>>> ggrothendieck@...> >>>>> >>>>> 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]] >>>> >>>> ______________________________________________ >>>> R-help@... mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> >>    [[alternative HTML version deleted]] >> >> >> >> ------------------------------------------------------------------------ >> >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/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 <anupam.contact@...> Subject: Re: [R] Fitting a trend-line To: Jim Lemon <jim@...>, petr.pikal@... Cc: r-help@... Message-ID:    <82ec54570907080715r7ba35a80lbd2ae1213e435144@...> 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\)" <F.Wouterse@...> Subject: [R] truncated regression out-of-sample predictions To: <r-help@...> 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: f.wouterse@...    [[alternative HTML version deleted]] ------------------------------ Message: 35 Date: Wed, 8 Jul 2009 10:46:46 -0400 From: Donald Braman <dbraman@...> Subject: [R] recoding strings containing colons To: r-help <r-help@...>, jfox@... Message-ID:    <a6f585d20907080746x410ce8d3v83f00e6d567b04e2@...> 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 <godmar@...> Subject: Re: [R] error: no such index at level 2 To: Henrique Dallazuanna <wwwhsd@...> Cc: r-help@..., Petr PIKAL <petr.pikal@...> Message-ID:    <719dced30907080747r104a98dchb863269afff96361@...> Content-Type: text/plain On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <wwwhsd@...>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" <jane.curley@...> Subject: [R] please remove me from this list To: r-help@... Message-ID:    <C92AF9E76F41C5469314C1993B365E000101D1D2@...> Content-Type: text/plain    [[alternative HTML version deleted]] ------------------------------ Message: 38 Date: Wed, 08 Jul 2009 09:50:56 -0500 From: Marc Schwartz <marc_schwartz@...> Subject: Re: [R] functions to calculate t-stats, etc. for lm.fit    objects? To: Whit Armstrong <armstrong.whit@...> Cc: r-help <r-help@...> Message-ID: <986098B2-00D6-4702-8523-CC11BCA71CCF@...> 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 <cvandy26@...> Subject: [R] Formatting a Table To: r-help@... Message-ID: <24391433.post@...> 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 <lars.bergemann@...> Subject: [R] Two-way ANOVA gives different results using anova(lm())    than doing it by hand To: <r-help@...> Message-ID: <BLU129-W9C04BAF89433E2275EBA996290@...> 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 <tymek@...> Subject: [R] Passing arguments to with() To: r-help@... Message-ID:    <fb3e151c0907080701h636454fcp608847bdde60072b@...> 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 <armstrong.whit@...> Subject: Re: [R] functions to calculate t-stats, etc. for lm.fit    objects? To: Marc Schwartz <marc_schwartz@...> Cc: r-help <r-help@...> Message-ID:    <8ec76080907080807n15c1a3b3i26f36ea39bba05a5@...> 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<marc_schwartz@...> 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 <idgarad@...> Subject: [R] #INCLUDE To: r-help@... Message-ID:    <f22ceeb10907080816l21ebb7d0j4d368a823151b360@...> 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 <murdoch@...> Subject: Re: [R] Reading from Google Docs To: Farrel Buchinsky <fjbuch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...> Message-ID: <4A54B975.9050302@...> 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 <murdoch@...> 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 <ligges@...> >>> >>> 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 >>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>> 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 < >>>>>>> >>>>>>> ggrothendieck@...> >>>>>> 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]] >>>>> ______________________________________________ >>>>> R-help@... mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>>> >>>    [[alternative HTML version deleted]] >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ______________________________________________ >>> R-help@... mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> > >    [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <godmar@...> Subject: Re: [R] #INCLUDE To: Idgarad <idgarad@...> Cc: r-help@... Message-ID:    <719dced30907080823p5efbf875y4b83ae597798eae6@...> Content-Type: text/plain; charset=ISO-8859-1 ?source ? On Wed, Jul 8, 2009 at 11:16 AM, Idgarad<idgarad@...> 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <paul.simonin@...> Subject: [R] Comparing GAMMs To: R Help Listserve <r-help@...> Message-ID: <4A54BA2F.2060406@...> 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 <murdoch@...> Subject: Re: [R] Passing arguments to with() To: Tymek Wo?odz'ko <tymek@...> Cc: r-help@... Message-ID: <4A54BA8E.7030603@...> 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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <godmar@...> Subject: Re: [R] Formatting a Table To: cvandy <cvandy26@...> Cc: r-help@... Message-ID:    <719dced30907080836l28bbf170yed1b4f089d8f5baf@...> 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<cvandy26@...> 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. > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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" <David.Huffer@...> Subject: Re: [R] Formatting a Table To: "cvandy" <cvandy26@...>, <r-help@...> Message-ID:    <B4A52056BFE1CA40986BB3BADFA48141038F6D12@...> 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       david.huffer@... ----------------------------------------------------- -----Original Message----- From: r-help-bounces@... [mailto:r-help-bounces@...] On Behalf Of cvandy Sent: Wednesday, July 08, 2009 9:21 AM To: r-help@... 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. ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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 <gavin.simpson@...> Subject: Re: [R] Comparing GAMMs To: Paul Simonin <paul.simonin@...> Cc: R Help Listserve <r-help@...> Message-ID: <1247068444.14946.86.camel@...> 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 <mtb954@...> Subject: [R] Randomizing a dataframe To: r-help@... Message-ID:    <e40d78ce0907080854l243f9fd9h59e5accf2aeb47b6@...> 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" <David.Huffer@...> Subject: Re: [R] error: no such index at level 2 To: "Godmar Back" <godmar@...>, "Henrique Dallazuanna"    <wwwhsd@...> Cc: r-help@..., Petr PIKAL <petr.pikal@...> Message-ID:    <B4A52056BFE1CA40986BB3BADFA48141038F6D14@...> 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       david.huffer@... ----------------------------------------------------- -----Original Message----- From: r-help-bounces@... [mailto:r-help-bounces@...] On Behalf Of Godmar Back Sent: Wednesday, July 08, 2009 9:58 AM To: Henrique Dallazuanna Cc: r-help@...; Petr PIKAL Subject: Re: [R] error: no such index at level 2 On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <wwwhsd@...>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]] ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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: r-help-bounces@... [mailto:r-help-bounces@...] On Behalf Of Godmar Back Sent: Wednesday, July 08, 2009 9:58 AM To: Henrique Dallazuanna Cc: r-help@...; Petr PIKAL Subject: Re: [R] error: no such index at level 2 On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <wwwhsd@...>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]] ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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 <godmar@...> Subject: Re: [R] error: no such index at level 2 To: David Huffer <David.Huffer@...> Cc: r-help@..., Petr PIKAL <petr.pikal@...> Message-ID:    <719dced30907080859k554eae29q3c4677db1767e9a9@...> 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<David.Huffer@...> 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 ? ? ? ? ? david.huffer@... > ?----------------------------------------------------- > > > -----Original Message----- > From: r-help-bounces@... [mailto:r-help-bounces@...] On Behalf Of Godmar Back > Sent: Wednesday, July 08, 2009 9:58 AM > To: Henrique Dallazuanna > Cc: r-help@...; Petr PIKAL > Subject: Re: [R] error: no such index at level 2 > > On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <wwwhsd@...>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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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: r-help-bounces@... [mailto:r-help-bounces@...] On Behalf Of Godmar Back > Sent: Wednesday, July 08, 2009 9:58 AM > To: Henrique Dallazuanna > Cc: r-help@...; Petr PIKAL > Subject: Re: [R] error: no such index at level 2 > > On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna <wwwhsd@...>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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <ggrothendieck@...> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <murdoch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID:    <971536df0907080904l16a8f1a0r7a9280e4cc0545d4@...> 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<murdoch@...> 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 <murdoch@...> 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 <ligges@...> >>>> >>>> ?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 >>>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>>> 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 < >>>>>>>> >>>>>>>> ?ggrothendieck@...> >>>>>>> >>>>>>> ?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]] >>>>>> >>>>>> ______________________________________________ >>>>>> R-help@... mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>>>> >>>> ? ? ? [[alternative HTML version deleted]] >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> ______________________________________________ >>>> R-help@... mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >> >> ? ? ? ?[[alternative HTML version deleted]] >> >> >> >> ------------------------------------------------------------------------ >> >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <Greg.Snow@...> Subject: Re: [R] Uncorrelated random vectors    <r-help@...>, " Luba (AIM SE)Stein" <LUBA.STEIN@...> Message-ID:    <B37C0A15B8FB3C468B5BC7EBC7DA14CC62128DEB0D@...> 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 greg.snow@... 801.408.8111 > -----Original Message----- > From: r-help-bounces@... [mailto:r-help-bounces@r- > project.org] On Behalf Of Moshe Olshansky > Sent: Tuesday, July 07, 2009 9:10 PM > To: r-help@...; 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) <LUBA.STEIN@...> > wrote: > > > From: Stein, Luba (AIM SE) <LUBA.STEIN@...> > > Subject: [R] Uncorrelated random vectors > > To: "r-help@..." <r-help@...> > > 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]] > > > > ______________________________________________ > > R-help@... > > mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > > and provide commented, minimal, self-contained, > > reproducible code. > > > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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: r-help@..., Idgarad <idgarad@...> Message-ID: <88957.62814.qm@...> Content-Type: text/plain source(_external_file_name) --- On Wed, 7/8/09, Idgarad <idgarad@...> wrote: From: Idgarad <idgarad@...> Subject: [R] #INCLUDE To: r-help@... 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]] ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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 <duncan@...> Subject: Re: [R] Import xlsx file in Ubuntu 9.04 To: Marc Schwartz <marc_schwartz@...> Cc: r-help@... Message-ID: <4A54C633.3050803@...> 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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <markknecht@...> Subject: Re: [R] Randomizing a dataframe To: Mark Na <mtb954@...> Cc: r-help@... Message-ID:    <5bdc1c8b0907080919p48adb313o1fa0cbfbb1c74395@...> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 8:54 AM, Mark Na<mtb954@...> 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" <wdunlap@...> Subject: Re: [R] Reading from Google Docs To: "Gabor Grothendieck" <ggrothendieck@...> Cc: R <r-help@...>, Farrel Buchinsky <fjbuch@...> Message-ID:    <77EB52C6DD32BA4D87471DCD70C8D70001755E86@...> Content-Type: text/plain;   charset="iso-8859-1" > -----Original Message----- > From: r-help-bounces@... > [mailto:r-help-bounces@...] 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<murdoch@...> 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 > <murdoch@...> 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 <ligges@...> > >>>> > >>>> ?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 > >>>>>> <ggrothendieck@...>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<fjbuch@...> > >>>>>>> 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 < > >>>>>>>> > >>>>>>>> ?ggrothendieck@...> > >>>>>>> > >>>>>>> ?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]] > >>>>>> > >>>>>> ______________________________________________ > >>>>>> R-help@... mailing list > >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help > >>>>>> PLEASE do read the posting guide > >>>>>> http://www.R-project.org/posting-guide.html > >>>>>> and provide commented, minimal, self-contained, > reproducible code. > >>>>>> > >>>>>> > >>>> ? ? ? [[alternative HTML version deleted]] > >>>> > >>>> > >>>> > >>>> > -------------------------------------------------------------- > ---------- > >>>> > >>>> ______________________________________________ > >>>> R-help@... mailing list > >>>> https://stat.ethz.ch/mailman/listinfo/r-help > >>>> PLEASE do read the posting guide > >>>> http://www.R-project.org/posting-guide.html > >>>> and provide commented, minimal, self-contained, > reproducible code. > >>>> > >>> > >> > >> ? ? ? ?[[alternative HTML version deleted]] > >> > >> > >> > >> > -------------------------------------------------------------- > ---------- > >> > >> ______________________________________________ > >> R-help@... mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > > R-help@... mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <Greg.Snow@...> Subject: Re: [R] bigglm() results different from glm()+Another    question To: utkarshsinghal <utkarsh.singhal@...> Cc: r help <r-help@...>, Thomas Lumley    <tlumley@...> Message-ID:    <B37C0A15B8FB3C468B5BC7EBC7DA14CC62128DEB4F@...> 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 greg.snow@... 801.408.8111 From: utkarshsinghal [mailto:utkarsh.singhal@...] 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 greg.snow@...<mailto:greg.snow@...> 801.408.8111 From: utkarshsinghal [mailto:utkarsh.singhal@...] 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 greg.snow@...<mailto:greg.snow@...> 801.408.8111 From: utkarshsinghal [mailto:utkarsh.singhal@...] 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 tlumley@...<mailto:tlumley@...>  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 <caitlyn.paget@...> Subject: [R] matching each row To: r-help@... Message-ID: <24393051.post@...> 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 <mister_bluesman@...> Subject: [R] Extracting a column name in loop? To: r-help@... Message-ID: <24393160.post@...> 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 <markknecht@...> Subject: Re: [R] Extracting a column name in loop? To: mister_bluesman <mister_bluesman@...> Cc: r-help@... Message-ID:    <5bdc1c8b0907080953j6ef9025er9642563d12ea013c@...> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 8:41 AM, mister_bluesman<mister_bluesman@...> 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 <murdoch@...> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <ggrothendieck@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID: <4A54CF73.3070601@...> 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<murdoch@...> 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 <murdoch@...> 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 <ligges@...> >>>>> >>>>> 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 >>>>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>>>> 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 < >>>>>>>>> >>>>>>>>> ggrothendieck@...> >>>>>>>> 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]] >>>>>>> ______________________________________________ >>>>>>> R-help@... mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>> PLEASE do read the posting guide >>>>>>> http://www.R-project.org/posting-guide.html >>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>> >>>>>>> >>>>>     [[alternative HTML version deleted]] >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> ______________________________________________ >>>>> R-help@... mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>    [[alternative HTML version deleted]] >>> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ______________________________________________ >>> R-help@... mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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: rgunton@... Subject: [R] Simple monovariate classification? To: r-help@... Message-ID: <20090708171922.84035wc3fonsl2os@...> 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 <fjbuch@...> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <ggrothendieck@...> Cc: Uwe Ligges <ligges@...>, R    <r-help@...>,   Duncan Murdoch <murdoch@...> Message-ID:    <bd93cdad0907080959h4886fdb4w5cb7b63181453b85@...> 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 <ggrothendieck@...>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<murdoch@...> > 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 <murdoch@...> > 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 <ligges@...> > >>>> > >>>> 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 > >>>>>> <ggrothendieck@...>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<fjbuch@... > > > >>>>>>> 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 < > >>>>>>>> > >>>>>>>> ggrothendieck@...> > >>>>>>> > >>>>>>> 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]] > >>>>>> > >>>>>> ______________________________________________ > >>>>>> R-help@... mailing list > >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help > >>>>>> PLEASE do read the posting guide > >>>>>> http://www.R-project.org/posting-guide.html > >>>>>> and provide commented, minimal, self-contained, reproducible code. > >>>>>> > >>>>>> > >>>>     [[alternative HTML version deleted]] > >>>> > >>>> > >>>> > >>>> > ------------------------------------------------------------------------ > >>>> > >>>> ______________________________________________ > >>>> R-help@... mailing list > >>>> https://stat.ethz.ch/mailman/listinfo/r-help > >>>> PLEASE do read the posting guide > >>>> http://www.R-project.org/posting-guide.html > >>>> and provide commented, minimal, self-contained, reproducible code. > >>>> > >>> > >> > >>    [[alternative HTML version deleted]] > >> > >> > >> > >> ------------------------------------------------------------------------ > >> > >> ______________________________________________ > >> R-help@... mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > > > > ______________________________________________ > > R-help@... mailing list > > https://stat.ethz.ch/mailman/listinfo/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 <Greg.Snow@...> Subject: Re: [R] Two-way ANOVA gives different results using    anova(lm()) than doing it by hand To: Lars Bergemann <lars.bergemann@...>,    "r-help@..."   <r-help@...> Message-ID:    <B37C0A15B8FB3C468B5BC7EBC7DA14CC62128DEBC2@...> 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 greg.snow@... 801.408.8111 > -----Original Message----- > From: r-help-bounces@... [mailto:r-help-bounces@r- > project.org] On Behalf Of Lars Bergemann > Sent: Wednesday, July 08, 2009 8:35 AM > To: r-help@... > 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 <jrkrideau@...> Subject: Re: [R] #INCLUDE To: r-help@..., Idgarad <idgarad@...> Message-ID: <193977.53145.qm@...> Content-Type: text/plain; charset=iso-8859-1 ?source perhaps? --- On Wed, 7/8/09, Idgarad <idgarad@...> wrote: > From: Idgarad <idgarad@...> > Subject: [R] #INCLUDE > To: r-help@... > 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 <marc_schwartz@...> Subject: Re: [R] Two-way ANOVA gives different results using    anova(lm()) than doing it by hand To: Greg Snow <Greg.Snow@...> Cc: r-help <r-help@...> Message-ID: <70A0EE83-0725-41F1-AE7B-AD07F06A4A45@...> 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" <David.Huffer@...> Subject: Re: [R] matching each row To: "tathta" <caitlyn.paget@...>, <r-help@...> Message-ID:    <B4A52056BFE1CA40986BB3BADFA48141038F6D1B@...> 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       david.huffer@... ----------------------------------------------------- -----Original Message----- From: r-help-bounces@... [mailto:r-help-bounces@...] On Behalf Of tathta Sent: Wednesday, July 08, 2009 11:10 AM To: r-help@... 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. ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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 <Greg.Snow@...> Subject: Re: [R] Randomizing a dataframe To: Mark Na <mtb954@...>, "r-help@..."    <r-help@...> Message-ID:    <B37C0A15B8FB3C468B5BC7EBC7DA14CC62128DEBF4@...> 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 greg.snow@... 801.408.8111 > -----Original Message----- > From: r-help-bounces@... [mailto:r-help-bounces@r- > project.org] On Behalf Of Mark Na > Sent: Wednesday, July 08, 2009 9:54 AM > To: r-help@... > 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <ghirson@...> Subject: Re: [R] Simple monovariate classification? To: rgunton@..., R-help@... Message-ID: <4A54D771.30003@...> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Try ?cut Greg rgunton@... 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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 ghirson@... 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 <ghirson@...> Subject: Re: [R] Simple monovariate classification? To: rgunton@..., R-help@... Message-ID: <4A54D9B7.8070302@...> 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 rgunton@... 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 > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 ghirson@... 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 <caitlyn.paget@...> Subject: Re: [R] matching each row To: r-help@... Message-ID: <24396184.post@...> 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: mmiller3@... (Michael A. Miller) Subject: Re: [R] OK - I got the data - now what? :-) To: Mark Knecht <markknecht@...> Cc: r-help <r-help@...> Message-ID: <87r5wrqd07.fsf@...> 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" <tito0003@...> Subject: [R] typo in ts detrending implementation in spec.pgram? To: <r-help@...> 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 <fjbuch@...> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <ggrothendieck@...> Cc: Uwe Ligges <ligges@...>, R    <r-help@...>,   Duncan Murdoch <murdoch@...>,    Duncan Temple Lang <duncan@...> Message-ID:    <bd93cdad0907081106g57f934as6a169204c9460ab4@...> 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("fjbuch@...", "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 <fjbuch@...> 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 <ggrothendieck@...>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<murdoch@...> >> 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 <murdoch@...> >> 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 <ligges@...> >> >>>> >> >>>> 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 >> >>>>>> <ggrothendieck@...>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< >> fjbuch@...> >> >>>>>>> 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 < >> >>>>>>>> >> >>>>>>>> ggrothendieck@...> >> >>>>>>> >> >>>>>>> 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]] >> >>>>>> >> >>>>>> ______________________________________________ >> >>>>>> R-help@... mailing list >> >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >> >>>>>> PLEASE do read the posting guide >> >>>>>> http://www.R-project.org/posting-guide.html >> >>>>>> and provide commented, minimal, self-contained, reproducible code.. >> >>>>>> >> >>>>>> >> >>>>     [[alternative HTML version deleted]] >> >>>> >> >>>> >> >>>> >> >>>> >> ------------------------------------------------------------------------ >> >>>> >> >>>> ______________________________________________ >> >>>> R-help@... mailing list >> >>>> https://stat.ethz.ch/mailman/listinfo/r-help >> >>>> PLEASE do read the posting guide >> >>>> http://www.R-project.org/posting-guide.html >> >>>> and provide commented, minimal, self-contained, reproducible code. >> >>>> >> >>> >> >> >> >>    [[alternative HTML version deleted]] >> >> >> >> >> >> >> >> >> ------------------------------------------------------------------------ >> >> >> >> ______________________________________________ >> >> R-help@... mailing list >> >> https://stat.ethz.ch/mailman/listinfo/r-help >> >> PLEASE do read the posting guide >> >> http://www.R-project.org/posting-guide.html >> >> and provide commented, minimal, self-contained, reproducible code. >> > >> > ______________________________________________ >> > R-help@... mailing list >> > https://stat.ethz.ch/mailman/listinfo/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 <marc_schwartz@...> Subject: Re: [R] matching each row To: tathta <caitlyn.paget@...> Cc: r-help@... Message-ID: <F579D1AB-F036-4AC7-BBD1-5A8BEEAF508D@...> 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 <markknecht@...> Subject: Re: [R] OK - I got the data - now what? :-) To: mmiller3@... Cc: r-help <r-help@...> Message-ID:    <5bdc1c8b0907081113m3e112dbexe17729c4630b160@...> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 10:51 AM, Michael A. Miller<mmiller3@...> 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 <rsela@...> Subject: [R] \dQuote in packages To: r-help <r-help@...> Message-ID:    <31158951.1855241247077909779.JavaMail.root@...> 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\)" <F.Wouterse@...> Subject: Re: [R] truncated regression out-of-sample predictions To: <r-help@...> 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: f.wouterse@...    [[alternative HTML version deleted]] ------------------------------ Message: 82 Date: Wed, 8 Jul 2009 19:38:23 +0100 From: "Chrysanthi A." <chrysain@...> Subject: [R] heatmap.2: question regarding the "raw z-score" To: r-help@... Message-ID:    <66b602900907081138h1a579341u1789a9a8988e4e@...> 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 <sjaffe@...> Subject: [R] print() to file? To: r-help@... Message-ID: <24397445.post@...> 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 <Greg.Snow@...> Subject: Re: [R] print() to file? To: Steve Jaffe <sjaffe@...>, "r-help@..."    <r-help@...> Message-ID:    <B37C0A15B8FB3C468B5BC7EBC7DA14CC62128DECF4@...> Content-Type: text/plain; charset="us-ascii" ?sink -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow@... 801.408.8111 > -----Original Message----- > From: r-help-bounces@... [mailto:r-help-bounces@r- > project.org] On Behalf Of Steve Jaffe > Sent: Wednesday, July 08, 2009 1:03 PM > To: r-help@... > 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. > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <ggrothendieck@...> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <murdoch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID:    <971536df0907081218r5bbbb752w8c70c1fb1c101a5b@...> 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<murdoch@...> 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<murdoch@...> >> 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 <murdoch@...> >>>> 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 <ligges@...> >>>>>> >>>>>> ?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 >>>>>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>>>>> 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 < >>>>>>>>>> >>>>>>>>>> ?ggrothendieck@...> >>>>>>>>> >>>>>>>>> ?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]] >>>>>>>> >>>>>>>> ______________________________________________ >>>>>>>> R-help@... mailing list >>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>> PLEASE do read the posting guide >>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>>> >>>>>>>> >>>>>> ? ? ?[[alternative HTML version deleted]] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> ______________________________________________ >>>>>> R-help@... mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>> ? ? ? [[alternative HTML version deleted]] >>>> >>>> >>>> >>>> ------------------------------------------------------------------------ >>>> >>>> ______________________________________________ >>>> R-help@... mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> ______________________________________________ >>> R-help@... mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/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 <caitlyn.paget@...> Subject: Re: [R] matching each row To: r-help@... Message-ID: <24395711.post@...> 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 <kboege@...> 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: r-help@... Message-ID: <7uhj2j$djep5@...> 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 <murdoch@...> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <ggrothendieck@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID: <4A54F3C1.7050302@...> 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<murdoch@...> 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<murdoch@...> >>> 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 <murdoch@...> >>>>> 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 <ligges@...> >>>>>>> >>>>>>> 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 >>>>>>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>>>>>> 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 < >>>>>>>>>>> >>>>>>>>>>> ggrothendieck@...> >>>>>>>>>> >>>>>>>>>> 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]] >>>>>>>>> >>>>>>>>> ______________________________________________ >>>>>>>>> R-help@... mailing list >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>>> PLEASE do read the posting guide >>>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>>> and provide commented, minimal, self-contained, reproducible code.. >>>>>>>>> >>>>>>>>> >>>>>>>   [[alternative HTML version deleted]] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> ______________________________________________ >>>>>>> R-help@... mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>> PLEASE do read the posting guide >>>>>>> http://www.R-project.org/posting-guide.html >>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>> >>>>>     [[alternative HTML version deleted]] >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------ >>>>> >>>>> ______________________________________________ >>>>> R-help@... mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> ______________________________________________ >>>> R-help@... mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>> >>> ______________________________________________ >>> R-help@... mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> >> > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <ggrothendieck@...> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <murdoch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID:    <971536df0907081239s528db28u977c01b19874c251@...> 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<murdoch@...> 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<murdoch@...> >> 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<murdoch@...> >>>> 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 <murdoch@...> >>>>>> 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 <ligges@...> >>>>>>>> >>>>>>>> ?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 >>>>>>>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>>>>>>> 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 < >>>>>>>>>>>> >>>>>>>>>>>> ?ggrothendieck@...> >>>>>>>>>>> >>>>>>>>>>> ?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]] >>>>>>>>>> >>>>>>>>>> ______________________________________________ >>>>>>>>>> R-help@... mailing list >>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>>>> PLEASE do read the posting guide >>>>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>>>>> >>>>>>>>>> >>>>>>>> ? ? [[alternative HTML version deleted]] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> ------------------------------------------------------------------------ >>>>>>>> >>>>>>>> ______________________________________________ >>>>>>>> R-help@... mailing list >>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>> PLEASE do read the posting guide >>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>>> >>>>>> ? ? ?[[alternative HTML version deleted]] >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------ >>>>>> >>>>>> ______________________________________________ >>>>>> R-help@... mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>>> ______________________________________________ >>>>> R-help@... mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>>> >>>> >>>> ______________________________________________ >>>> R-help@... mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>> PLEASE do read the posting guide >>>> http://www.R-project.org/posting-guide.html >>>> and provide commented, minimal, self-contained, reproducible code. >>> >>> >> >> ______________________________________________ >> R-help@... mailing list >> https://stat.ethz.ch/mailman/listinfo/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 <dacostaj@...> Subject: [R] nested model with random factors To: r-help@... Message-ID: <8D1245EC-8B1B-4818-AD9E-24DB570A0202@...> 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 <markknecht@...> Subject: [R] What is cast telling me? To: r-help <r-help@...> Message-ID:    <5bdc1c8b0907081241t734c2ca1ye595821a75b9ddc8@...> 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 <murdoch@...> Subject: Re: [R] Reading from Google Docs To: Gabor Grothendieck <ggrothendieck@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID: <4A54F8B5.8030304@...> 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<murdoch@...> 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<murdoch@...> >>> 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<murdoch@...> >>>>> 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 <murdoch@...> >>>>>>> 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 <ligges@...> >>>>>>>>> >>>>>>>>> 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 >>>>>>>>>>> <ggrothendieck@...>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<fjbuch@...> >>>>>>>>>>>> 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 < >>>>>>>>>>>>> >>>>>>>>>>>>> ggrothendieck@...> >>>>>>>>>>>> >>>>>>>>>>>> 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]] >>>>>>>>>>> >>>>>>>>>>> ______________________________________________ >>>>>>>>>>> R-help@... mailing list >>>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>>>>> PLEASE do read the posting guide >>>>>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>    [[alternative HTML version deleted]] >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------ >>>>>>>>> >>>>>>>>> ______________________________________________ >>>>>>>>> R-help@... mailing list >>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>>>> PLEASE do read the posting guide >>>>>>>>> http://www.R-project.org/posting-guide.html >>>>>>>>> and provide commented, minimal, self-contained, reproducible code.. >>>>>>>>> >>>>>>>   [[alternative HTML version deleted]] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------ >>>>>>> >>>>>>> ______________________________________________ >>>>>>> R-help@... mailing list >>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>>> PLEASE do read the posting guide >>>>>>> http://www.R-project.org/posting-guide.html >>>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>>>> ______________________________________________ >>>>>> R-help@... mailing list >>>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>>> PLEASE do read the posting guide >>>>>> http://www.R-project.org/posting-guide.html >>>>>> and provide commented, minimal, self-contained, reproducible code. >>>>>> >>>>> >>>>> ______________________________________________ >>>>> R-help@... mailing list >>>>> https://stat.ethz.ch/mailman/listinfo/r-help >>>>> PLEASE do read the posting guide >>>>> http://www.R-project.org/posting-guide.html >>>>> and provide commented, minimal, self-contained, reproducible code. >>>> >>>> >>> >>> ______________________________________________ >>> R-help@... mailing list >>> https://stat.ethz.ch/mailman/listinfo/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 <marc_schwartz@...> Subject: Re: [R] matching each row To: tathta <caitlyn.paget@...> Cc: r-help@... Message-ID: <294F22BA-B486-41BE-B619-AA8FEAA12F9B@...> 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: rmailbox@... Subject: Re: [R] What is cast telling me? To: "Mark Knecht" <markknecht@...>, "r-help"    <r-help@...> Message-ID: <1247083118.15594.1324139359@...> 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" <markknecht@...> To: "r-help" <r-help@...> 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 > ______________________________________________ R-help@... mailing list https://stat.ethz.ch/mailman/listinfo/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" <jmacdon@...> Subject: Re: [R] heatmap.2: question regarding the "raw z-score" To: "Chrysanthi A." <chrysain@...> Cc: r-help@... Message-ID: <4A54FCC0.2000905@...> 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]] > > ______________________________________________ > R-help@... mailing list > https://stat.ethz.ch/mailman/listinfo/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 <markknecht@...> Subject: Re: [R] What is cast telling me? To: rmailbox@... Cc: r-help <r-help@...> Message-ID:    <5bdc1c8b0907081322x5c2d5c85wb3163ae8bcc14503@...> Content-Type: text/plain; charset=UTF-8 On Wed, Jul 8, 2009 at 12:58 PM, <rmailbox@...> 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 <ggrothendieck@...> Subject: Re: [R] Reading from Google Docs To: Duncan Murdoch <murdoch@...> Cc: R <r-help@...>, Uwe Ligges    <ligges@...>,   Farrel Buchinsky <fjbuch@...> Message-ID:    <971536df0907081331n54e1bb6bt8d202402439fa3d7@...> 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<murdoch@...> 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<murdoch@...> >> 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<murdoch@...> >>>> 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<murdoch@...> >>>>>> 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 <murdoch@...> >>>>>>>> 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 <ligges@...> >>>>>>>>>> >>>>>>>>>> ?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. >>>>>>>& |