Hi,
I'm new to R and would like to know, how one can populate the list with array data.
I'm reading a tab separated table in R. The data in the table looks something like this.
#Table Data
Comp   A   B   C
Extracellular   103   268   535759
Nucleus   45603   47783   442744
#R code
myData <- read.table("table.data",
            header=T,
            sep="\t",
            comment.char = "#"
            );
inp <- scan("table.data", what=list(comp=" ", A="", B="", C=""));
n <- c(0:length(inp$comp));
myList=list();
for(i in n-1)
{
   obj <-c(as.numeric(myData$A[i]),as.numeric(myData$B[i]),as.numeric(myData$C[i]));
  Â
}
Need help to know if there is any function in R to push obj to myList
  Â
Thanks in advance for your help.
  Â
regards
Gaurav Kumar
www.gauravkumar.org
PhD Student, Chemistry and Biomolecular Sciences, Macquarie , Sydney, Australia.
MS (Computational Biology), NCBS-TIFR, Bangalore, India.
--- On Thu, 9/7/09,
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-helpor, 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:
------------------------------
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.htmlAbout 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.htmlSent 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))
>
[[elided Yahoo spam]]
--
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.
You need to read up on levels() of factors; in both cases, the
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
>>
<SNIP>
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
The quantity 't' is the estimated value (-0.001599 for the slope 's')
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-testHoping 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-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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.
>>
>
   [[alternative HTML version deleted]]
------------------------------
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.
>
   [[alternative HTML version deleted]]
------------------------------
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.
>>
>
>
   [[alternative HTML version deleted]]
------------------------------
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.htmlSent 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?
Don't use with. Use t.test(data[[x]] ~ data[[y]]).
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.htmlSent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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.
[[elided Yahoo spam]]
> 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-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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]]
>
Sounds like maybe you're looking for some form of Monte Carlo
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#a20799206thx
--
View this message in context:
http://www.nabble.com/matching-each-row-tp24393051p24393051.htmlSent 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.htmlSent 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.
Possibly something like
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.
> >
>
   [[alternative HTML version deleted]]
------------------------------
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#a20799206thx
--
View this message in context:
http://www.nabble.com/matching-each-row-tp24393051p24393051.htmlSent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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.htmlSent 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.htmlMikhail
------------------------------
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.
>> >
>>
>
>
   [[alternative HTML version deleted]]
------------------------------
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
>
>
[[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#a20799206If 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
>
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.htmlSent 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
>
>
[[elided Yahoo spam]]
>
>
>
> thx
>
--
View this message in context:
http://www.nabble.com/matching-each-row-tp24393051p24395711.htmlSent 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)
[[elided Yahoo spam]]
<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-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland 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..
How about looking at the code?
    if (scale == "row") {
      retval$rowMeans <- rm <- rowMeans(x, na.rm = na.rm)
      x <- sweep(x, 1, rm)
      retval$rowSDs <- sx <- apply(x, 1, sd, na.rm = na.rm)
      x <- sweep(x, 1, sx, "/")
    }
    else if (scale == "column") {
      retval$colMeans <- rm <- colMeans(x, na.rm = na.rm)
      x <- sweep(x, 2, rm)
      retval$colSDs <- sx <- apply(x, 2, sd, na.rm = na.rm)
      x <- sweep(x, 2, sx, "/")
    }
So the z-score is calculated on either the row or column (or the default
of "none").
I don't see how you can get something saying 'raw z-score'. I get either
'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row Z-Score,
then the rows are centered and scaled by subtracting the mean of the row
from every value and then dividing the resulting values by the standard
deviation of the row.
Best,
Jim
--
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.
>>>>>>>>>>>>
>>>>>>>>>>>> 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: 98
Date: Wed, 8 Jul 2009 16:36:48 -0400
From: suman Duvvuru <
duvvuru.suman@...>
Subject: [R] Unix commands on R
To:
r-help@...
Message-ID:
   <
bac8a0820907081336y585596c5o503707a554878e2c@...>
Content-Type: text/plain
I am using R on unix. While in R how do I execute the unix shell commands?
Is there a way to do it? I am executing a function in R and the matrix
resulting from the function has to be passed on as an input to unix command..
Any directions will be helpful.
Thanks,
Suman
   [[alternative HTML version deleted]]
------------------------------
Message: 99
Date: Wed, 8 Jul 2009 16:52:37 -0400
From: Justin Donaldson <
jjdonald@...>
Subject: [R] rgtk2 colorbutton
To:
r-help@...
Message-ID:
   <
eda626a30907081352k488e3056w80211f2c22453bf7@...>
Content-Type: text/plain
How do you retrieve the color from a GtkColorButton in rgtk2?
There seems to be a promising function gtkColorButtonGetColor
However, the function doesn't return the current color, instead it *sets* a
color that you pass to it. The function header looks like
gtkColorButtonGetColor(color_button, color), and doesn't return anything.
That's a bit convoluted, but manageable. I'll just create a "color", let
gtkColorButtonGetColor set it, and then read the modified value
However, you have to pass a *GdkColor* type to set "color".... The simplest
way to create one seems to be:
color = as.GdkColor('white')
It seems I should be able to pass this color to the color button handler and
see what the selected color is.
HOWEVER, this still doesn't work. gtkColorButtonGetColor still does not
modify the created color. >:(
require rgtk2
b<-gtkColorButtonNew()
gw <- gtkWindow(show=F)
gw$Add(b)
gw$Show()
changeColor<-function(b){
  color = as.GdkColor('white') # create a color to change
  message('initial color value')
  print(color)# print it out
  gtkColorButtonGetColor(b,color) # this function should change 'color'
  message('after gtkColorButtonGetColor()... on my machine the color is
unchanged:')
  print(color)
}
gSignalConnect(b, 'color-set',changeColor)
Best,
-Justin
--
Justin Donaldson
PhD Candidate, Informatics
Indiana University
http://www.scwn.netaim: iujjd
   [[alternative HTML version deleted]]
------------------------------
Message: 100
Date: Wed, 08 Jul 2009 22:57:36 +0200
From: Uwe Ligges <
ligges@...>
Subject: Re: [R] R2WinBUGS under Linux/WINE fails
To: Harlan Harris <
harlan@...>
Cc:
r-help@...
Message-ID: <
4A550840.4080108@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Harlan Harris wrote:
> Hi,
>
> I'm running wine-1.0.1, OpenBUGS 3.0.3, R 2.9.0, and R2WinBUGS on a Redhat
> Enterprise Linux machine.
>
> Following various peoples' suggestions...
>
> This works perfectly (yay!): wine Z:/opt/OpenBUGS/winbugs.exe
>
> Within R, however, I get this:
>
> (setup the example from ?bugs, then....)
>
> R> schools.sim <- bugs(data, inits, parameters, model.file, n.chains=3,
> n.iter=5000,bugs.directory="Z:/opt/OpenBUGS/")
> Error in file(con, "rb") : cannot open the connection
> In addition: Warning message:
> In file(con, "rb") :
>Â Â Â cannot open file
> '/home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc':
> No such file or directory
> Error in bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE = useWINE,
> :
>Â Â Â WinBUGS executable does not exist in
> /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS/
>
> Trying to figure out these path issues:
>
>> ls /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS/
> BackBUGS.lnk    Compare  Docu   Graph      Lindev
> Ole        Randnumseeds.odc Std   Updater
> brugs.dll    Correl    Doodle  Host     Manuals
> OpenBUGS.zip     Ranks        Summary Win
> brugs.so      Dev    Examples Html     Maps
> Plots       Samples       System   winbugs.exe
> Bugs        Developer Form   libtaucs.dll Math
> randnumseeds0.bmp Script.odc    Test    Xhtml
> classicbugs.exe Deviance   GeoBUGS   Lin       Monitors
> Randnumseeds.html Spatial       Text
>
>> ls /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc
> ls: /home/harlan/.wine/dosdevices/z:/opt/OpenBUGS//System/Rsrc/Registry.odc:
> No such file or directory
>
> So, the warning message is correct, but the error is not. winbugs.exe
> clearly exists, and I'd expect bugs.run to find it...
So your WinBUGS installation is broken.
Can you please try to reinstall?
BTW, which version of R2WinBUGS are we talking about, the most recent one?
>
> If I add "program="openbugs"", then I get the warning to install BRugs,
> which no longer exists. (But it's not clear if that's necessary.)
BRugs is available from the CRAN extras repository hosted by Brian
Ripley. Is BRugs really working on your machine? I've not heared of many
 working Linux installations.
Best,
Uwe Ligges
> Is it possible to make this work?
>
> If not, I'm extremely thankful that I can use Bugs under Wine, but I'd
[[elided Yahoo spam]]
>
[[elided Yahoo spam]]
------------------------------
Message: 101
Date: Wed, 8 Jul 2009 17:03:58 -0400
From: Godmar Back <
godmar@...>
Subject: Re: [R] Unix commands on R
To: suman Duvvuru <
duvvuru.suman@...>
Cc:
r-help@...
Message-ID:
   <
719dced30907081403hb8d6411t12d8c6fe81a5fca8@...>
Content-Type: text/plain; charset=ISO-8859-1
?system
?shQuote
On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuru<
duvvuru.suman@...> wrote:
> I am using R on unix. While in R how do I execute the unix shell commands?
> Is there a way to do it? I am executing a function in R and the matrix
> resulting from the function has to be passed on as an input to unix command.
>
>
> Any directions will be helpful.
>
> Thanks,
> Suman
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
>
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: 102
Date: Wed, 08 Jul 2009 22:53:00 +0200
From: Emmanuel Charpentier <
emm.charpentier@...>
Subject: Re: [R] Unix commands on R
To:
r-help@...
Message-ID: <1247086380.4095.4.camel@PortableToshiba>
Content-Type: text/plain; charset="UTF-8"
Le mercredi 08 juillet 2009 ? 16:36 -0400, suman Duvvuru a ?crit :
> I am using R on unix. While in R how do I execute the unix shell commands?
> Is there a way to do it? I am executing a function in R and the matrix
> resulting from the function has to be passed on as an input to unix command.
>
>
> Any directions will be helpful.
?system
?capture
?textConnection
These three functions (I'm not sure bout the real name of the second)
should allow you to get the standard output of a Unix command line.
Consider also cpturing your command output in a file (reusable...).
HTH,
               Emmanuel Charpentier
------------------------------
Message: 103
Date: Wed, 08 Jul 2009 23:19:24 +0200
From: Uwe Ligges <
ligges@...>
Subject: Re: [R] system() how to make a program run a specific file -
   RUN and   Output directory issues
To: "Paulo E. Cardoso" <
pecardoso@...>
Cc:
r-help@...
Message-ID: <
4A550D5C.3000601@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Paulo E. Cardoso wrote:
> I have a particular case where the program I'm calling needs a additional
> instructions, to click a RUN button and set a output directory. Could these
> options be controlled with system() function?
system() just calls the program as started from the operating system's
command line (or under Windows without an underlying shell). That
implies that it cannot press buttons, you can "only" specify command
line flags, if the program you are talking about accepts these ...
Uwe Ligges
> ____________
> Paulo E. Cardoso
>
>
>> -----Mensagem original-----
>> De:
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
>
> ______________________________________________
>
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: 104
Date: Thu, 9 Jul 2009 09:23:55 +1200
From: Rolf Turner <
r.turner@...>
Subject: Re: [R] how to read point shp file to R?
To: Sunny <
sunshineabove@...>
Cc: "
r-help@..." <
r-help@...>
Message-ID: <
621EA85A-D683-4BED-BF86-D41C20111F90@...>
Content-Type: text/plain; charset="US-ASCII"; delsp=yes; format=flowed
On 8/07/2009, at 6:28 AM, Sunny wrote:
> I am new with R and want do some analysis with a point vector dataÂ
> file. Any
> help is appreciate. Sunny
See the vignette ``Handling shapefiles in the spatstat package'' fromÂ
the
spatstat package on CRAN.
   cheers,
      Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
------------------------------
Message: 105
Date: Wed, 8 Jul 2009 17:23:22 -0400
From: "Wouterse, Fleur \(IFPRI-Senegal\)" <
F.Wouterse@...>
Subject: [R] truncated regression out-of-sample predictions
To: <
r-help@...>
Message-ID: <5C41B489BDE4614A9FA014D690BEB03F0C3F9238@IFPRIE>
Content-Type: text/plain;Â Â Â charset="us-ascii"
Dear all,
I am trying to implement Simar & Wilson's (2007) second algorithm and
have the following question: If I use a truncated regression on the m<n
observations, how do I get fitted values for all n observations, instead
of for m observations, which is what the command fitted returns; I would
need these to construct the left-truncation needed to draw n random
deviates.
Thanks for your help,
Fleur
-----Original Message-----
From:
r-help-bounces@... [mailto:
r-help-bounces@...]
On Behalf Of Karina Boege
Sent: Wednesday, July 08, 2009 11:18 AM
To:
r-help@...
Subject: [R] bootstrapping error message "Error in t.star[r, ] <-
statistic(data, i[r, ], ...) : number of items to replace is not a
multiple of replacement length"
Hi,
I am trying to run some bootstraps with the boot package. When I run
it with 400 replicates it does it ok, but then I need to run the same
analysis but with 89, 86, 102 and 106 samples (for four different
environments), and then is when I get the error message:
> mybootstrap <- boot(Datos, mystat, 2000)
Error in t.star[r, ] <- statistic(data, i[r, ], ...) :Â number of
items to replace is not a multiple of replacement length
Anyone familiar with this error message?
Does anyone knows the minimum sample size for boot package to run
properly? Is there anyway to tell R how many samples should it pick
for the resampling?
If it helps, this is how my model looks like:
mymodel = lm(Datos[,4]~Datos[,1]+
Datos[,8]+Datos[,9]+Datos[,10]+Datos[,11]+Datos[,12])
summary(mymodel)
mystat <- function(a,b)
f<- lm(a[b,4]~a[b,1]+a[b,8]+ a[b,9]+a[b,10]+a[b,11]+a[b,12])$coef
mybootstrap <- boot(Datos, mystat, 2000)
INT1<-boot.ci(mybootstrap, conf=0.95, type="all", index=1)
INT2<-boot.ci(mybootstrap, conf=0.95, type="all", index=2)
INT3<-boot.ci(mybootstrap, conf=0.95, type="all", index=3)
INT4<-boot.ci(mybootstrap, conf=0.95, type="all", index=4)
INT5<-boot.ci(mybootstrap, conf=0.95, type="all", index=5)
INT6<-boot.ci(mybootstrap, conf=0.95, type="all", index=6)
INT7<-boot.ci(mybootstrap, conf=0.95, type="all", index=7)
Thanks for your help! I am new to bootstraps and to R, and I feel
pretty lonely with this
Karina Boege
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 106
Date: Wed, 8 Jul 2009 18:02:19 -0400
From: Harlan Harris <
harlan@...>
Subject: Re: [R] R2WinBUGS under Linux/WINE fails
To: Uwe Ligges <
ligges@...>
Cc:
r-help@...
Message-ID:
   <
924bb5e20907081502h15204f65y880bac0dfbccb556@...>
Content-Type: text/plain
Uwe, thanks for helping! After some poking around, I realized that the
problem was that I had installed OpenBUGS instead of WinBUGS. I did an
additional installation of WinBUGS, which also runs fine under Wine, and now
[[elided Yahoo spam]]
To clarify: both the OpenBUGS and WinBUGS distributions run nicely under
Linux/Wine. However, despite the fact that R2WinBUGS 2.1-14 claims (in
?bugs) it can run both OpenBUGS and WinBUGS, this does not seem to be true
under Linux/Wine. Only WinBUGS currently works with R2WinBUGS, at least for
me.
(I did figure out how to use CODA export from Win/OpenBUGS and the coda
package to import into R, but it's a bit tedious...)
-Harlan
   [[alternative HTML version deleted]]
------------------------------
Message: 107
Date: Thu, 09 Jul 2009 00:05:06 +0200
From: Uwe Ligges <
ligges@...>
Subject: Re: [R] R2WinBUGS under Linux/WINE fails
To: Harlan Harris <
harlan@...>
Cc:
r-help@...
Message-ID: <
4A551812.4040805@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Harlan Harris wrote:
> Uwe, thanks for helping! After some poking around, I realized that the
> problem was that I had installed OpenBUGS instead of WinBUGS. I did an
> additional installation of WinBUGS, which also runs fine under Wine, and now
[[elided Yahoo spam]]
>
> To clarify: both the OpenBUGS and WinBUGS distributions run nicely under
> Linux/Wine. However, despite the fact that R2WinBUGS 2.1-14 claims (in
> ?bugs) it can run both OpenBUGS and WinBUGS, this does not seem to be true
> under Linux/Wine. Only WinBUGS currently works with R2WinBUGS, at least for
> me.
This is because BRugs (the interface R2WinBUGS requires for OpenBUGS)
simply does not work under (most) non-Windows operating systems.
Best,
Uwe
>
> (I did figure out how to use CODA export from Win/OpenBUGS and the coda
> package to import into R, but it's a bit tedious...)
>
>Â -Harlan
>
------------------------------
Message: 108
Date: Thu, 09 Jul 2009 00:11:33 +0200
From: Uwe Ligges <
ligges@...>
Subject: Re: [R] \dQuote in packages
To: Rebecca Sela <
rsela@...>
Cc: r-help <
r-help@...>
Message-ID: <
4A551995.6050209@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
The difference you are experiencing is the new Rd2 parser that is more
picky now (but also prevents to produce wrong documentation files).
If you make the code of the Rd available, someone might be able to help.
[[elided Yahoo spam]]
Best,
Uwe Ligges
Rebecca Sela wrote:
> I am in the process of submitting a package to CRAN. R CMD check ran successfully on the package on my local computer, using R version 2.1.1. However, on the computers for CRAN (with version 2.10.0), the following errors occurred:
>
> Warning in parse_Rd("./man/predict.Rd", encoding = "unknown") :
>Â Â Â ./man/predict.Rd:28: unknown macro '\dquote'
> *** error on file ./man/predict.Rd
> Error : ./man/predict.Rd:28: Unrecognized macro \dquote
> Warning in parse_Rd("./man/print.Rd", encoding = "unknown") :
>Â Â Â ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects'
> Warning in parse_Rd("./man/simpleREEMdata.Rd", encoding = "unknown") :
>Â Â Â ./man/simpleREEMdata.Rd:10: unknown macro '\item'
>
> Are \dquote, \sideeffects, and \item not supported in newer versions of R? Is there some underlying problem that I should fix that makes these show up?
>
> Thank you very much.
>
> Rebecca
>
> ______________________________________________
>
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: 109
Date: Wed, 8 Jul 2009 14:00:48 -0600
From: Amy Wesolowski <
amywesolowski@...>
Subject: [R] R Help Question
To:
r-help@...
Message-ID:
   <
b4900de50907081300u511ea56ap8cb9854bf4757d41@...>
Content-Type: text/plain
Hi,
I am currently working on reading large files into R. My files are text
documents with four columns and around 10 million lines.
Each line is set up as:
string|integer|string|integer
I have been trying to use read.table to read in the file, but I think I am
reading too much into memory and the application quits.
I want to be able to analyze the entire text document at once.
I have thought about reading in the file, line by line, but I still want to
store all the information together. I have also thought about writing each
line of the file to a matrix, but I cannot seem to figure it out.
Any help would be great.
Thanks,
Amy
   [[alternative HTML version deleted]]
------------------------------
Message: 110
Date: Wed, 8 Jul 2009 14:47:46 -0700 (PDT)
Subject: [R] A Lattice Question
To:
r-help@...
Message-ID: <
823574.97362.qm@...>
Content-Type: text/plain; charset=us-ascii
To the Lattice expert -
I am new to the lattice package and I would like to add a curve to the
xyplot(). I know that I need to use panel function to add it. But it doesn't work. Is there anyone can help me out on how to transfer the data into the function?
The following is my code and I would like to add lines for xx,yy
xx <- seq(0,1,length = 100);
yy <- mean(PS$theta)*(1-exp(mean(PS$k)*xx))/(1-exp(mean(PS$k)))
ts1 <- xyplot(VCFB ~ Visit , groups = ID, data = CFB_M, type = c('g','l'),strip = strip.custom(style =4), as.table=TRUE,xlab = 'Time',ylab = 'FBG CFB',main = '3mg Change from Baseline FBG',panel=function (xx,yy,...) {
    panel.xyplot(...);
    panel.lines(xx,yy,...);});
Many thanks!!
Best,
Haoda
------------------------------
Message: 111
Date: Wed, 8 Jul 2009 13:46:49 -0600
From: Tracey Frescino <
tfrescino@...>
Subject: [R] subsetting a dataframe with a string logical expression
To:
r-help@...
Message-ID:
   <
OF31346BD4.37155435-ON872575ED.006AF407-872575ED.006CA858@...>
Content-Type: text/plain
Hi,
I am trying to subset a dataset based on a filter defined by a user...
I prompt the user for input.. resulting in a string logical expression
("X1 < 3").
I have tried using subset, but it is looking for a logical expression, not
a character string.
I keep getting the error:Â 'subset' must evaluate to logical.
Example:
x <- data.frame(matrix(1:15, nrow=5, ncol=3))
filter = "X1 < 3"
subset(x, filter)
Any ideas??
Thanks much,
Tracey
   [[alternative HTML version deleted]]
------------------------------
Message: 112
Date: Wed, 8 Jul 2009 13:25:22 -0700 (PDT)
From: Olivella <
olivella@...>
Subject: [R]Â Substituting numerical values using `apply'
To:
r-help@...
Message-ID: <
24398687.post@...>
Content-Type: text/plain; charset=us-ascii
Hello,
I wish to perform a substitution of certain numerical values in a data
matrix with the corresponding column name. For instance, if I have a data
matrix
V1Â V2Â V3
2Â Â 0Â Â 1
0Â Â 1Â Â 2
1Â Â 5Â Â 0
5Â Â 0Â Â 0
I want to substitute the `1' and the `2' for the corresponding column name,
and make everything else `NA' like this
V1Â Â V2Â Â V3
V1Â Â NAÂ Â V3
NAÂ Â V2Â Â V3
V1Â Â NAÂ Â NA
NAÂ Â NAÂ Â NA
I have done this using an explicit `for' loop, but it takes a really long
time to finish. Is there any way I can do this using `apply' or some form of
implicit looping?
Thank you for your help,
SO
--
View this message in context:
http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.htmlSent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 113
Date: Thu, 09 Jul 2009 08:38:53 +1200
From: Paul Murrell <
p.murrell@...>
Subject: Re: [R] Tex fonts in R plots
To: KARAVASILIS GEORGE <
gkaravas@...>
Cc: "
r-help@..." <
r-help@...>
Message-ID: <
4A5503DD.2020806@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi
KARAVASILIS GEORGE wrote:
> Hello, R users.
> I would like to display the font of Math Mode of MikTex 2.3, WinEdt 5.4
> in R plots, e.g. in xlab, ylab or legend.
> How can I do that?
> Thank you in advance.
See
http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html and
"Non-standard fonts in PostScript and PDF graphics" in
http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdfPaul
> ______________________________________________
>
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.
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul@...
http://www.stat.auckland.ac.nz/~paul/------------------------------
Message: 114
Date: Wed, 08 Jul 2009 22:53:00 +0200
From: Emmanuel Charpentier <
emm.charpentier@...>
Subject: Re: [R] Unix commands on R
To: suman Duvvuru <
duvvuru.suman@...>
Cc:
r-help@...
Message-ID: <1247086380.4095.4.camel@PortableToshiba>
Content-Type: text/plain; charset="UTF-8"
Le mercredi 08 juillet 2009 ? 16:36 -0400, suman Duvvuru a ?crit :
> I am using R on unix. While in R how do I execute the unix shell commands?
> Is there a way to do it? I am executing a function in R and the matrix
> resulting from the function has to be passed on as an input to unix command.
>
>
> Any directions will be helpful.
?system
?capture
?textConnection
These three functions (I'm not sure bout the real name of the second)
should allow you to get the standard output of a Unix command line.
Consider also cpturing your command output in a file (reusable...).
HTH,
               Emmanuel Charpentier
------------------------------
Message: 115
Date: Wed, 8 Jul 2009 17:05:37 -0400
From: Zhiliang Ma <
zhiliang.ma@...>
Subject: Re: [R] Unix commands on R
To: suman Duvvuru <
duvvuru.suman@...>
Cc:
r-help@...
Message-ID:
   <
b39377d10907081405h2624d5f0y4f0da23e7aa84d70@...>
Content-Type: text/plain; charset=ISO-8859-1
?system
On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuru<
duvvuru.suman@...> wrote:
> I am using R on unix. While in R how do I execute the unix shell commands?
> Is there a way to do it? I am executing a function in R and the matrix
> resulting from the function has to be passed on as an input to unix command.
>
>
> Any directions will be helpful.
>
> Thanks,
> Suman
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
>
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: 116
Date: Wed, 8 Jul 2009 17:25:25 -0400
From: Zhiliang Ma <
zhiliang.ma@...>
Subject: Re: [R] Two-way ANOVA gives different results using
   anova(lm())   than doing it by hand
To: Lars Bergemann <
lars.bergemann@...>
Cc:
r-help@...
Message-ID:
   <
b39377d10907081425j5f66c90dm84052d598313115c@...>
Content-Type: text/plain; charset=windows-1252
the following works. i don't exactly what happens here. I guess "lm"
might treat S1 and S2 as quantitative variables, not qualitative
variables.
cheers,
Zhiliang
S1 <- as.character(Data[,1])
S1 <- as.factor(S1)
S2 <- as.character(Data[,2])
S2 <- as.factor(S2)
data <- data.frame(S1=S1, S2=S2, ExM=Data[,4])
g <- lm(ExM ~ S1*S2, data)
anova(g)
Analysis of Variance Table
Response: ExM
       Df Sum Sq Mean Sq F value  Pr(>F)
S1Â Â Â Â Â 5 4.7454Â 0.9491Â 961.66 < 2..2e-16 ***
S2Â Â Â Â Â 5 4.9548Â 0.9910 1004.10 < 2.2e-16 ***
S1:S2Â Â Â 25 1.2993Â 0.0520Â Â Â 52.66 < 2..2e-16 ***
Residuals 180 0.1776Â 0.0010
---
Signif. codes:Â 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
On Wed, Jul 8, 2009 at 10:34 AM, Lars
Bergemann<
lars.bergemann@...> wrote:
>
> Hey!
>
>
>
> Could you please take a quick look at what I have done? Somehow I get wrong results using the anova(lm()) combination compared to doing a two way ANOVA by hand.
>
>
>
> Running:
>
>
>
> Data<-read.table("Data.txt");
> g<-lm(ExM~S1*S2,Data);
> anova(g);
>
>
>
> Gives:
>
>
>
> Analysis of Variance Table
>
> Response: ExM
> ? ? ? ? ? Df Sum Sq Mean Sq F value ? ?Pr(>F)
> S1 ? ? ? ? ?1 4.3679 ?4.3679 167.045 < 2.2e-16 ***
> S2 ? ? ? ? ?1 0.9427 ?0.9427 ?36.053 8.236e-09 ***
> S1:S2 ? ? ? 1 0.3231 ?0.3231 ?12.357 0.0005371 ***
> Residuals 212 5.5434 ?0.0261
>
>
> I compared it to the work done by hand, ie calculated all the different square sums using sum() and tapply().
>
> So I know that anova(lm()) gets the degrees of freedom equal two 1, 1, 1 and 212 when it should be 5, 5, 25 and 180. Also, the square sums are quite different ... I get 4.xx, 4.xx, 1.xx, 0.xx ... as you see, what anova(lm()) gets is different.
>
>
>
> The data: S1 has 6 levels, so has S2. On average, each cell has 6 values, most cells have actually 6 values, and there are two of each: 5, 7, 4, 8 - so average 6.
>
>
>
> Could you please help me, why it does not work with anova(lm())? I tried quite a few thinks found with Google, but it all gave me the same result as anova(lm()) ...
>
>
>
> Thanks a lot!
>
>
>
> Lars
>
> _________________________________________________________________
>
>
>
>
> ______________________________________________
>
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: 117
Date: Wed, 8 Jul 2009 15:38:53 -0700
From: "Guazzelli, Alex" <
alex.guazzelli@...>
Subject: [R] How to deploy statistical models built in R in real-time?
To:
r-help@...
Message-ID: <
125154AC-B7AB-4E8B-A4E2-5906A6C9494E@...>
Content-Type: text/plain
I am framing this as a question since I would like to know how folksÂ
are currently deploying the models they build in R. Say, you want toÂ
use the results of your model inside another application in real-timeÂ
or on-demand, how do you do it? How do you use the decisions you getÂ
back from your models?
As you may know, a PMML package is available for R that allows forÂ
many mining model to be exported into the Predictive Model MarkupÂ
Language. PMML is the standard way to represent models and can beÂ
exported from most statistical packages (including SPSS, SAS,Â
KNIME, ...). Once your model is represented as a PMML file, it canÂ
easily be moved around. PMML allows for true interoperability. We haveÂ
recently published an article about PMML on The R Journal. ItÂ
basically describes the PMML language and the package itself. If youÂ
are interested in finding out more about PMML and how to benefit fromÂ
this standard, please check the link below.
http://journal.r-project.org/2009-1/RJournal_2009-1_Guazzelli+et+al.pdfWe have also wrote a paper about open standards and cloud computingÂ
for the SIGKDD Explorations newsletter. In this paper, we describe theÂ
ADAPA Scoring Engine which executes PMML models and is available as aÂ
service on the Amazon Cloud. ADAPA can be used to deploy R models inÂ
real-time from anywhere in the world. I believe it represents aÂ
revolution in data mining since it allows for anyone that uses R toÂ
make effective use of predictive models at a cost of less than $1/hour.
http://www.zementis.com/docs/SIGKDD_ADAPA.pdfThanks!
Alex
   [[alternative HTML version deleted]]
------------------------------
Message: 118
Date: Wed, 8 Jul 2009 18:55:09 -0400
From: Farrel Buchinsky <
fjbuch@...>
Subject: [R] Getting value rather than formula in RGoogleDocs
To: Duncan Temple Lang <
duncan@...>, R
   <
r-help@...>
Message-ID:
   <
bd93cdad0907081555o3ab4e41cx58f1856d13055cd5@...>
Content-Type: text/plain
Is there an easy way to read the value of the cells rather than the formula?So
for instance in a cell whose value was created by simply using the value
from the cell immediately to the left in the Google spreadsheet I would
prefer to get the value rather than =RC[-1]
When one exports with Google Spreadsheets as a csv then that does not
happen.
I am using the following line of code in R
y2009<-sheetAsMatrix(ts2$y2009,header=TRUE, as.data.frame=TRUE, trim=TRUE)
Farrel Buchinsky
Google Voice Tel: (412) 567-7870
   [[alternative HTML version deleted]]
------------------------------
Message: 119
Date: Wed, 8 Jul 2009 19:15:03 -0400
From: Jorge Ivan Velez <
jorgeivanvelez@...>
Subject: Re: [R] Substituting numerical values using `apply'
To: Olivella <
olivella@...>
Cc:
r-help@...
Message-ID:
   <
317737de0907081615y3aeed029g2bedf81a9e5d2418@...>
Content-Type: text/plain
Dear Olivella,
Assuming that x is your data, here is one possible way to do what you want:
t(
   apply(x, 1, function(x){
             index <- x %in% c(1,2)
             x[index] <- cls[index]
             x[!index] <- NA
             x
             }
       )
 )
How big is the data you are dealing with?
HTH,
Jorge
On Wed, Jul 8, 2009 at 4:25 PM, Olivella <
olivella@...> wrote:
>
> Hello,
>
> I wish to perform a substitution of certain numerical values in a data
> matrix with the corresponding column name. For instance, if I have a data
> matrix
> V1Â V2Â V3
> 2Â Â 0Â Â 1
> 0Â Â 1Â Â 2
> 1Â Â 5Â Â 0
> 5Â Â 0Â Â 0
>
> I want to substitute the `1' and the `2' for the corresponding column name,
> and make everything else `NA' like this
> V1Â Â V2Â Â V3
> V1Â Â NAÂ Â V3
> NAÂ Â V2Â Â V3
> V1Â Â NAÂ Â NA
> NAÂ Â NAÂ Â NA
>
> I have done this using an explicit `for' loop, but it takes a really long
> time to finish. Is there any way I can do this using `apply' or some form
> of
> implicit looping?
>
> Thank you for your help,
>
> SO
> --
> View this message in context:
>
http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
>
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: 120
Date: Wed, 8 Jul 2009 19:18:08 -0400
From: Jorge Ivan Velez <
jorgeivanvelez@...>
Subject: Re: [R] Substituting numerical values using `apply'
To: Olivella <
olivella@...>
Cc:
r-help@...
Message-ID:
   <
317737de0907081618t753fa954r8c754de5558229fd@...>
Content-Type: text/plain
Arggghhhh! Forgot to add "cls" before the code. Here is the (hopefully)
complete version:
# column names
cls <- colnames(x)
# Transformation
res <- t(
     apply(x, 1, function(x){
           index <- x %in% c(1,2)
           x[index] <- cls[index]
           x[!index] <- NA
             x
                }
         )
       )
res
HTH,
Jorge
On Wed, Jul 8, 2009 at 7:15 PM, Jorge Ivan Velez
<
jorgeivanvelez@...>wrote:
> Dear Olivella,
> Assuming that x is your data, here is one possible way to do what you want:
>
> t(
>Â Â apply(x, 1, function(x){
>Â Â Â Â Â Â Â Â Â Â Â Â index <- x %in% c(1,2)
>Â Â Â Â Â Â Â Â Â Â Â Â x[index] <- cls[index]
>Â Â Â Â Â Â Â Â Â Â Â Â x[!index] <- NA
>Â Â Â Â Â Â Â Â Â Â Â Â x
>Â Â Â Â Â Â Â Â Â Â Â Â }
>Â Â Â Â Â Â )
>Â Â Â )
>
> How big is the data you are dealing with?
>
> HTH,
>
> Jorge
>
>
> On Wed, Jul 8, 2009 at 4:25 PM, Olivella <
olivella@...> wrote:
>
>>
>> Hello,
>>
>> I wish to perform a substitution of certain numerical values in a data
>> matrix with the corresponding column name. For instance, if I have a data
>> matrix
>> V1Â V2Â V3
>> 2Â Â 0Â Â 1
>> 0Â Â 1Â Â 2
>> 1Â Â 5Â Â 0
>> 5Â Â 0Â Â 0
>>
>> I want to substitute the `1' and the `2' for the corresponding column
>> name,
>> and make everything else `NA' like this
>> V1Â Â V2Â Â V3
>> V1Â Â NAÂ Â V3
>> NAÂ Â V2Â Â V3
>> V1Â Â NAÂ Â NA
>> NAÂ Â NAÂ Â NA
>>
>> I have done this using an explicit `for' loop, but it takes a really long
>> time to finish. Is there any way I can do this using `apply' or some form
>> of
>> implicit looping?
>>
>> Thank you for your help,
>>
>> SO
>> --
>> View this message in context:
>>
http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>>
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: 121
Date: Wed, 08 Jul 2009 16:35:52 -0700
From: Duncan Temple Lang <
duncan@...>
Subject: Re: [R] Getting value rather than formula in RGoogleDocs
To: Farrel Buchinsky <
fjbuch@...>
Cc: R <
r-help@...>
Message-ID: <
4A552D58.3060101@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Farrel Buchinsky wrote:
> Is there an easy way to read the value of the cells rather than the formula?So
> for instance in a cell whose value was created by simply using the value
> from the cell immediately to the left in the Google spreadsheet I would
> prefer to get the value rather than =RC[-1]
>
> When one exports with Google Spreadsheets as a csv then that does not
> happen.
>
> I am using the following line of code in R
> y2009<-sheetAsMatrix(ts2$y2009,header=TRUE, as.data.frame=TRUE, trim=TRUE)
>
When I create a sample spreadsheet with formulae in cells
and then retrieve it with RGoogleDocs, I get the values
not the formula. So I'll need a sample spreadsheet
from which you get the formula and not the value.
   D.
------------------------------
Message: 122
Date: Wed, 8 Jul 2009 20:37:30 -0300
From: Henrique Dallazuanna <
wwwhsd@...>
Subject: Re: [R] subsetting a dataframe with a string logical
   expression
To: Tracey Frescino <
tfrescino@...>
Cc:
r-help@...
Message-ID:
   <
da79af330907081637n224aacdax54524987028ada60@...>
Content-Type: text/plain
Try this:
subset(x, eval(parse(text=filter)))
On Wed, Jul 8, 2009 at 4:46 PM, Tracey Frescino <
tfrescino@...> wrote:
> Hi,
>
> I am trying to subset a dataset based on a filter defined by a user...
> I prompt the user for input.. resulting in a string logical expression
> ("X1 < 3").
>
> I have tried using subset, but it is looking for a logical expression, not
> a character string.
> I keep getting the error:Â 'subset' must evaluate to logical.
>
>
> Example:
> x <- data.frame(matrix(1:15, nrow=5, ncol=3))
> filter = "X1 < 3"
> subset(x, filter)
>
>
> Any ideas??
>
>
>
> Thanks much,
> Tracey
>
>Â Â Â Â [[alternative HTML version deleted]]
>
> ______________________________________________
>
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: 123
Date: Wed, 8 Jul 2009 16:50:02 -0700 (PDT)
From: Ben Bolker <
bolker@...>
Subject: Re: [R] nested model with random factors
To:
r-help@...
Message-ID: <
24401470.post@...>
Content-Type: text/plain; charset=us-ascii
Jeff DaCosta wrote:
>
> I am really having trouble with getting the right syntax for myÂ
> model. Here is a truncated version of my data:
>
>Â > data
>   Ind Treatment Order   Date    PC1
> 1 PER14    SC   3rd 4-May-09 0.5704611
> 2 PER14Â Â Â Â SHÂ Â Â 1st 26-Apr-09Â 0.5329025
> 3 PER14Â Â Â Â ACÂ Â Â 2nd 29-Apr-09Â 2.1392279
> 4 PER25Â Â Â Â SCÂ Â Â 2nd 29-Apr-09 -0.2083382
> 5 PER25    SH   3rd 3-May-09 3.7818356
> 6 PER25Â Â Â Â ACÂ Â Â 1st 26-Apr-09 -1.9689733
> 7 PER30Â Â Â Â SCÂ Â Â 1st 24-Apr-09 -0.1255970
> 8 PER30Â Â Â Â SHÂ Â Â 2nd 27-Apr-09Â 2.1474393
> 9 PER30Â Â Â Â ACÂ Â Â 3rd 30-Apr-09 -1.8683396
>
>Â > str(data)
> 'data.frame':   9 obs. of 5 variables:
>   $ Ind   : Factor w/ 3 levels "PER14","PER25",..: 1 1 1 2 2 2 3 3 3
>Â Â Â $ Treatment: Factor w/ 3 levels "AC","SC","SH": 2 3 1 2 3 1 2 3 1
>   $ Order  : Factor w/ 3 levels "1st","2nd","3rd": 3 1 2 2 3 1 1 2 3
>   $ Date    : Factor w/ 7 levels "24-Apr-09","26-Apr-09",..: 7 2 4 4Â
> 5 2 1 3 6
>   $ PC1   : num 0.57 0.533 2.139 -0.208 3.782 ...
>
>Â > factor(Order, ordered=TRUE)
> [1] 3rd 1st 2nd 2nd 3rd 1st 1st 2nd 3rd
> Levels: 1st < 2nd < 3rd
>
>Â > factor(Date,ordered=TRUE)
> [1] 4-May-09Â 26-Apr-09 29-Apr-09 29-Apr-09 3-May-09Â 26-Apr-09 24-
> Apr-09 27-Apr-09 30-Apr-09
> Levels: 24-Apr-09 < 26-Apr-09 < 27-Apr-09 < 29-Apr-09 < 3-May-09 < 30-
> Apr-09 < 4-May-09
>
> "Ind" are different individuals in the study, each of which receivedÂ
> three "Treatment"s (SC, SH, and AC). The "Order" (ordered=TRUE) inÂ
> which each individual received a treatment was systematicallyÂ
> shuffled in the study, and the "Date" (ordered=TRUE) is simply whenÂ
> each treatment was completed. The response variable are scores fromÂ
> a principal components analysis ("PC1").
>
> So I want to run a model where "PC1" is the response variable andÂ
> "Ind" is nested within "Treatment", and I also want to includeÂ
> "Order" and "Date" as random factors.
>
> I have been struggling to describe the model with aov, lm, lme, andÂ
> lmer, and don't think I'm getting the syntax right. Suggestions?
>
>
I suggest you forward to the r-sig-mixed-models list, where the
question is less likely to get lost in the noise.
A few other thoughts:
* "Order" might as well be treated as fixed, you probably won't be able to
get a reliable estimate of its associated variance.
* I'm not sure that you'll be able to make very much use of the ordering of
the factors (unless you want to be extreme and treat them as continuous
covariates, i.e. fit a linear trend) in the aov/lme/lmer world.
* I would think that
lmer(PC1 ~ Treatment*Order+(1|Ind)+(1|Date),data=data)
would be a good start.
Have you read Pinheiro and Bates 2000?
 Ben Bolker
--
View this message in context:
http://www.nabble.com/nested-model-with-random-factors-tp24398026p24401470.htmlSent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 124
Date: Wed, 8 Jul 2009 20:09:36 -0400
From: jim holtman <
jholtman@...>
Subject: Re: [R] R Help Question
To: Amy Wesolowski <
amywesolowski@...>
Cc:
r-help@...
Message-ID:
   <
644e1f320907081709h697c950epea4ab7a72d625569@...>
Content-Type: text/plain; charset=ISO-8859-1
How big is the entire text file? What is the length of an average
line? Have you tried to use 'scan' to read in the data? How much
memory do you have? Are you paging? Here was a quick test I did with
a file with about 5M lines (12|this is some text|12345|more test):
> system.time(x <- scan('/tempxx.txt', what=list(0,'',0,''), sep="|"))
Read 4460544 records
   user system elapsed
 50.70  1.04   54.16
>
> str(x)
List of 4
$ : num [1:4460544] 12 12 12 12 12 12 12 12 12 12 ...
$ : chr [1:4460544] "this is some text" "this is some text" "this is
some text" "this is some text" ...
$ : num [1:4460544] 12345 12345 12345 12345 12345 ...
$ : chr [1:4460544] "more test" "more test" "more test" "more test" ...
> object.size(x)
107053288 bytes
So some more details might help to evaluate what your problem is.
Took less than a minute to read it in.
On Wed, Jul 8, 2009 at 4:00 PM, Amy Wesolowski<
amywesolowski@...> wrote:
> Hi,
>
> I am currently working on reading large files into R. ?My files are text
> documents with four columns and around 10 million lines.
> Each line is set up as:
> string|integer|string|integer
>
> I have been trying to use read.table to read in the file, but I think I am
> reading too much into memory and the application quits.
>
> I want to be able to analyze the entire text document at once.
> I have thought about reading in the file, line by line, but I still want to
> store all the information together. ?I have also thought about writing each
> line of the file to a matrix, but I cannot seem to figure it out.
>
> Any help would be great.
> Thanks,
> Amy
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
>
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: 125
Date: Thu, 9 Jul 2009 10:14:09 +1000
From: Jason Lessels <
jlessels@...>
Subject: [R]Â tkrplot installation problems
To:
r-help@...
Message-ID:
   <
33666f7a0907081714k970d366tdc571ec641f9eb7c@...>
Content-Type: text/plain
Hello,
I'm running R 2.8.1 on Ubuntu Hardy. I'm trying to install tkrplot.
Using r-cran-tkrplot from the repository, I'm getting the following error:
> library(tkrplot)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class =
"tclObj") :
[tcl] version conflict for package "Tcl": have 8.5.0, need exactly 8.4.
Error in library(tkrplot) : .First.lib failed for 'tkrplot'
This tries to install tkrplot version 0.0.16
However, installing R2.8.1 from the repositories automatically installs
tcl8.5. In fact, if I try and remove tcl8.5 using synaptic, it also
removes R.
I also tried to install the package from source, both by using
install.packages as well as downloading source (tkrplot 0.0.18). This
fails to install.
Can someone please help. My ultimate objective is to use the
TeachingDemos package.
> sessionInfo()
R version 2.8.1 (2008-12-22)
i486-pc-linux-gnu
locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
attached base packages:
[1] tcltk stats graphics grDevices utils datasets methods
[8] base
Thanks.
Abhijit
A little late but i just installed it using
sudo apt-get r-cran-tkrplot
followed these instructions<
http://dreamlinuxforums.org/index.php/topic,4476.0.html>
on ubuntu 9.04 64bit
hope this helps
Jason
   [[alternative HTML version deleted]]
------------------------------
Message: 126
Date: Wed, 8 Jul 2009 17:34:46 -0700 (PDT)
Subject: [R] Best way to export values from a function?
To:
R-help@...
Message-ID: <
245063.84142.qm@...>
Content-Type: text/plain; charset=us-ascii
Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down.
I would like to know the best way to export several doubles from a function, where the doubles are not an array.Â
Here is a contrived function similar to my needs:
multipleoutput<-function(x)
{
   squared<-x^2
   cubed<-x^3
   exponentioal<-exp(x)
   factorialVal<-factorial(x)
  Â
}
Thanks again for all your help.
------------------------------
Message: 127
Date: Wed, 8 Jul 2009 20:50:14 -0400
From: jim holtman <
jholtman@...>
Subject: Re: [R] Best way to export values from a function?
Cc:
R-help@...
Message-ID:
   <
644e1f320907081750v91769cdwdc0579ee40bed1ea@...>
Content-Type: text/plain; charset=ISO-8859-1
You can return a list, vector, or any other object:Â The last value is
the return value unless you do an explicit return()
>
> Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down.
>
> I would like to know the best way to export several doubles from a function, where the doubles are not an array.
>
> Here is a contrived function similar to my needs:
>
> multipleoutput<-function(x)
> {
> ? ? ? ?squared<-x^2
> ? ? ? ?cubed<-x^3
> ? ? ? ?exponentioal<-exp(x)
> ? ? ? ?factorialVal<-factorial(x)
>
> }
>
> Thanks again for all your help.
>
> ______________________________________________
>
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: 128
Date: Wed, 08 Jul 2009 17:49:26 -0700
From: "Daniel Nordlund" <
djnordlund@...>
Subject: Re: [R] Best way to export values from a function?
To: <
R-help@...>
Message-ID: <40A72A4F582E48A5A8392DB60EAD9036@Aragorn>
Content-Type: text/plain; charset=us-ascii
> -----Original Message-----
> From:
r-help-bounces@...
> [mailto:
r-help-bounces@...] On Behalf Of Jason Rupert
> Sent: Wednesday, July 08, 2009 5:35 PM
> To:
R-help@...
> Subject: [R] Best way to export values from a function?
>
>
> Maybe there is a great website out there or white paper that
> discusses this but again my Google skills (or lack there of)
> let me down.
>
> I would like to know the best way to export several doubles
> from a function, where the doubles are not an array.Â
>
> Here is a contrived function similar to my needs:
>
> multipleoutput<-function(x)
> {
> Â Â Â squared<-x^2
> Â Â Â cubed<-x^3
> Â Â Â exponentioal<-exp(x)
> Â Â Â factorialVal<-factorial(x)
> Â Â Â
> }
>
I can't vouch for the best way, but here is one way, return a list of the
values
multipleoutput<-function(x)
{
   squared<-x^2
   cubed<-x^3
   exponential<-exp(x)
   factorialVal<-factorial(x)
   return(list(squared=squared, cubed=cubed, exponential=exponential,
factorialVal=factorialVal))
}
Hope this is helpful,
Dan
Daniel Nordlund
Bothell, WA USA
------------------------------
Message: 129
Date: Wed, 8 Jul 2009 17:55:30 -0700
From: Mark Knecht <
markknecht@...>
Subject: Re: [R] Best way to export values from a function?
Cc:
R-help@...
Message-ID:
   <
5bdc1c8b0907081755k7d42c45bv62b1843eb3b40d1c@...>
Content-Type: text/plain; charset=UTF-8
>
> Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down.
>
> I would like to know the best way to export several doubles from a function, where the doubles are not an array.
>
> Here is a contrived function similar to my needs:
>
> multipleoutput<-function(x)
> {
> ? ? ? ?squared<-x^2
> ? ? ? ?cubed<-x^3
> ? ? ? ?exponentioal<-exp(x)
> ? ? ? ?factorialVal<-factorial(x)
>
> }
>
> Thanks again for all your help.
>
> ______________________________________________
>
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.
>
I'm a newbie so mine;s probably not the best but it seems to work:
multipleoutput<-function(x)
{
   answer<- c(0,0,0,0)
   MyFuncNames <- c("Squared","Cubed","Exp","Fac")
   answer$squared<-x^2
   answer$cubed<-x^3
   answer$exponential<-exp(x)
   answer$factorial<-factorial(x)
   return(answer)
}
X = c(0,0,0,0)
X
mode(X)
names(X)
MyNames = c("Squared","Cubed","Exp","Fac")
MyNames
names(X) = MyNames
X <- multipleoutput(2)
X
class(X)
dim(X)
------------------------------
Message: 130
Date: Wed, 8 Jul 2009 20:57:33 -0400
From: Godmar Back <
godmar@...>
Subject: Re: [R] Best way to export values from a function?
Cc:
R-help@...
Message-ID:
   <
719dced30907081757q50639a96g915f6e88ecfb5343@...>
Content-Type: text/plain; charset=ISO-8859-1
>
> Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down.
Yeah, R is difficult to search for - I've had partial success with
rseek.org, though.
>
> I would like to know the best way to export several doubles from a function, where the doubles are not an array.
>
> Here is a contrived function similar to my needs:
>
> multipleoutput<-function(x)
> {
> ? ? ? ?squared<-x^2
> ? ? ? ?cubed<-x^3
> ? ? ? ?exponentioal<-exp(x)
> ? ? ? ?factorialVal<-factorial(x)
>
> }
You can always do:
> multipleoutput <- function (x) { return (c(square = x^2, cube = x^3, exp = exp(x))) }
But then you'd have to call it like so:
> mapply(multipleoutput, c(0,1,2))
     [,1]    [,2]    [,3]
square  0 1.000000 4.000000
cube   0 1.000000 8.000000
exp     1 2.718282 7.389056
If you call it like so:
> multipleoutput(c(0,1,2))
square1Â square2Â square3Â Â cube1Â Â cube2Â Â cube3Â Â Â Â exp1Â Â Â Â exp2
0.000000 1.000000 4.000000 0.000000 1.000000 8.000000 1.000000 2.718282
  exp3
7.389056
then R flattens the result. Weird.
- Godmar
------------------------------
Message: 131
Date: Thu, 9 Jul 2009 00:35:08 +0100
From: tzygmund mcfarlane <
tzygmund@...>
Subject: [R] Dantzig Selector
To:
r-help@...
Message-ID:
   <
9c0c14910907081635n1d7fddb2j9af2cae2c92b2680@...>
Content-Type: text/plain; charset=ISO-8859-1
Hi,
I was wondering if there was an R package or routines for the Dantzig
Selector (Candes & Tao, 2007). I know Emmanuel Candes has Matlab
routines to do this but I was wondering if someone had ported those to
R.
Thanks,
T
---Reference---
@article{candes2007dantzig,
 title={{The Dantzig selector: statistical estimation when p is much
larger than n}},
 author={Candes, E. and Tao, T.},
 journal={Annals of Statistics},
 volume={35},
 number={6},
 pages={2313--2351},
 year={2007},
 publisher={Hayward, Calif.[etc] Institute of Mathematical Statistics [etc]}
}
------------------------------
Message: 132
Date: Wed, 8 Jul 2009 19:28:46 -0500
From: Alfonso Rojas <
alf.roja@...>
Subject: [R] Picante package 0.7 on mac
To:
r-help@...
Message-ID: <
5FE3F8BA-CA1A-4032-97B3-6E310F33A82C@...>
Content-Type: text/plain; charset=US-ASCII; format=flowed
Hello,
I tried to run the package but it shows me the following error:
In addition: Warning message:
package 'picante' was built under R version 2.10.0
Error in library(picante) : .First.lib failed for 'picante'
What could I do to run picante in mac R version?
------------------------------
Message: 133
Date: Wed, 08 Jul 2009 19:19:23 -0600
From: Eric Vander Wal <
eric.vanderwal@...>
Subject: [R] Sampling a dataframe based on the length of a subset of
   observations within
To:
r-help@...
Message-ID: <
4A55459B.6000709@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Thank you in advance for your consideration.
I have a dataframe of 2000+ observations with repeated measures across
approximately 300 unique individuals An event either does or does not
happen
(1,0) and there is a suit of independent variables associated with the
event. A simplified representation follows:
my.df<-data.frame("id"=c("A","A","A","B","B","C","C","C", "C", "C"),
event=c(0,0,1,0,1,0,0,1,1, 0))
_id_Â _event_
AÂ Â Â Â 0
AÂ Â Â Â 0
AÂ Â Â Â 1
BÂ Â Â Â 0
BÂ Â Â Â 1
CÂ Â Â Â 0
CÂ Â Â Â 0
CÂ Â Â Â 1
CÂ Â Â Â 1
CÂ Â Â Â 0
I need to sample my.df to select the same number of observations with
event = 0 as event = 1 for each unique id.
I can reshape or tapply my.df to group id and determine what sample size
I need. my.df.cast=
library(reshape)
my.df.melt<-melt(my.df, id="id")
my.df.cast<-cast(my.df.melt, id~value, length, fill=0)
my.df.cast
     Event
_id_Â Â Â _0_Â Â Â _1_
AÂ Â Â Â 2Â Â Â Â *1*
BÂ Â Â Â 1Â Â Â Â *1*
CÂ Â Â Â 3Â Â Â Â *2*
Given the above dataframe I need to randomly select (sample) from my.df
*one* observation from my.df[my.df$id==A & my.df$event==0], *one* from
my.df[my.df$id==B & my.df$event==0], and* two* from my.df[my.df$id==C &
my.df$event==0] and then rbind them to my.df[my.df$event == 1].Â
However, it is impractical to individually code each case.
Alternatively if A in my.df matches A in my.df.cast then
sample(my.df[my.df$id == A & my.df$event == 0], size=my.df.cast[1,3],
replace=FALSE). I think I am close to a solution but I'm not sure how
to code it to run through the entire dataframe.
This is how my.new.df would look:
_id event_
AÂ Â Â Â 0
AÂ Â Â Â 1
BÂ Â Â Â 0
BÂ Â Â Â 1
CÂ Â Â Â 0
CÂ Â Â Â 0
CÂ Â Â Â 1
CÂ Â Â Â 1
Thank you kindly for your help,
Eric
--
Eric Vander Wal
Ph.D. Candidate
University of Saskatchewan,
Department of Biology,
112 Science Place,
Saskatoon, SK., S7N 5E2
"Pluralitas non est ponenda sine neccesitate"
------------------------------
Message: 134
Date: Wed, 8 Jul 2009 21:40:02 -0400 (EDT)
From: Rebecca Sela <
rsela@...>
Subject: Re: [R] \dQuote in packages
To: r-help <
r-help@...>
Message-ID:
   <
9720124.1919101247103602217.JavaMail.root@...>
Content-Type: text/plain; charset="utf-8"
That's good to know. I have attached three Rd files that gave errors (others gave identical errors). I would love to know what is wrong with them.
I'm using 2.1.1 because that is what is installed on the Linux computer I have access to. (I haven't bothered figuring out how to assemble a package in Windows.)
[[elided Yahoo spam]]
Rebecca
----- Original Message -----
From: "Uwe Ligges" <
ligges@...>
To: "Rebecca Sela" <
rsela@...>
Cc: "r-help" <
r-help@...>
Sent: Wednesday, July 8, 2009 6:11:33 PM GMT -05:00 US/Canada Eastern
Subject: Re: [R] \dQuote in packages
The difference you are experiencing is the new Rd2 parser that is more
picky now (but also prevents to produce wrong documentation files).
If you make the code of the Rd available, someone might be able to help.
[[elided Yahoo spam]]
Best,
Uwe Ligges
Rebecca Sela wrote:
> I am in the process of submitting a package to CRAN. R CMD check ran successfully on the package on my local computer, using R version 2.1.1. However, on the computers for CRAN (with version 2.10.0), the following errors occurred:
>
> Warning in parse_Rd("./man/predict.Rd", encoding = "unknown") :
>Â Â Â ./man/predict.Rd:28: unknown macro '\dquote'
> *** error on file ./man/predict.Rd
> Error : ./man/predict.Rd:28: Unrecognized macro \dquote
> Warning in parse_Rd("./man/print.Rd", encoding = "unknown") :
>Â Â Â ./man/print.Rd:17: unexpected UNKNOWN '\sideeffects'
> Warning in parse_Rd("./man/simpleREEMdata.Rd", encoding = "unknown") :
>Â Â Â ./man/simpleREEMdata.Rd:10: unknown macro '\item'
>
> Are \dquote, \sideeffects, and \item not supported in newer versions of R? Is there some underlying problem that I should fix that makes these show up?
>
> Thank you very much.
>
> Rebecca
>
> ______________________________________________
>
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: 135
Date: Thu, 09 Jul 2009 13:45:10 +1200
From:
p_connolly@...
Subject: [R] Mysteriously vanishing LD_LIBRARY_PATH
To:
r-help@...
Message-ID: <
20090709134510.wg4kcsoo88sggo8k@...>
Content-Type: text/plain; charset="UTF-8"
Using R-2.8.0 and R-2.8.1, I get behaviour like this:
R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
[....]
> Sys.getenv("LD_LIBRARY_PATH")
                                       Â
     LD_LIBRARY_PATH
"/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/home/hrapgc/Rstuff/library/asreml/libs"
> q()
Save workspace image? [y/n/c]: n
However:
R version 2.9.1 (2009-06-26)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
[...]
> Sys.getenv("LD_LIBRARY_PATH")
                           LD_LIBRARY_PATH
"/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2"
I'm particularly dismayed by the fact that there are now only three
parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of
/usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. Maybe that's a red
herring since the former is a link to the latter.
I would appreciate help getting the rest of LD_LIBRARY_PATH back. I
set it in ~/.bash_profile in case that makes a difference to the
possible cause of the phenomenon.
$ uname -r
2.6.18-92.1.22.el5
The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5.
TIA
--
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand
Ph: +64-9 925 7079
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it. ---Steven Wright
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
------------------------------
Message: 136
Date: Wed, 8 Jul 2009 19:23:09 -0700
From: Mark Knecht <
markknecht@...>
Subject: Re: [R] Best way to export values from a function?
Cc:
R-help@...
Message-ID:
   <
5bdc1c8b0907081923r248df0d9i8149393c2a3b5955@...>
Content-Type: text/plain; charset=UTF-8
On Wed, Jul 8, 2009 at 5:55 PM, Mark Knecht<
markknecht@...> wrote:
e:
>>
>> Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down.
>>
>> I would like to know the best way to export several doubles from a function, where the doubles are not an array.
>>
>> Here is a contrived function similar to my needs:
>>
>> multipleoutput<-function(x)
>> {
>> ? ? ? ?squared<-x^2
>> ? ? ? ?cubed<-x^3
>> ? ? ? ?exponentioal<-exp(x)
>> ? ? ? ?factorialVal<-factorial(x)
>>
>> }
>>
>> Thanks again for all your help.
>>
<SNIP>
This version runs a bit better than my last and I find it a bit more
readable, but there's a warning for whatever the first computation is
inside the function that I'd like to understand.
- Mark
multipleoutput <- function(x) {
   answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0)
   answer$Squ=x^2
   answer$Cub<-x^3
   answer$Exp<-exp(x)
   answer$Fac<-factorial(x)
   return(answer)
}
X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0)
X
mode(X)
names(X)
X[1,] <- multipleoutput(2)
X
class(X)
<PRODUCES>
> multipleoutput <- function(x) {
+ answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0)
+ answer$Squ=x^2
+ answer$Cub<-x^3
+ answer$Exp<-exp(x)
+ answer$Fac<-factorial(x)
+ return(answer)
+ }
>
> X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0)
> X
 Squared Cubed Exp Fac
1Â Â Â Â Â 0Â Â Â Â 0Â Â Â 0Â Â Â 0
> mode(X)
[1] "list"
> names(X)
[1] "Squared" "Cubed"Â Â Â "Exp"Â Â Â Â "Fac"
>
> X[1,] <- multipleoutput(2)
Warning message:
In answer$Squ = x^2 : Coercing LHS to a list
>
> X
 Squared Cubed   Exp Fac
1Â Â Â Â Â 4Â Â Â Â 8 7.389056Â Â Â 2
> class(X)
[1] "data.frame"
>
>
>
------------------------------
Message: 137
Date: Wed, 8 Jul 2009 22:29:48 -0400
From: Godmar Back <
godmar@...>
Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH
To:
p_connolly@...
Cc:
r-help@...
Message-ID:
   <
719dced30907081929t65503deal1240ee67893c2917@...>
Content-Type: text/plain; charset=ISO-8859-1
R respects LD_LIBRARY_PATH, see /usr/lib/R/etc/ldpaths where it
prepends its own path to any value in the environment when R is
invoked:
if test -z "${LD_LIBRARY_PATH}"; then
 LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
else
 LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
fi
export LD_LIBRARY_PATH
=====
Provide the output of
echo $LD_LIBRARY_PATH
or
env | grep LD_LIBRARY_PATH
to check that it's set correctly *BEFORE* you invoke R.
- Godmar
On Wed, Jul 8, 2009 at 9:45 PM, <
p_connolly@...> wrote:
> Using R-2.8.0 and R-2.8.1, I get behaviour like this:
>
> R version 2.8.0 (2008-10-20)
> Copyright (C) 2008 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> [....]
>
>> Sys.getenv("LD_LIBRARY_PATH")
>
> ? ? ? ? ?LD_LIBRARY_PATH
> "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/home/hrapgc/Rstuff/library/asreml/libs"
>> q()
> Save workspace image? [y/n/c]: n
>
>
> However:
>
> R version 2.9.1 (2009-06-26)
> Copyright (C) 2009 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> [...]
>
>> Sys.getenv("LD_LIBRARY_PATH")
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LD_LIBRARY_PATH
> "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2"
>
>
> I'm particularly dismayed by the fact that there are now only three
> parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of
> /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. ?Maybe that's a red
> herring since the former is a link to the latter.
>
> I would appreciate help getting the rest of LD_LIBRARY_PATH back. ?I
> set it in ~/.bash_profile in case that makes a difference to the
> possible cause of the phenomenon.
>
> $ uname -r
> 2.6.18-92.1.22.el5
>
> The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5.
>
> TIA
>
> --
> Patrick Connolly
> HortResearch
> Mt Albert
> Auckland
> New Zealand
> Ph: +64-9 925 7079
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
> I have the world`s largest collection of seashells. I keep it on all
> the beaches of the world ... Perhaps you`ve seen it. ?---Steven Wright
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
>
> ______________________________________________
>
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: 138
Date: Wed, 08 Jul 2009 21:40:58 -0500
From: Marc Schwartz <
marc_schwartz@...>
Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH
To:
p_connolly@...
Cc:
r-help@...
Message-ID: <
9965999A-7F52-4916-BD47-CD58C63F527E@...>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On Jul 8, 2009, at 8:45 PM,
p_connolly@... wrote:
> Using R-2.8.0 and R-2.8.1, I get behaviour like this:
>
> R version 2.8.0 (2008-10-20)
> Copyright (C) 2008 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> [....]
>
>> Sys.getenv("LD_LIBRARY_PATH")
>
>Â Â Â Â Â LD_LIBRARY_PATH
> "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/
> home/hrapgc/Rstuff/library/asreml/libs"
>> q()
> Save workspace image? [y/n/c]: n
>
>
> However:
>
> R version 2.9.1 (2009-06-26)
> Copyright (C) 2009 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> [...]
>
>> Sys.getenv("LD_LIBRARY_PATH")
>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â LD_LIBRARY_PATH
> "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2"
>
>
> I'm particularly dismayed by the fact that there are now only three
> parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of
> /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. Maybe that's a red
> herring since the former is a link to the latter.
>
> I would appreciate help getting the rest of LD_LIBRARY_PATH back. I
> set it in ~/.bash_profile in case that makes a difference to the
> possible cause of the phenomenon.
>
> $ uname -r
> 2.6.18-92.1.22.el5
>
> The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5.
>
> TIA
Patrick,
When I was using Fedora, several years ago I started to add any pathsÂ
that I needed for LD_LIBRARY_PATH into /etc/ld.so.conf. Then run 'sudoÂ
ldconfig' to update the configuration.
I got bit by the same issue that you are seeing when using RODBC withÂ
Oracle. I believe that it was Prof. Ripley who suggested that I useÂ
the above approach and did not have any problems after that.
HTH,
Marc Schwartz
------------------------------
Message: 139
Date: Thu, 09 Jul 2009 14:35:48 +1200
From:
p_connolly@...
Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH
To: Godmar Back <
godmar@...>
Cc:
r-help@...
Message-ID: <
20090709143548.s0gwk0kgwg444o0g@...>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Quoting Godmar Back <
godmar@...>:
> R respects LD_LIBRARY_PATH, see /usr/lib/R/etc/ldpaths where it
> prepends its own path to any value in the environment when R is
> invoked:
>
> if test -z "${LD_LIBRARY_PATH}"; then
>Â Â Â LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
> else
>Â Â Â LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
> fi
> export LD_LIBRARY_PATH
>
> =====
>
> Provide the output of
>
> echo $LD_LIBRARY_PATH
> or
> env | grep LD_LIBRARY_PATH
>
> to check that it's set correctly *BEFORE* you invoke R.
There's nothing there. However, you might have got me onto a
workaround. When
I see this:
$ diff /home/hrapgc/local/R-2.8.1/etc/ldpaths
/home/hrapgc/local/R-2.9.1/etc/ldpaths
2c2
< :
${R_JAVA_LD_LIBRARY_PATH=/usr/lib/gcj-4.1.2:/home/hrapgc/Rstuff/library/asreml/libs}
---
> : ${R_JAVA_LD_LIBRARY_PATH=/usr/lib/gcj-4.1.2}
I think a little editing job will do the trick. Presumably, that happened at
compilation time and something screwy is happening with CentOS which doesn't
happen with other OSs.
The gcj thing IS a red herring, can we assume?
Thanks
>
>Â - Godmar
>
> On Wed, Jul 8, 2009 at 9:45 PM, <
p_connolly@...> wrote:
>> Using R-2.8.0 and R-2.8.1, I get behaviour like this:
>>
>> R version 2.8.0 (2008-10-20)
>> Copyright (C) 2008 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>>
>> [....]
>>
>>> Sys.getenv("LD_LIBRARY_PATH")
>>
>> ? ? ? ? ?LD_LIBRARY_PATH
>> "/home/hrapgc/local/R-2.8.0/lib:/usr/local/lib:/usr/lib/gcj-4.1.1:/home/hrapgc/Rstuff/library/asreml/libs"
>>> q()
>> Save workspace image? [y/n/c]: n
>>
>>
>> However:
>>
>> R version 2.9.1 (2009-06-26)
>> Copyright (C) 2009 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>>
>> [...]
>>
>>> Sys.getenv("LD_LIBRARY_PATH")
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LD_LIBRARY_PATH
>> "/home/hrapgc/local/R-2.9.1/lib:/usr/local/lib:/usr/lib/gcj-4.1.2"
>>
>>
>> I'm particularly dismayed by the fact that there are now only three
>> parts to LD_LIBRARY_PATH, and slightly mystified by the appearance of
>> /usr/lib/gcj-4.1.2 in place of /usr/lib/gcj-4.1.1. ?Maybe that's a red
>> herring since the former is a link to the latter.
>>
>> I would appreciate help getting the rest of LD_LIBRARY_PATH back. ?I
>> set it in ~/.bash_profile in case that makes a difference to the
>> possible cause of the phenomenon.
>>
>> $ uname -r
>> 2.6.18-92.1.22.el5
>>
>> The problem doesn't seem to arise with Fedora 8 nor with Mepis 6.5.
>>
>> TIA
>>
>> --
>> Patrick Connolly
>> HortResearch
>> Mt Albert
>> Auckland
>> New Zealand
>> Ph: +64-9 925 7079
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
>> I have the world`s largest collection of seashells. I keep it on all
>> the beaches of the world ... Perhaps you`ve seen it. ?---Steven Wright
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
>>
>> ______________________________________________
>>
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: 140
Date: Wed, 8 Jul 2009 23:49:25 -0300
From: Henrique Dallazuanna <
wwwhsd@...>
Subject: Re: [R] Substituting numerical values using `apply'
To: Olivella <
olivella@...>
Cc:
r-help@...
Message-ID:
   <
da79af330907081949v12ab1bffjd014aea6c19d7800@...>
Content-Type: text/plain
Try this:
sapply(names(DF), function(n)ifelse(DF[,n] %in% c(1, 2), n, NA))
Where DF is your data.frame
On Wed, Jul 8, 2009 at 5:25 PM, Olivella <
olivella@...> wrote:
>
> Hello,
>
> I wish to perform a substitution of certain numerical values in a data
> matrix with the corresponding column name. For instance, if I have a data
> matrix
> V1Â V2Â V3
> 2Â Â 0Â Â 1
> 0Â Â 1Â Â 2
> 1Â Â 5Â Â 0
> 5Â Â 0Â Â 0
>
> I want to substitute the `1' and the `2' for the corresponding column name,
> and make everything else `NA' like this
> V1Â Â V2Â Â V3
> V1Â Â NAÂ Â V3
> NAÂ Â V2Â Â V3
> V1Â Â NAÂ Â NA
> NAÂ Â NAÂ Â NA
>
> I have done this using an explicit `for' loop, but it takes a really long
> time to finish. Is there any way I can do this using `apply' or some form
> of
> implicit looping?
>
> Thank you for your help,
>
> SO
> --
> View this message in context:
>
http://www.nabble.com/Substituting-numerical-values-using-%60apply%27-tp24398687p24398687.html> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
>
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: 141
Date: Wed, 08 Jul 2009 19:53:38 -0700
From: Duncan Temple Lang <
duncan@...>
Subject: Re: [R] Reading from Google Docs
To: Farrel Buchinsky <
fjbuch@...>
Cc: R <
r-help@...>, Duncan Murdoch
   <
murdoch@...>
Message-ID: <
4A555BB2.7020602@...>
Content-Type: text/plain; charset=windows-1252; format=flowed
Farrel Buchinsky wrote:
> ........
> Boy oh boy that process of getting source to binary was super painful. Now
> that I have the package as binary I can share the whole folder with my
> coworker and she is able to use RGoogleDocs. I intend to use the same
> process for the other two windows machines that I use. I really do not want
> to go through the same installation and path hassles all over again.
>
> Should I post my directory containing the binary files somewhere so that
> others do not have to experience pain. Does etiquette dictate that I should
> post the directory to help other or does etiquette dictate that it is Duncan
> Temple Lang's code and thus it his prerogative to distribute his work as he
> wishes?
Etiquette is one thing and the license another.
Both encourage you to help others and make the
binary available to others.
And indeed, I hope that Windows users do build binaries
for others and remove the additional work from those
who provide the software in the first place.
Having seen this thread today, I did put a binary
version of RGoogleDocs on the Omegahat repository
so
 install.packages("RGoogleDocs", repos = "
http://www.omegahat.org/R")
should install it and, if I had had time earlier, saved you the hardship
of building the binary. Sorry to do it so soon after.
 D.
>
> Farrel Buchinsky
> Google Voice Tel: (412) 567-7870
>
>
>
> On Wed, Jul 8, 2009 at 12:59, Farrel Buchinsky <
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.
>>>>
>>
>
> Â Â Â [[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: 142
Date: Wed, 8 Jul 2009 22:01:21 -0500
From: William Revelle <
lists@...>
Subject: Re: [R] Best way to export values from a function?
To: Mark Knecht <
markknecht@...>, Jason Rupert
Cc:
R-help@...
Message-ID: <p06240849c67b0d19191a@[10.0.1.200]>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
Mark and Jason,
At 7:23 PM -0700 7/8/09, Mark Knecht wrote:
>On Wed, Jul 8, 2009 at 5:55 PM, Mark Knecht<
markknecht@...> wrote:
>>Â On Wed, Jul 8, 2009 at 5:34 PM, Jason Rupert<
jasonkrupert@...> wrote:
>>>
>>>Â Maybe there is a great website out there or white paper that
>>>discusses this but again my Google skills (or lack there of) let
>>>me down.
>>>
>>>Â I would like to know the best way to export several doubles from
>>>a function, where the doubles are not an array.
>>>
>>>Â Here is a contrived function similar to my needs:
>>>
>>>Â multipleoutput<-function(x)
>>>Â {
>>>Â Â Â Â Â Â squared<-x^2
>>>Â Â Â Â Â Â cubed<-x^3
>>>Â Â Â Â Â Â exponentioal<-exp(x)
>>>Â Â Â Â Â Â factorialVal<-factorial(x)
>>>
>>>Â }
>>>
>>>Â Thanks again for all your help.
>>>
>
><SNIP>
>
>This version runs a bit better than my last and I find it a bit more
>readable, but there's a warning for whatever the first computation is
>inside the function that I'd like to understand.
>
>- Mark
>
>multipleoutput <- function(x) {
>Â Â Â answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0)
>Â Â Â answer$Squ=x^2
>Â Â Â answer$Cub<-x^3
>Â Â Â answer$Exp<-exp(x)
>Â Â Â answer$Fac<-factorial(x)
>Â Â Â return(answer)
>}
>
>X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0)
>X
>mode(X)
>names(X)
>
>X[1,] <- multipleoutput(2)
>
>X
>class(X)
>
><PRODUCES>
>
>>Â multipleoutput <- function(x) {
>+ answer = c("Squ"=0,"Cub"=0,"Exp"=0,"Fac"=0)
>+ answer$Squ=x^2
>+ answer$Cub<-x^3
>+ answer$Exp<-exp(x)
>+ answer$Fac<-factorial(x)
>+ return(answer)
>+ }
>>
>>Â X = data.frame("Squared"=0,"Cubed"=0,"Exp"=0,"Fac"=0)
>>Â X
>Â Â Â Squared Cubed Exp Fac
>1Â Â Â Â Â 0Â Â Â Â 0Â Â Â 0Â Â Â 0
>>Â mode(X)
>[1] "list"
>>Â names(X)
>[1] "Squared" "Cubed"Â Â Â "Exp"Â Â Â Â "Fac"
>>
>>Â X[1,] <- multipleoutput(2)
>Warning message:
>In answer$Squ = x^2 : Coercing LHS to a list
>>
>>Â X
>   Squared Cubed   Exp Fac
>1Â Â Â Â Â 4Â Â Â Â 8 7.389056Â Â Â 2
>>Â class(X)
>[1] "data.frame"
>Â >
?list
e.g.,
multipleoutput <- function(x) {
   answer = list()
   answer$Squ=x^2
   answer$Cub<-x^3
   answer$Exp<-exp(x)
   answer$Fac<-factorial(x)
   return(answer)
}
Bill
--
William Revelle     Â
http://personality-project.org/revelle.htmlProfessor        Â
http://personality-project.org/personality.htmlDepartment of Psychology       Â
http://www.wcas.northwestern.edu/psych/Northwestern University  Â
http://www.northwestern.edu/Attend ISSID/ARP:2009        Â
http://issid.org/issid.2009/------------------------------
Message: 143
Date: Wed, 8 Jul 2009 23:03:33 -0400
From: Steve Lianoglou <
mailinglist.honeypot@...>
Subject: Re: [R] Best way to export values from a function?
Cc:
R-help@...
Message-ID: <
75A74B02-5844-4E16-8BD7-CDA41CF8B1CC@...>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Hi,
On Jul 8, 2009, at 8:34 PM, Jason Rupert wrote:
>
> Maybe there is a great website out there or white paper thatÂ
> discusses this but again my Google skills (or lack there of) let meÂ
> down.
>
> I would like to know the best way to export several doubles from aÂ
> function, where the doubles are not an array.
>
> Here is a contrived function similar to my needs:
>
> multipleoutput<-function(x)
> {
> Â Â Â squared<-x^2
> Â Â Â cubed<-x^3
> Â Â Â exponentioal<-exp(x)
> Â Â Â factorialVal<-factorial(x)
> Â Â Â
> }
There already have been some suggestions on how to do this theÂ
"normal" R way, so let's go ahead and use the "return a list" methodÂ
(I think it's better than using the `c(squared=x^2, cubed=...)`).
Here's an interesting way to receive the assignments. Check out thisÂ
function:
http://code.google.com/p/miscell/source/browse/rvalues/rvalues.rWith that ':=' function loaded, you could do this:
============
multipleout <- function(x) {
   list(squared=x^2, cubed=x^3, exponential=exp(x),
    factorial=factorial(x))
}
c(sq,cu,ex,fa) := multipleout(1:3)
show(sq)
[1] 1 4 9
show(cu)
[1]Â 1Â 8 27
show(ex)
[1]Â 2.718282Â 7.389056 20.085537
show(fa)
[1] 1 2 6
=============
[I can't remember how I stumbled onto this code for the ':=' functionÂ
(I think it was from a thread on the BioC list about package updates)]
I'm not saying that you *should* do it this way, but it's kind of coolÂ
that you could ...
-steve
--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University
Contact Info:
http://cbio.mskcc.org/~lianos------------------------------
Message: 144
Date: Thu, 9 Jul 2009 03:07:35 +0000
From: wapita wapita <
wapita@...>
Subject: [R] change capital to small letters?
To: <
r-help@...>
Message-ID: <
BAY124-W16371BC0858BF601FF9130D5260@...>
Content-Type: text/plain
Hello R users,
I have a string of characters in capital letters and I need to convert it in small letters, is there an easy way to do it?
Thanks a lot
Wapita
_________________________________________________________________
Découvrez toutes les possibilités de communication avec vos proches
   [[alternative HTML version deleted]]
------------------------------
Message: 145
Date: Thu, 9 Jul 2009 03:10:24 +0000
From: wapita wapita <
wapita@...>
Subject: Re: [R] change capital to small letters?
To: <
r-help@...>
Message-ID: <
BAY124-W1635FE5AE9F5A651B630E8D5260@...>
Content-Type: text/plain
ok, find!
?toupper
?tolower
sorry!!! (but you have perhaps learned something...)
From:
wapita@...
To:
r-help@...
Subject: change capital to small letters?
Date: Thu, 9 Jul 2009 03:07:35 +0000
Hello R users,
I have a string of characters in capital letters and I need to convert it in small letters, is there an easy way to do it?
Thanks a lot
Wapita
Découvrez toutes les possibilités de communication avec vos proches
_________________________________________________________________
r ! Téléchargez-le maintenant !
   [[alternative HTML version deleted]]
------------------------------
Message: 146
Date: Wed, 8 Jul 2009 23:14:44 -0400
From: Gabor Grothendieck <
ggrothendieck@...>
Subject: Re: [R] R regular expression to extract words with the query
   string.
To:
praveen.surendran@...
Cc:
r-help@...
Message-ID:
   <
971536df0907082014j207545b3t993cb46356fdaec0@...>
Content-Type: text/plain; charset=ISO-8859-1
The solution below does not include the pid: string before it.
This modification works:
> strapply(i, paste("[^ ]*", "ENSP", "[^ ]*", sep = ""), c, simplify = unlist)
[1] "pid:ENSP000012345"
On Wed, Jul 8, 2009 at 10:08 AM, Gabor
Grothendieck<
ggrothendieck@...> wrote:
> Try this:
>
> library(gsubfn)
> i <- "transcript:ENST0000112334 pid:ENSP000012345"
> strapply(i, paste("\\w*", "ENSP", "\\w*", sep = ""), c, simplify = unlist)
>
> This says to match any number (possibly zero) of word
> characters followed by ENSP followed by more word
> characters. ?c just returns the match without
> further processing and unlist unlists the result giving
> a character vector (which otherwise would be a list).
>
> See
http://gsubfn.googlecode.com for more info.
>
> On Wed, Jul 8, 2009 at 9:04 AM, Praveen
> Surendran<
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: 147
Date: Wed, 8 Jul 2009 22:26:06 -0500
From: jlfmssm <
jlfmssm@...>
Subject: [R] splint
To:
r-help@...
Message-ID:
   <
40fab4d50907082026i4d1fd73cpd3742d4cf3f2874a@...>
Content-Type: text/plain
I am trying to understand idea for splint, but it use Fortran code.
Does anyone know how to see that Fortran code?
Is splint a not-knot spline method?
Thanks,
jfm
   [[alternative HTML version deleted]]
------------------------------
Message: 148
Date: Wed, 8 Jul 2009 23:45:06 -0400
From: Gabor Grothendieck <
ggrothendieck@...>
Subject: Re: [R] R Help Question
To: Amy Wesolowski <
amywesolowski@...>
Cc:
r-help@...
Message-ID:
   <
971536df0907082045l31da9e78m1b7adf2143be09dc@...>
Content-Type: text/plain; charset=ISO-8859-1
You could try something like this:
library(sqldf)
DF <- read.csv.sql("myfile.txt", sep = "|", header = FALSE)
or possibly this, which is the same except instead of
using an "in memory" database it uses an external database:
DF <- read.csv.sql("myfile.txt", sep = "|", header = FALSE, dbname = "temp.db")
In both cases it creates the database automatically and then destroys it
automatically.
You may need to adjust the arguments depending on what your data
looks like.
Since it does not use read.table underneath any limitations of
read.table would not apply.
You might want to test it out with the first few rows to get the
arguments right and then if it seems to work try it with the
full data.
On Wed, Jul 8, 2009 at 4:00 PM, Amy Wesolowski<
amywesolowski@...> wrote:
> Hi,
>
> I am currently working on reading large files into R. ?My files are text
> documents with four columns and around 10 million lines.
> Each line is set up as:
> string|integer|string|integer
>
> I have been trying to use read.table to read in the file, but I think I am
> reading too much into memory and the application quits.
>
> I want to be able to analyze the entire text document at once.
> I have thought about reading in the file, line by line, but I still want to
> store all the information together. ?I have also thought about writing each
> line of the file to a matrix, but I cannot seem to figure it out.
>
> Any help would be great.
> Thanks,
> Amy
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
>
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: 149
Date: Wed, 8 Jul 2009 23:56:31 -0400
From: Farrel Buchinsky <
fjbuch@...>
Subject: Re: [R] Reading from Google Docs
To: Duncan Temple Lang <
duncan@...>
Cc: R <
r-help@...>, Duncan Murdoch
   <
murdoch@...>
Message-ID:
   <
bd93cdad0907082056g6e7b156dn8a1e39bb7e3f2672@...>
Content-Type: text/plain
Dear Duncan
On my home computer I was able to use install.packages("RGoogleDocs", repos
= "
http://www.omegahat.org/R")
But, alas it would not read the data in the spreadsheet. It went back to its
nasty ways
Error in !includeEmpty : invalid argument type
That is what I was getting with version 0.2-1.You then sent me link to 0.2-2
(in source code) which is what worked.
Is it possible that that the windows binary version you put in omegahat was
0.2-1 and not 0.2-2?
I did not know how to tell what version had been installed.
Farrel Buchinsky
Google Voice Tel: (412) 567-7870
On Wed, Jul 8, 2009 at 22:53, Duncan Temple Lang <
duncan@...>wrote:
>
>
> Farrel Buchinsky wrote:
>
> > ........
>
>Â Boy oh boy that process of getting source to binary was super painful. Now
>> that I have the package as binary I can share the whole folder with my
>> coworker and she is able to use RGoogleDocs. I intend to use the same
>> process for the other two windows machines that I use. I really do not
>> want
>> to go through the same installation and path hassles all over again.
>>
>> Should I post my directory containing the binary files somewhere so that
>> others do not have to experience pain. Does etiquette dictate that I
>> should
>> post the directory to help other or does etiquette dictate that it is
>> Duncan
>> Temple Lang's code and thus it his prerogative to distribute his work as
>> he
>> wishes?
>>
>
> Etiquette is one thing and the license another.
> Both encourage you to help others and make the
> binary available to others.
> And indeed, I hope that Windows users do build binaries
> for others and remove the additional work from those
> who provide the software in the first place.
>
> Having seen this thread today, I did put a binary
> version of RGoogleDocs on the Omegahat repository
> so
>
>Â install.packages("RGoogleDocs", repos = "
http://www.omegahat.org/R")
>
> should install it and, if I had had time earlier, saved you the hardship
> of building the binary. Sorry to do it so soon after.
>
>Â D.
>
>
>
>
>
>> Farrel Buchinsky
>> Google Voice Tel: (412) 567-7870
>>
>>
>>
>> On Wed, Jul 8, 2009 at 12:59, Farrel Buchinsky <
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.
>>>>>
>>>>>
>>>
>>Â Â Â Â [[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: 150
Date: Thu, 9 Jul 2009 00:02:07 -0400
From: Patrick Gedeon <
patgpgh@...>
Subject: [R] Save rgl plot3d Graph as Image
To:
r-help@...
Message-ID:
   <
b30b4cdb0907082102u4f1a93d3p9345e559e3b56650@...>
Content-Type: text/plain
Dear Users:
I wish to save 3d scatter plots I have generated using the plot3d command in
the rgl package. Any image format such as .tiff would work. Can anyone tell
me how to do this?
Thank you
   [[alternative HTML version deleted]]
------------------------------
Message: 151
Date: Wed, 8 Jul 2009 23:24:39 -0500
From: "Victor Manuel Garcia Guerrero" <
vmgarcia@...>
Subject: [R] Population pyramids
To: <
r-help@...>
Message-ID: <
E44DCE2AED950F4F8A7A1532A0C3011801E70E66@...>
Content-Type: text/plain;Â Â Â charset="iso-8859-1"
Hi, I hope somebody can help me with this issue: I am doing population pyramids using the barplot command, so in the left side I have male age structure and in the right side the female age structure. To plot the male age structure I put the data in negative numbers. Now, I want to change the sign in the bar plot in such way that I have no-sign numbers, both in left and right side of the graph. I have been trying all day long and I could not succed.
Thanks...
Victor
------------------------------
Message: 152
Date: Thu, 9 Jul 2009 00:32:31 -0400
From: Jorge Ivan Velez <
jorgeivanvelez@...>
Subject: Re: [R] Population pyramids
To: Victor Manuel Garcia Guerrero <
vmgarcia@...>
Cc:
r-help@...
Message-ID:
   <
317737de0907082132q4dcce37fwdcc3f67c1a5c7730@...>
Content-Type: text/plain
Hi Victor,
See
http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot.html<
http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot..html>
HTH,
Jorge
On Thu, Jul 9, 2009 at 12:24 AM, Victor Manuel Garcia Guerrero <
vmgarcia@...> wrote:
> Hi, I hope somebody can help me with this issue: I am doing population
> pyramids using the barplot command, so in the left side I have male age
> structure and in the right side the female age structure. To plot the male
> age structure I put the data in negative numbers. Now, I want to change the
> sign in the bar plot in such way that I have no-sign numbers, both in left
> and right side of the graph. I have been trying all day long and I could not
> succed.
>
> Thanks...
>
> Victor
>
> ______________________________________________
>
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: 153
Date: Thu, 9 Jul 2009 00:36:59 -0400
From: "Daniel Malter" <
daniel@...>
Subject: Re: [R] Population pyramids
To: "'Victor Manuel Garcia Guerrero'" <
vmgarcia@...>,
   <
r-help@...>
Message-ID: <
200907090436.AMB81806@...>
Content-Type: text/plain;Â Â Â charset="iso-8859-1"
have you tried the pyramid function in the epicalc package?
best,
daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von:
r-help-bounces@... [mailto:
r-help-bounces@...] Im
Auftrag von Victor Manuel Garcia Guerrero
Gesendet: Thursday, July 09, 2009 12:25 AM
An:
r-help@...
Betreff: [R] Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population
pyramids using the barplot command, so in the left side I have male age
structure and in the right side the female age structure. To plot the male
age structure I put the data in negative numbers. Now, I want to change the
sign in the bar plot in such way that I have no-sign numbers, both in left
and right side of the graph. I have been trying all day long and I could not
succed.
Thanks...
Victor
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 154
Date: Wed, 8 Jul 2009 23:44:46 -0500
From: "Victor Manuel Garcia Guerrero" <
vmgarcia@...>
Subject: Re: [R] Population pyramids
To: "Jorge Ivan Velez" <
jorgeivanvelez@...>
Cc:
r-help@...
Message-ID: <
E44DCE2AED950F4F8A7A1532A0C3011801E70E67@...>
Content-Type: text/plain;Â Â Â charset="iso-8859-1"
Thanks Jorge, this is a very good library, but I have been trying with barplot because I am doing population pyramids with confidence intervals. So, the pyramid function does not work with more than two colum matrix.
-----Mensaje original-----
De: Jorge Ivan Velez [mailto:
jorgeivanvelez@...]
Enviado el: mi? 08/07/2009 11:32
Para: Victor Manuel Garcia Guerrero
CC:
r-help@...
Asunto: Re: [R] Population pyramids
Hi Victor,
See
http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot.html<
http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/pyramid.plot..html>
HTH,
Jorge
On Thu, Jul 9, 2009 at 12:24 AM, Victor Manuel Garcia Guerrero <
vmgarcia@...> wrote:
> Hi, I hope somebody can help me with this issue: I am doing population
> pyramids using the barplot command, so in the left side I have male age
> structure and in the right side the female age structure. To plot the male
> age structure I put the data in negative numbers. Now, I want to change the
> sign in the bar plot in such way that I have no-sign numbers, both in left
> and right side of the graph. I have been trying all day long and I could not
> succed.
>
> Thanks...
>
> Victor
>
> ______________________________________________
>
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: 155
Date: Thu, 9 Jul 2009 12:20:18 +1000
From: "Nathan S. Watson-Haigh" <
nathan.watson-haigh@...>
Subject: [R] Converting indices of a matrix subset
To: "
r-help@..." <
r-help@...>
Message-ID: <
4A5553E2.4010208@...>
Content-Type: text/plain; charset="ISO-8859-1"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have two matrices:
> m1 <- matrix(1,4,4)
> m1
    [,1] [,2] [,3] [,4]
[1,]Â Â 1Â Â 1Â Â 1Â Â 1
[2,]Â Â 1Â Â 1Â Â 1Â Â 1
[3,]Â Â 1Â Â 1Â Â 1Â Â 1
[4,]Â Â 1Â Â 1Â Â 1Â Â 1
> m2 <- matrix(0,3,3)
> diag(m2) <- 1
> m2
    [,1] [,2] [,3]
[1,]Â Â 1Â Â 0Â Â 0
[2,]Â Â 0Â Â 1Â Â 0
[3,]Â Â 0Â Â 0Â Â 1
I want to get indicies from m2 such that they match indicies as though they came
from the lower right of m1. Here's how things work:
> ind1 <- which(m1 == 1)
> ind1
[1]Â 1Â 2Â 3Â 4Â 5Â 6Â 7Â 8Â 9 10 11 12 13 14 15 16
> ind2 <- which(m2 == 1)
> ind2
[1] 1 5 9
I would like ind2 to be offset so they look like indicies from the lower right
of m1:
> ind2
[1] 6 11 16
I can be done with a simple offset when using arr.ind=TRUE:
> ind2 <- which(m2 == 1, arr.ind=T) + 1
> ind2
    row col
[1,]Â Â Â 2Â Â Â 2
[2,]Â Â Â 3Â Â Â 3
[3,]Â Â Â 4Â Â Â 4
But I don't want to use this, as I eventually want to be able to do things like:
> m1[-c(ind2)] <- 0
> m1
    [,1] [,2] [,3] [,4]
[1,]Â Â 0Â Â 0Â Â 0Â Â 0
[2,]Â Â 0Â Â 1Â Â 0Â Â 0
[3,]Â Â 0Â Â 0Â Â 1Â Â 0
[4,]Â Â 0Â Â 0Â Â 0Â Â 1
Any thoughts?
Cheers,
Nathan
- --
- --------------------------------------------------------
Dr. Nathan S. Watson-Haigh
OCE Post Doctoral Fellow
CSIRO Livestock Industries
Queensland Bioscience Precinct
St Lucia, QLD 4067
Australia
Tel: +61 (0)7 3214 2922
Fax: +61 (0)7 3214 2900
Web:
http://www.csiro.au/people/Nathan.Watson-Haigh.html- --------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.orgiEYEARECAAYFAkpVU+IACgkQ9gTv6QYzVL7ClgCgtFyeyZmPyyAQbgOWSjOKEGE0
LokAoLHc08EdpgE9jZ0k4D6TWR4tzzsn
=e5pD
-----END PGP SIGNATURE-----
------------------------------
Message: 156
Date: Wed, 8 Jul 2009 23:48:05 -0500
From: "Victor Manuel Garcia Guerrero" <
vmgarcia@...>
Subject: Re: [R] Population pyramids
To: "Daniel Malter" <
daniel@...>, <
r-help@...>
Message-ID: <
E44DCE2AED950F4F8A7A1532A0C3011801E70E68@...>
Content-Type: text/plain;Â Â Â charset="iso-8859-1"
Yes, but my issue is because I need to plot a pop pyramid with confidence intervals, and the pyramid function does not work in that way. Thanks Daniel..
-----Mensaje original-----
De: Daniel Malter [mailto:
daniel@...]
Enviado el: mi? 08/07/2009 11:36
Para: Victor Manuel Garcia Guerrero;
r-help@...
Asunto: AW: [R] Population pyramids
have you tried the pyramid function in the epicalc package?
best,
daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von:
r-help-bounces@... [mailto:
r-help-bounces@...] Im
Auftrag von Victor Manuel Garcia Guerrero
Gesendet: Thursday, July 09, 2009 12:25 AM
An:
r-help@...
Betreff: [R] Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population
pyramids using the barplot command, so in the left side I have male age
structure and in the right side the female age structure. To plot the male
age structure I put the data in negative numbers. Now, I want to change the
sign in the bar plot in such way that I have no-sign numbers, both in left
and right side of the graph. I have been trying all day long and I could not
succed.
Thanks...
Victor
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 157
Date: Thu, 9 Jul 2009 01:15:29 -0400
From: "Daniel Malter" <
daniel@...>
Subject: Re: [R] Population pyramids
To: "'Victor Manuel Garcia Guerrero'" <
vmgarcia@...>,
   <
r-help@...>
Message-ID: <
200907090515.AMB82591@...>
Content-Type: text/plain;Â Â Â charset="iso-8859-1"
Can you provide a self-contained example of what you did so far (i.e. code
for simulating some data and code for the plot)? That would greatly help to
help you find a solution.
Daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von: Victor Manuel Garcia Guerrero [mailto:
vmgarcia@...]
Gesendet: Thursday, July 09, 2009 12:48 AM
An: Daniel Malter;
r-help@...
Betreff: RE: [R] Population pyramids
Yes, but my issue is because I need to plot a pop pyramid with confidence
intervals, and the pyramid function does not work in that way. Thanks
Daniel.
-----Mensaje original-----
De: Daniel Malter [mailto:
daniel@...] Enviado el: mi? 08/07/2009 11:36
Para: Victor Manuel Garcia Guerrero;
r-help@...
Asunto: AW: [R] Population pyramids
have you tried the pyramid function in the epicalc package?
best,
daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von:
r-help-bounces@... [mailto:
r-help-bounces@...] Im
Auftrag von Victor Manuel Garcia Guerrero
Gesendet: Thursday, July 09, 2009 12:25 AM
An:
r-help@...
Betreff: [R] Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population
pyramids using the barplot command, so in the left side I have male age
structure and in the right side the female age structure. To plot the male
age structure I put the data in negative numbers. Now, I want to change the
sign in the bar plot in such way that I have no-sign numbers, both in left
and right side of the graph. I have been trying all day long and I could not
succed.
Thanks...
Victor
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 158
Date: Thu, 9 Jul 2009 08:18:44 +0300
From: Lauri Nikkinen <
lauri.nikkinen@...>
Subject: Re: [R] RDCOMClient: how to close Excel process?
To: Henrique Dallazuanna <
wwwhsd@...>
Cc:
r-help@...
Message-ID:
   <
ba8c09910907082218g5640f402o2094a5e8722806e2@...>
Content-Type: text/plain; charset=windows-1252
Thanks again. That did not work either. I get
> library(RDCOMClient)
> xl <- COMCreate("Excel.Application")
> wk <- xl$Workbooks()
> sh <- wk$Open(normalizePath("sample_file.xls"))$Sheets()$Count()
>
> wk$Close()
[1] TRUE
> xl$Quit()
NULL
>
and there is still Excel process open in the Task manager (and
sample_file.xls won't open).
-L
2009/7/8 Henrique Dallazuanna <
wwwhsd@...>:
> 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
>
------------------------------
Message: 159
Date: Thu, 9 Jul 2009 00:43:32 -0500
From: "Victor Manuel Garcia Guerrero" <
vmgarcia@...>
Subject: Re: [R] Population pyramids
To: "Daniel Malter" <
daniel@...>, <
r-help@...>
Message-ID: <
E44DCE2AED950F4F8A7A1532A0C3011801E70E69@...>
Content-Type: text/plain;Â Â Â charset="iso-8859-1"
Yes the code is the next:
par(mfrow=c(1,2),bty="n",mai=c(0.5, 0.25, 0.25, 0.25))
barplot(height=t(icNM2005.dat), width = 0.825, space = NULL,
    names.arg = NULL, legend.text = NULL, beside = FALSE,
    horiz = TRUE, density = NULL, angle = 0,
    col = c("yellow","Blue","orange"), border = par("fg"),
    main = "Hombres",
    xlim =NULL, ylim = NULL, xpd = TRUE, log = "",
    axes = FALSE, axisnames = FALSE,cex.axis=0.75)
    axis(1,pretty(c(-1200,0),n=12),
    hadj=NA,padj=NA,cex.axis=0.75,las=2)
barplot(height=t(icNF2005.dat), width = 0.825, space = NULL,
    names.arg = NULL, legend.text = c("Inf 95%","Mediana","Sup 95%"),
    beside = FALSE,
    horiz = TRUE, density = NULL, angle = 0,
    col = c("yellow","Blue","orange"), border = par("fg"),
    main = "Mujeres",
    xlim =NULL, ylim = NULL, xpd = TRUE, log = "",
    axes = FALSE, axisnames = FALSE,cex.axis=0.75)
    axis(2,pretty(c(0:105),n=21),hadj=0.5,padj=0.5,cex.axis=0.75,
    las=2)
    axis(1,pretty(c(0:1200),n=5),
    hadj=NA,padj=NA,cex.axis=0.5,las=1)
   Â
V?ctor Manuel Garc?a Guerrero
Doctorado en Estudios de Poblaci?n,
CEDUA, COLMEX
Camino al Ajusco N? 20, Pedregal de Sta. Teresa
C.P.10740, Tlalpan, M?xico, D.F.
* :
vmgarcia@...
( : 5617-9016
-----Mensaje original-----
De: Daniel Malter [mailto:
daniel@...]
Enviado el: jue 09/07/2009 12:15
Para: Victor Manuel Garcia Guerrero;
r-help@...
Asunto: AW: [R] Population pyramids
Can you provide a self-contained example of what you did so far (i.e. code
for simulating some data and code for the plot)? That would greatly help to
help you find a solution.
Daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von: Victor Manuel Garcia Guerrero [mailto:
vmgarcia@...]
Gesendet: Thursday, July 09, 2009 12:48 AM
An: Daniel Malter;
r-help@...
Betreff: RE: [R] Population pyramids
Yes, but my issue is because I need to plot a pop pyramid with confidence
intervals, and the pyramid function does not work in that way. Thanks
Daniel.
-----Mensaje original-----
De: Daniel Malter [mailto:
daniel@...] Enviado el: mi? 08/07/2009 11:36
Para: Victor Manuel Garcia Guerrero;
r-help@...
Asunto: AW: [R] Population pyramids
have you tried the pyramid function in the epicalc package?
best,
daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von:
r-help-bounces@... [mailto:
r-help-bounces@...] Im
Auftrag von Victor Manuel Garcia Guerrero
Gesendet: Thursday, July 09, 2009 12:25 AM
An:
r-help@...
Betreff: [R] Population pyramids
Hi, I hope somebody can help me with this issue: I am doing population
pyramids using the barplot command, so in the left side I have male age
structure and in the right side the female age structure. To plot the male
age structure I put the data in negative numbers. Now, I want to change the
sign in the bar plot in such way that I have no-sign numbers, both in left
and right side of the graph. I have been trying all day long and I could not
succed.
Thanks...
Victor
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 160
Date: Thu, 09 Jul 2009 11:46:27 +0530
From: utkarshsinghal <
utkarsh.singhal@...>
Subject: Re: [R] bigglm() results different from glm()+Another
   question
To: Greg Snow <
Greg.Snow@...>
Cc: r help <
r-help@...>, Thomas Lumley
   <
tlumley@...>
Message-ID: <
4A558B3B.9020201@...>
Content-Type: text/plain
That was definitely helpful.
"if you change your seq to: seq(chunksize, 10000-chunksize, chunksize)
then you won't get the error messages"
Even previously, I was not getting any error messages or warnings at
all, i.e., "update" removes the extra NA rows silently, for example:
set.seed(1)
xx = data.frame(x1=runif(10000,0,10), x2=runif(10000,0,10),
x3=runif(10000,0,10))
xx$y = 3 + xx$x1 + 2*xx$x2 + 3*xx$x3 + rnorm(10000)
fit1 = biglm(y~x1+x2+x3, data=xx[1:7000,])
fit2 = update(fit1, moredata=xx[7001:10000,])
fit3 = update(fit2, moredata=xx[7001:14000,])
Here fit2 and fit3 are exactly same.
Also if the number of rows is not a multiple of chunksize then your
sequence will not accommodate the last small chunk of data .
Regards
Utkarsh
Greg Snow wrote:
>
> OK, it appears that the problem is the df.resid component of the biglm
> object. Everything else is being updated by the update function
> except the df.resid piece, so it is based solely on the initial fit
> and the chunksize used there. The df.resid piece is then used in the
> computation of the AIC and hence the differences that you see. There
> could also be a difference in the p-values and confidence intervals,
> but at those high of numbers, the differences are smaller than can be
> seen at the level of rounding done.
>
>Â
>
> This appears to be a bug/overlooked piece to me, Thomas is cc'd on
> this so he should be able to fix this.
>
>Â
>
> A work around in the meantime is to do something like:
>
> > fit$df.resid <- 10000-4
>
>Â
>
> Then compute the AIC.
>
>Â
>
> Also as an aside, if you change your seq to: seq(chunksize,
> 10000-chunksize, chunksize) then you won't get the error messages.
>
>Â
>
> Hope this helps,
>
>Â
>
> --
>
> Gregory (Greg) L. Snow Ph.D.
>
> Statistical Data Center
>
> Intermountain Healthcare
>
>
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 20000^th value, the other
>Â Â Â Â chunksizes will use less of the data.
>
> Understood your point and apologize that you had to spend time going
> into the logic inside for loop. I definitely thought of that but my
> actual problem was the variation in AICs (which I was sure about), so
> to ignore this loop problem (temporarily), I deliberately chose the
> chunksizes such that the number of rows is a multiple of chunksize. I
> knew there is still one extra iteration happening and I checked that
> it was not causing any problem, the "moredata" in the last iteration
> will be all NA's and "update" does nothing in such a case.
>
> For example:
> Let's say chunksize=5000, even though "xx" has only 10000 rows, "fit2"
> and "fit3" below are exactly same.
>
> fit1 = biglm(y~x1+x2+x3, data=xx[1:5000,])
> fit2 = update(fit1, moredata=xx[5001:10000,])
> fit3 = update(fit2, moredata=xx[10001:15000,])
> AIC(fit1); AIC(fit2); AIC(fit3)
> [1] 5018.282
> [1] 19956.91
> [1] 19956.91
>
> (The AIC matches with the table above and no warnings at all)
>
> I checked all these things before sending my first mail and dropped
> the idea of refining the for loop as this will save me a few lines of
> code and also the loop looks good and easy to understand. Moreover it
> is neither taking any extra run time nor producing any warnings or errors..
>
>
>Â
>
> Also looking at the help for update.biglm, the 2^nd argument is
> "moredata" not "data", so if the code below is the code that you
> actually ran, then the new data chunks are going into the "..."
> argument (and being ignored as that is there for future expansion and
> does nothing yet) and the "moredata" argument is left empty, which
> should also be giving an error. For the code below, the model is only
> being fit to the initial chunk and never updated, so with different
> chunk sizes, there is different amounts of data per model. You can
> check this by doing summary(fit) and looking at the sample size in the
> 2^nd line.
>
> My fault in writing the mail. In the actual code, I gave "update(fit,
> xx[(i+1):(i+chunksize),])" ,i.e., I just passed the new chunk as the
> 2nd argument without mentioning the argument name, which is correct,
> but while writing the mail I added the argument name as "data" without
> checking what it is.
>
>
>Â
>
> It is easier for us to help you if you provide code that can be run by
> copying and pasting (we don't have xx, so we can't just run the code
> below, you could include a line to randomly generate an xx, or a link
> to where a copy of xx can be downloaded from). It also helps if you
> mention any errors or warnings that you receive in the process of
> running your code.
>
>Â
>
> Hope this helps,
>
>Â
>
> --
>
> Gregory (Greg) L. Snow Ph.D.
>
> Statistical Data Center
>
> Intermountain Healthcare
>
>
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: 161
Date: Wed, 8 Jul 2009 23:45:41 -0700 (PDT)
Subject: Re: [R] Extracting a column name in loop?
To:
r-help@..., mister_bluesman
   <
mister_bluesman@...>
Message-ID: <
417783.91151.qm@...>
Content-Type: text/plain; charset=utf-8
If df is your dataframe then names(df) contains the column names and so names(df)[i] is the name of i-th column.
--- On Thu, 9/7/09, mister_bluesman <
mister_bluesman@...> wrote:
> From: mister_bluesman <
mister_bluesman@...>
> Subject: [R]Â Extracting a column name in loop?
> To:
r-help@...
> Received: Thursday, 9 July, 2009, 1:41 AM
>
> Hi,
>
> I am writing a script that will address columns using
> syntax like:
>
> data_set[,1]
>
> to extract the data from the first column of my data set,
> for example. This
> code will be placed in a loop (where the column reference
> will be placed by
> a variable).
>
> What I also need to do is extract the column NAME for a
> given column being
> processed in the loop. The dataframe has been set so that R
> knows that the
> top line refers to column headers.
>
> Can anyone help me understand how to do this?
>
> Thanks.
> --
> View this message in context:
http://www.nabble.com/Extracting-a-column-name-in-loop--tp24393160p24393160.html> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
>
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: 162
Date: Thu, 9 Jul 2009 07:15:58 +0000 (GMT)
From: kende jan <
kendejan@...>
Subject: [R] Cuminc Plot
To:
R-help@...
Message-ID: <
488783.2964.qm@...>
Content-Type: text/plain
Dear All,
here is the example for cumulative incidence analysis with cmprsk package:
set.seed(2)
ss <- rexp(100)
gg <- factor(sample(1:3,100,replace=TRUE),1:3,c('a','b','c'))
cc <- sample(0:2,100,replace=TRUE)
strt <- sample(1:2,100,replace=TRUE)
print(xx <- cuminc(ss,cc,gg,strt))
plot(xx,lty=1,color=1:6)
When I
perform this example, I have 6 curves.
a 1
b 1
c 1
a 2
b 2
c 2
I would
like to plot only 3 first curves of risk cc=1 not all of 6 curves.
a 1
b 1
c 1
How I can
do this with R ?
Many thanks
Jan
  Â
   [[alternative HTML version deleted]]
------------------------------
Message: 163
Date: Thu, 9 Jul 2009 00:17:14 -0700 (PDT)
From: nyk <
nick@...>
Subject: [R]Â Node colors in pvclust
To:
r-help@...
Message-ID: <
24405329.post@...>
Content-Type: text/plain; charset=us-ascii
Is there a way to assign color to nodes as with
hclust/as.dendrogram/dendrapply when using pvclust?
The problem is that as.dendrogram isn't working on the pvclust objects.
library(pvclust)
pvc <- pvclust(matrix, nboot=1000)
plot(pvc)
--
View this message in context:
http://www.nabble.com/Node-colors-in-pvclust-tp24405329p24405329.htmlSent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 164
Date: Thu, 9 Jul 2009 00:42:31 -0700 (PDT)
Subject: Re: [R] print() to file?
To:
r-help@..., Steve Jaffe <
sjaffe@...>
Message-ID: <
672248.24889.qm@...>
Content-Type: text/plain; charset=utf-8
One possibility is to use sink (see ?sink).
--- On Thu, 9/7/09, Steve Jaffe <
sjaffe@...> wrote:
------------------------------
Message: 165
Date: Thu, 9 Jul 2009 10:26:14 +0200
From: Petr PIKAL <
petr.pikal@...>
Subject: Re: [R] error: no such index at level 2
To: Godmar Back <
godmar@...>
Cc:
r-help@...
Message-ID:
   <
OF704BDEC7.5DB77177-ONC12575EE.002C8DE6-C12575EE.002E41DC@...>
  Â
Content-Type: text/plain; charset="US-ASCII"
Hi
Godmar Back <
godmar@...> napsal dne 08.07.2009 15:28:50:
> 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
for that
q[crossRsorted[,1]]
works but your real list is much more complicated.
>
> Even though the list 'q' has component 105, 104, and 10, the expression
q[[
> crossRsorted[,1] ]] causes an error.
> Why?
>
> And why does this work:
>
> > q[[c(105)]]
> [1] 0 0 1
>
> but not this:
>
> > q[[c(105,104)]]
> Error in q[[c(105, 104)]] : subscript out of bounds
> > q[[c(105,104,10)]]
> Error in q[[c(105, 104, 10)]] : recursive indexing failed at level 2
>
> even though q[[105]], q[[104], and q[[10]] are perfectly legitimate
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 ....
and referring to what you wrote to Henrique
This appears to be doing something different. For instance, my 'q' has 165
components, but what you suggest has 15750:
> length(q)
[1] 165
> length(q[ crossRsorted[,1] ])
[1] 15750
hardly what I want.
but this is what you asked for.
crossRsorted has 15750 items and all has been selected from q.
length(q[ unique(crossRsorted[,1] ]))
could be what you are looking for. However the result is probably a list
of data frames not a data frame with "rows".
Regards
Petr
>
> basically - a heterogeneous sparse list of NULL and data.frames of types
> character, num, and int.
>
> However - by construction - the q[[i]] for i in crossRsorted[,1] are all
non-
> NULL, as in my small reproducible example above.
> with data frame and list
>
> df1[sapply(list1,mean)>0,]
>
> selects rows of df1 which correspond to list elements with mean >0
>
> I can't run 'sapply' over my list because sapply will also iterate over
the
> NULLs. I want to access only those components in list1 that occur in
df1[1,].
>
>Â - Godmar
>
------------------------------
Message: 166
Date: Thu, 9 Jul 2009 20:27:18 +1200
From: Patrick Connolly <
p_connolly@...>
Subject: Re: [R] Mysteriously vanishing LD_LIBRARY_PATH
To: Marc Schwartz <
marc_schwartz@...>
Cc:
r-help@...
Message-ID: <
20090709082718.GG4626@...>
Content-Type: text/plain; charset=us-ascii
On Wed, 08-Jul-2009 at 09:40PM -0500, Marc Schwartz wrote:
[....]
> When I was using Fedora, several years ago I started to add any
> paths that I needed for LD_LIBRARY_PATH into /etc/ld.so.conf. Then
> run 'sudo ldconfig' to update the configuration.
Since I don't have root access to the CentOS machine, I can't make use
of that suggestion. However, by modifying the ldpaths file in my home
directory where R is instaled, I could make it the same as it was in
the 2.8.1 installation.
Just why that wasn't a problem before R-2.9.0 and only with CentOS,
I'm no closer to understanding, but I know how to get around the
problem.
[....]
Thanks for the suggestion and the one from Godmar Back. I have it
working.
best
--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.  Â
   ___  Patrick Connolly  Â
{~._.~}           Great minds discuss ideas Â
_( Y )_Â Â Â Â Â Â Â Â Â Â Average minds discuss events
(:_~*~_:)Â Â Â Â Â Â Â Â Â Small minds discuss peopleÂ
(_)-(_)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ..... Eleanor Roosevelt
   Â
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
------------------------------
Message: 167
Date: Thu, 9 Jul 2009 10:37:38 +0200
From: "Benoit Boulinguiez" <
benoit.boulinguiez@...>
Subject: [R] ggplot2: geom_errorbarh()
To: <
r-help@...>
Message-ID: <B35F4FCBCF7442A492541599B1E043C6@PR017080>
Content-Type: text/plain
Hi all,
quick question: is the optional command "width" effective in the
geom_errorbarh() layer of ggplot?
Cause I can't get it works on this graph
http://www.4shared.com/file/116919103/93488d88/iso_2PrsH.html
pdf(file = "iso_2PrsH.pdf", width = 7, height = 7)
NC60.iso.graph<-ggplot(
NC60.DATA
,aes(Ce,Qe)) +
geom_point(col=MaCouleur1, size=4) +
geom_errorbar(
 aes(ymax = NC60.DATA$Qe+NC60.DATA$sdQe
   ,ymin=NC60.DATA$Qe-NC60.DATA$sdQe)
   ,colour=alpha("black",0.4)
   ,width=1) +
geom_errorbarh(
 aes(xmax = NC60.DATA$Ce+NC60.DATA$sdCe
   ,xmin=NC60.DATA$Ce-NC60.DATA$sdCe)
   ,colour=alpha("black",0.4)
   ,width=1) +
geom_line(data=NC60.Res4.curve
 ,aes(x,y)
 ,size=1
 ,colour=alpha("black",0.5)) +
xlab(C[e]~(mmol/m^3)) +
ylab(q[e]~(mmol/m^3))
print(NC60.iso.graph)
dev.off()
Regards/Cordialement
-------------
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Avenue du Général Leclerc
CS 50837
35708 Rennes CEDEX 7
Tel 33 (0)2 23 23 80 83
Fax 33 (0)2 23 23 81 20
<
http://www.ensc-rennes.fr/>
http://www.ensc-rennes.fr/
   [[alternative HTML version deleted]]
------------------------------
Message: 168
Date: Thu, 9 Jul 2009 10:50:29 +0200
From: Petr PIKAL <
petr.pikal@...>
Subject: Re: [R] Best way to export values from a function?
To: Godmar Back <
godmar@...>
Cc:
R-help@...
Message-ID:
   <
OF09543102.C1351502-ONC12575EE.003022A7-C12575EE.003079EF@...>
  Â
Content-Type: text/plain; charset="US-ASCII"
Hi
r-help-bounces@... napsal dne 09.07.2009 02:57:33:
wrote:
> >
> > Maybe there is a great website out there or white paper that discusses
this
> but again my Google skills (or lack there of) let me down.
>
> Yeah, R is difficult to search for - I've had partial success with
> rseek.org, though.
>
> >
> > I would like to know the best way to export several doubles from a
function,
> where the doubles are not an array.
> >
> > Here is a contrived function similar to my needs:
> >
> > multipleoutput<-function(x)
> > {
> >Â Â Â Â squared<-x^2
> >Â Â Â Â cubed<-x^3
> >Â Â Â Â exponentioal<-exp(x)
> >Â Â Â Â factorialVal<-factorial(x)
> >
> > }
>
> You can always do:
>
> > multipleoutput <- function (x) { return (c(square = x^2, cube = x^3,
exp = exp(x))) }
>
> But then you'd have to call it like so:
>
> > mapply(multipleoutput, c(0,1,2))
>Â Â Â Â [,1]Â Â Â Â [,2]Â Â Â Â [,3]
> square  0 1.000000 4.000000
> cube   0 1.000000 8.000000
> exp     1 2.718282 7.389056
>
> If you call it like so:
>
> > multipleoutput(c(0,1,2))
>Â square1Â square2Â square3Â Â cube1Â Â cube2Â Â cube3Â Â Â Â exp1Â Â Â Â exp2
> 0.000000 1.000000 4.000000 0.000000 1.000000 8.000000 1.000000 2.718282
>Â Â Â Â exp3
> 7.389056
>
> then R flattens the result. Weird.
Not so weird. What do you expect from
c(1:5, 10:20, 30:50)
That is basically what your function do. With slight modification you can
get tabular output without mapply
multipleoutput <- function (x) {
result.s <- x^2
result.c <- x^3
result.e <- exp(x)
cbind(square=result.s, cube=result.c, exp=result.e)
}
If the output could be mixed type }numeric, character, ...) use data.frame
instead of cbind
Regards
Petr
>
>Â - Godmar
>
> ______________________________________________
>
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: 169
Date: Thu, 9 Jul 2009 08:56:08 +0000 (GMT)
From: justin bem <
justin_bem@...>
Subject: [R] IIA test
To: R Maillist <
r-help@...>
Message-ID: <
973487.17873.qm@...>
Content-Type: text/plain
Dear all,
I'am using mlogit to test IIA hypothesis. I'get the test statistique who is negative, a p-value of 1, and a text saying that the IIA hypothesis is rejeted. Does a negative value mean that constraint model is more efficient that that the full model ? what to do in this case ?
Sincerly.
Justin BEM
BP 1917 Yaoundé
Tél (237) 76043774
  Â
   [[alternative HTML version deleted]]
------------------------------
Message: 170
Date: Thu, 9 Jul 2009 10:00:13 +0100
From: "Chrysanthi A." <
chrysain@...>
Subject: Re: [R] heatmap.2: question regarding the "raw z-score"
To: "James W. MacDonald" <
jmacdon@...>
Cc:
r-help@...
Message-ID:
   <
66b602900907090200g1b5b6cdbv120515b01f4667e7@...>
Content-Type: text/plain
Thanks a lot..! What exactly the sweep function is doing? Also, is there a
possibility instead of using the mean of the whole row to get only the mean
of a group of the row values? So the values in the matrix (heat map) used in
the comparison are z-scores and not the intensities of the gene expressions,
right?
Also, as I can understand from the code, heatmap is using distfun function
for the clusering. Can I use pearson correlation for the clustering? My main
object of using the heatmap is to examine the expression levels of the
marker genes and to confirm that the marker genes are clearly differentially
expressed in the two subtypes of the disease that I examine.
Many thanks,
Chrysanthi.
2009/7/8 James W. MacDonald <
jmacdon@...>
> Hi Chrysanthi,
>
>
> Chrysanthi A. wrote:
>
>> Hi,
>>
>> I am analysing gene expression data using the heatmap.2 function in R and
>> I
>> was wondering what is the formula of the "raw z-score" bar which shows the
>> colors for each pixel.
>> According to that post:
>>
https://mailman.stat.ethz.ch/pipermail/r-help/2006-September/113598.html,
>> it
>> is the
>>
>> (actual value - mean of the group) / standard deviation.
>>
>> But, mean of which group? Mean of the gene vector? And actual value of
>> that
>> gene on a sample? I would be grateful if you could give me some more
>> details about it or even if there is a book/manual that I could address
>> to..
>>
>
> How about looking at the code?
>
>Â Â if (scale == "row") {
>Â Â Â Â retval$rowMeans <- rm <- rowMeans(x, na.rm = na.rm)
>Â Â Â Â x <- sweep(x, 1, rm)
>Â Â Â Â retval$rowSDs <- sx <- apply(x, 1, sd, na.rm = na.rm)
>Â Â Â Â x <- sweep(x, 1, sx, "/")
>Â Â }
>Â Â else if (scale == "column") {
>Â Â Â Â retval$colMeans <- rm <- colMeans(x, na.rm = na.rm)
>Â Â Â Â x <- sweep(x, 2, rm)
>Â Â Â Â retval$colSDs <- sx <- apply(x, 2, sd, na.rm = na.rm)
>Â Â Â Â x <- sweep(x, 2, sx, "/")
>Â Â }
>
> So the z-score is calculated on either the row or column (or the default of
> "none").
>
> I don't see how you can get something saying 'raw z-score'. I get either
> 'Row Z-Score' or 'Column Z-Score'. So assuming you meant Row Z-Score, then
> the rows are centered and scaled by subtracting the mean of the row from
> every value and then dividing the resulting values by the standard deviation
> of the row.
>
> Best,
>
> Jim
>
>
>
>> Thanks a lot,
>>
>> Chrysanthi.
>>
>> *
>> *
>>
>>Â Â Â Â [[alternative HTML version deleted]]
>>
>> ______________________________________________
>>
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
>
   [[alternative HTML version deleted]]
------------------------------
Message: 171
Date: Thu, 09 Jul 2009 11:05:54 +0200
From: Marc Jekel <
feuerwald@...>
Subject: [R] r bug (?) display of data
To:
r-help@...
Message-ID: <
4A55B2F2.2030201@...>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Hi R Fans,
I stumbled across a strange (I think) bug in R 2.9.1. I have read in a
data file with 5934 rows and 9 columns with the commands:
daten = data.frame(read.table("C:/fussball.dat",header=TRUE))
Then I needed a subset of the data file:
newd = daten[daten[,1]!=daten[,2],]
--> two values do not meet the logical specification and are dropped.
The strange thing about it: When I print the newd in the R Console, the
output still shows 5934 rows. When I check the number of rows with
NROW(newd) , I get 5932 as output. When I print newd[5934, ], I get NAs.
When I print newd[5932, ] I get the row that is listed in line 5934 when
I just type in newd. This is totally crazy! Has anyone had the same
problem? Thanks for a post.
Marc
------------------------------
Message: 172
Date: Thu, 9 Jul 2009 11:21:22 +0200
From: Sergey Goriatchev <
sergeyg@...>
Subject: [R] Ordering zoo-object by its index
To:
r-help@...
Message-ID:
   <
7cb007bd0907090221k5c4427bbse763864c487ccb17@...>
Content-Type: text/plain; charset=ISO-8859-1
Hello everyone,
Say I have zoo object
x.Date <- as.Date("2003-02-01") + c(1, 3, 7, 9, 14) - 1
x <- zoo(rnorm(5), x.Date)
y <- zoo(rt(5, df=2), x.Date)
z <- zoo(rt(5, df=5), x.Date)
Data <- merge(x,y,z)
What should I do to make the latest values appear at the top?
[[elided Yahoo spam]]
Regards,
Sergey
------------------------------
Message: 173
Date: Thu, 09 Jul 2009 11:39:39 +0200
From: Peter Dalgaard <
p.dalgaard@...>
Subject: Re: [R] r bug (?) display of data
To: Marc Jekel <
feuerwald@...>
Cc:
r-help@...
Message-ID: <
4A55BADB.8040805@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Marc Jekel wrote:
> Hi R Fans,
>
> I stumbled across a strange (I think) bug in R 2.9.1. I have read in a
> data file with 5934 rows and 9 columns with the commands:
>
> daten = data.frame(read.table("C:/fussball.dat",header=TRUE))
>
> Then I needed a subset of the data file:
>
> newd = daten[daten[,1]!=daten[,2],]
>
> --> two values do not meet the logical specification and are dropped.
>
> The strange thing about it: When I print the newd in the R Console, the
> output still shows 5934 rows. When I check the number of rows with
> NROW(newd) , I get 5932 as output. When I print newd[5934, ], I get NAs.
> When I print newd[5932, ] I get the row that is listed in line 5934 when
> I just type in newd. This is totally crazy! Has anyone had the same
> problem? Thanks for a post.
You're confusing row names and row numbers. When you printed newd, did
you actually count the number of lines? Thought so...
It isn't any stranger than this:
> data.frame(x=rnorm(6),y=rnorm(6))[-5,]
      x     y
1Â 0.9457385 -1.1398275
2 -1.1683732 -0.7269941
3Â 0.9942821Â 0.9310146
4 -2.0839580 -0.6261567
6Â 1.7225233Â 0.2457897
--
  O__ ---- Peter Dalgaard        ?ster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics    PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark   Ph: (+45) 35327918
~~~~~~~~~~ - (
p.dalgaard@...)Â Â Â Â Â Â Â FAX: (+45) 35327907
------------------------------
Message: 174
Date: Thu, 09 Jul 2009 11:41:13 +0200
From: Uwe Ligges <
ligges@...>
Subject: Re: [R] r bug (?) display of data
To: Marc Jekel <
feuerwald@...>
Cc:
r-help@...
Message-ID: <
4A55BB39.8080508@...>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Marc Jekel wrote:
> Hi R Fans,
>
> I stumbled across a strange (I think) bug in R 2.9.1. I have read in a
> data file with 5934 rows and 9 columns with the commands:
>
> daten = data.frame(read.table("C:/fussball.dat",header=TRUE))
>
> Then I needed a subset of the data file:
>
> newd = daten[daten[,1]!=daten[,2],]
>
> --> two values do not meet the logical specification and are dropped.
>
> The strange thing about it: When I print the newd in the R Console, the
> output still shows 5934 rows.
No 5932 rows, but with the original rownames (with 2 of them missing).
Uwe Ligges
When I check the number of rows with
> NROW(newd) , I get 5932 as output. When I print newd[5934, ], I get NAs.
> When I print newd[5932, ] I get the row that is listed in line 5934 when
> I just type in newd. This is totally crazy! Has anyone had the same
> problem? Thanks for a post.
>
> Marc
>
> ______________________________________________
>
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-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
End of R-help Digest, Vol 77, Issue 9
*************************************
[[alternative HTML version deleted]]
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.