O.K. Thanks to all who responded. Most of the function names that don't have a clear meaning seem be abbrviations or to stand for something (e.g., sd, grep). I guess this is just an exception.
 
Paul 

--- On Fri, 4/16/10, r-help-request@r-project.org <r-help-request@r-project.org> wrote:


From: r-help-request@r-project.org <r-help-request@r-project.org>
Subject: R-help Digest, Vol 86, Issue 16
To: r-help@r-project.org
Received: Friday, April 16, 2010, 5:00 AM


Send R-help mailing list submissions to
    r-help@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
    r-help-request@r-project.org

You can reach the person managing the list at
    r-help-owner@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1. Re: how to draw multiple vertical bands (Jim Lemon)
   2. Re: Consistent behaviour of for-loop (Uwe Dippel)
   3. Re: Exporting an rgl graph (Barry Rowlingson)
   4. Re: histogram (Paul Hiemstra)
   5. Re: histogram (Peter Ehlers)
   6. Re: Consistent behaviour of for-loop (Peter Ehlers)
   7. Re: Consistent behaviour of for-loop (Uwe Dippel)
   8. Re: classes and functions for qqnorm and stem (Peter Ehlers)
   9. Re: Consistent behaviour of for-loop (Peter Ehlers)
  10. Re: Exporting an rgl graph ( (Ted Harding))
  11. Re: graphic question (Tighiouart, Hocine)
  12. Re: Consistent behaviour of for-loop (Petr PIKAL)
  13. Re: R package documentation (S?bastien Bihorel)
  14. Re: Exporting an rgl graph (cgenolin@u-paris10.fr)
  15. debian lenny R GUI instalation problems (baxy77)
  16. Re: Exporting an rgl graph (Barry Rowlingson)
  17. Re: Non-parametric Tests for location in R (David Winsemius)
  18. Re: predict.lm with NAs (Walmes Zeviani)
  19. Re: sequence clustering and assembly (David Winsemius)
  20. Re: Regression w/ interactions (Frank E Harrell Jr)
  21. Re: sequence clustering and assembly (Martin Morgan)
  22. Re: Exporting an rgl graph (baptiste auguie)
  23. sum() returns 0 not NA (Wilmar Igl)
  24. Re: Exporting an rgl graph ( (Ted Harding))
  25. Re: sum rows in a data.frame (David Winsemius)
  26. Re: sum rows in a data.frame...solution (David Winsemius)
  27. Re: sum() returns 0 not NA ( (Ted Harding))
  28. [announce] yeroon.net/ggplot2 web application v0.2 (Jeroen Ooms)
  29. Re: sum() returns 0 not NA (David Winsemius)
  30. Weighted Spearman Correlation with significance test
      (????? ????????)
  31. Alignment of x-axis labels (Steve Murray)
  32. Re: curve (Duncan Murdoch)
  33. Re: sum specific rows in a data frame (hadley wickham)
  34. Re: R CMD REMOVE  etc. query (Prof. John C Nash)
  35. Re: sum specific rows in a data frame (Jeff Newmiler)
  36. Add header line to large text file (Zev Ross)
  37. Re: sum specific rows in a data frame (hadley wickham)
  38. Re: sum specific rows in a data frame (hadley wickham)
  39. Help with TukeyHSD (Amit Patel)
  40. Re: Selecting derivative order penalty for thin plate spline
      regression (GAM - mgcv) (Simon Wood)
  41. Connecting to Rserve remotely (Nupur Gupta)
  42. Re: Add header line to large text file (jim holtman)
  43. Re: Add header line to large text file (jim holtman)
  44. Re: Add header line to large text file (Wensui Liu)
  45. Re: Problems getting symbols() to show table data (Guy Green)
  46. step size truncated out of bounds (Judith Trunschke)
  47. Re: search and replace (Vijay Nori)
  48. Re: sum specific rows in a data frame (Vijay Nori)
  49. Re: Gaussian Quadrature Numerical Integration In R (Ines Azaiez)
  50. using nls for gamma distribution (a,b,d) (Asif Wazir)
  51. can't find "daphnia.txt" and others while working through
      Crawley's R-Book (David Hardie)
  52. Re: Efficient algorithm to get a solution path for ridge
      regression? (Charles C. Berry)
  53. Poblems wih EBImage (R Heberto Ghezzo, Dr)
  54. Re: Help with TukeyHSD (eugen pircalabelu)
  55. Re: Gaussian Quadrature Numerical Integration In R (Ravi Varadhan)
  56. Re: Alignment of x-axis labels (Peter Ehlers)
  57. Problem with ONE of the Special German Characters (Michael Stegh)
  58. Re: can't find "daphnia.txt" and others while working through
      Crawley's R-Book (David Winsemius)
  59. Re: can't find "daphnia.txt" and others while working through
      Crawley's R-Book (David Hardie)
  60. Re: Exporting an rgl graph (luke@stat.uiowa.edu)
  61. Re: Add header line to large text file (Zev Ross)
  62. Re: Regression w/ interactions (Frank E Harrell Jr)
  63. Re: can't find "daphnia.txt" and others while working through
      Crawley's R-Book (Christian Raschke)
  64. Re: using nls for gamma distribution (a,b,d) (Peter Ehlers)
  65. Re: Exporting an rgl graph (David Winsemius)
  66. Re: can't find "daphnia.txt" and others while working through
      Crawley's R-Book (David Winsemius)
  67. Unwanted boxes in legend (Steve Murray)
  68. Re: using nls for gamma distribution (a,b,d) (Walmes Zeviani)
  69. Re: Problem with ONE of the Special German Characters
      (Duncan Murdoch)
  70. fixed portion of lme4 model in newdata (Jacob Wegelin)
  71. Rserve : CStack usage too close to the limit (Matthieu Decorde)
  72. Re: R CMD REMOVE etc. query (Prof. John C Nash)
  73. Replace / with - in date (prem_R)
  74. Re: Exporting an rgl graph (Gavin Simpson)
  75. Re: can't find "daphnia.txt" and others while working through
      Crawley's R-Book (David Hardie)
  76. Re: histogram (Santosh)
  77. Re: Exporting an rgl graph (baptiste auguie)
  78. Re: Replace / with - in date (David Winsemius)
  79. Re: Unwanted boxes in legend (Peter Ehlers)
  80. data.frame and ddply (arnaud Gaboury)
  81. Re: Efficient algorithm to get a solution path for ridge
      regression? (Kenneth Lo)
  82. Re: Exporting an rgl graph (David Winsemius)
  83. Re: Replace / with - in date (prem_R)
  84. nested (hierarchical) anova (=?ISO-8859-1?Q?H=E9ctor_Villalobos?=)
  85. Re: Replace / with - in date (Christian Raschke)
  86. Re: Replace / with - in date (David Winsemius)
  87. Re: Replace / with - in date (David Winsemius)
  88. Re: how to work with big matrices and the ff-package?
      (Jens Oehlschl?gel)
  89. Re: curve (Greg Snow)
  90. Re: <<- how/when/why do you use it? (Greg Snow)
  91. r-loop (Changbin Du)
  92. Re: Rserve : CStack usage too close to the limit (Bio7)
  93. Re: r-loop (Changbin Du)
  94. Re: r-loop (David Winsemius)
  95. [R-pkgs] vcdExtra 0.5-0 is released to CRAN (Michael Friendly)
  96. Does "sink" stand for anything? (Paul Miller)
  97. Re: Does "sink" stand for anything? (David Winsemius)
  98. Re: Replace / with - in date (prem_R)
  99. multidimensional integration in R? (Muhtar Osman)
  100. Re: multidimensional integration in R? (David Winsemius)
  101. Re: filled.contour ON TOP of a base map (Ray Brownrigg)
  102. Re: Replace / with - in date (David Winsemius)
  103. Re: Does "sink" stand for anything? (John Sorkin)
  104. Re: Replace / with - in date (David Winsemius)
  105. Re: R package documentation (David Scott)
  106. Re: Question about R mode (Greg Snow)
  107. Re: Replace / with - in date (prem_R)
  108. Re: Consistent behaviour of for-loop (Greg Snow)
  109. Re: Any chance R will ever get beyond the 2^31-1 vector size
      limit? (Matthew Keller)
  110. Re: Any chance R will ever get beyond the 2^31-1 vector size
      limit? (Thomas Lumley)
  111. Re: how to work with big matrices and the ff-package?
      (Jens Oehlschl?gel)
  112. converting Ggobi csv input to xml for line plots in 3d (rtist)
  113. Efficiency of C Compiler in "R CMD SHLIB" (yehengxin)
  114. Regression using R (Samuel Bravo)
  115. Re: Efficiency of C Compiler in "R CMD SHLIB" (Sharpie)
  116. factors as bwplot x axis (James Rome)
  117. Re: Does "sink" stand for anything? (Sharpie)
  118. Re: Replace / with - in date (David Winsemius)
  119. Re: Replace / with - in date (David Winsemius)
  120. Re: Regression using R (Daniel Malter)
  121. error (firat.ozdemir@deu.edu.tr)
  122. Re: error (jim holtman)
  123. Re: Consistent behaviour of for-loop [Solved] (Uwe Dippel)
  124. TeachingDemos install bumps out with 'Out of memory!'
      (Uwe Dippel)
  125. Re: Problems getting symbols() to show table data
      (Gabor Grothendieck)
  126. Re: multidimensional integration in R? (Ravi Varadhan)
  127. hugene10stv1cdf (Christoph Knapp)
  128.  tsp for xts or zoo object (Erin Hodgess)
  129. Re: tsp for xts or zoo object (Gabor Grothendieck)
  130. Re: hugene10stv1cdf (Martin Morgan)
  131. Re: Efficiency of C Compiler in "R CMD SHLIB" (yehengxin)
  132. Re: Efficiency of C Compiler in "R CMD SHLIB" (yehengxin)
  133. Re: Efficiency of C Compiler in "R CMD SHLIB" (Prof Brian Ripley)
  134. Re: Regression using R (Dieter Menne)
  135. Re: Replace / with - in date (arnaud Gaboury)
  136. Re: Does "sink" stand for anything? (Barry Rowlingson)
  137. Re: glmer with non integer weights (Kay Cichini)
  138. data frame manipulation (arnaud Gaboury)
  139. Re: glmer with non integer weights (Kay Cichini)
  140. Re: Error in library(gplots) : there is no package called
      'gplots' (Vava)
  141. Re: Error in library(gplots) : there is no package    called
      'gplots' (james)
  142. Return a variable name (soeren.vogel@eawag.ch)
  143. merge (n.vialma@libero.it)
  144. error at R CMD check (carol white)
  145. problem with the version of R (arindam fadikar)


----------------------------------------------------------------------

Message: 1
Date: Thu, 15 Apr 2010 20:06:23 +1000
From: Jim Lemon <jim@bitwrit.com.au>
To: senne <wasenne@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] how to draw multiple vertical bands
Message-ID: <4BC6E51F.7010806@bitwrit.com.au>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 04/15/2010 12:36 AM, senne wrote:
> hi R gurus
>
> I saw some graphs with vertical band like this one:
>
> http://pragcap.com/wp-content/uploads/2010/04/GS.png
>
> how to draw the blue band in R, can't find any clue to do this,any ideas?
>
Hi senne,
The rect function in base graphics can do the job. First do the plot 
with type="n" (i.e. no plotting), then display your rectangles:

xylim<-par("usr")
rect.left<-as.Date(seq(paste(rep(c("Dec","Mar","Jun","Sep"),length.out=10),
  c("07","08","08","08","08","09","09","09","09","10"),sep="-")))
rect.right<-rect.left+10
rect(rect.left,xylim[3],rect.right,xylim[4],col="lightblue",border="lightblue")

then draw the line and text labels.

Warning - untested

Jim



------------------------------

Message: 2
Date: Thu, 15 Apr 2010 18:03:37 +0800
From: Uwe Dippel <udippel@uniten.edu.my>
To: Peter Ehlers <ehlers@ucalgary.ca>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Consistent behaviour of for-loop
Message-ID: <4BC6E479.90006@uniten.edu.my>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Peter Ehlers wrote:
>>  > par(mfrow=c(1,1))
>>  > qqnorm(rnorm(20))
>>  > qqmath(rnorm(20))
>>  > par(mfrow=c(3,4))
>>  > for(i in 1:12)qqnorm(rnorm(20))
>> Until here everything works as expected, and the last line prints 12
>> samples of qqnorm. However,
>>  > for(i in 1:12)qqmath(rnorm(20))
>> is doing nothing at all.
>>     
>
> You should always tell us what contributed packages you are using.
> Here, the qqmath function is from pkg:lattice.
> Now check FAQ 7.22.
>   
Thanks, Peter!
(And to the offline-reply as well!)
The question is not completely answered in FAQ 7.22, though:
> par(mfrow=c(3,4))
> for(i in 1:12)print(qqmath(rnorm(20)))
prints 12 after another; not in (3,4)

Why, and how to print 12 samples on a single sheet?

Uwe



------------------------------

Message: 3
Date: Thu, 15 Apr 2010 11:10:54 +0100
From: Barry Rowlingson <b.rowlingson@lancaster.ac.uk>
To: cgenolin@u-paris10.fr
Cc: r-help@r-project.org
Subject: Re: [R] Exporting an rgl graph
Message-ID:
    <i2hd8ad40b51004150310w3c40c33bw1c6651606585aa9b@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Apr 15, 2010 at 10:24 AM,  <cgenolin@u-paris10.fr> wrote:
> Hi the list,
>
> I use rgl to produce a 3D graph. I would like to "show" this graph to some
> collaborator. Is there a way to save it and send it to someone else?

See ?rgl.postscript and ?rgl.snapshot

Or use some kind of screen capture system - on Windows the 'Print
Screen' key can copy the screen to the clipboard, paste into Photoshop
or other graphics program.

On Linux, I use 'scrot' from the command line - type 'scrot -s',
click on a window, and it makes a PNG file of it.

-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman



------------------------------

Message: 4
Date: Thu, 15 Apr 2010 12:11:19 +0200
From: Paul Hiemstra <p.hiemstra@geo.uu.nl>
To: Santosh <santosh2005@gmail.com>
Cc: r-help <r-help@r-project.org>
Subject: Re: [R] histogram
Message-ID: <4BC6E647.2040200@geo.uu.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Santosh wrote:
> Thanks for your email... yes, I had tried that "bw" thing.. for some 
> reason it does not seem to work.. could not figure out where I am wrong...
>
> Below is an example for your convenience.. you might notice that the 
> density plots appear to be a curve of connected segments. Changing 
> breaks, nint or bw didn't seem to help.
>
> ############
> library(reshape)
> set.seed(13454)
> aa <- 
> data.frame(a1=rnorm(500),b1=rnorm(500,0.8),c1=rnorm(500,0.5),cat1=rep(1:5,each=100))
> ab <- melt(aa,measure.vars=c("a1","b1","c1"))
> histogram(~ 
> value|variable,ab,breaks=NULL,nint=10,type="density",layout=c(2,2),as.table=T,scales=list(relation='free'),
>             panel=function(x,lqp=c(0.05,0.975),...) {
>             panel.histogram(x,col='lightblue',...)
>             panel.densityplot(x,col.line='blue',lwd=1.75,bw=2,...)
replace bw = 2 by darg = list(bw = 2), then it works for me. Read the
documentation of panel.densityplot carefully, it says that you need to 
use darg = list().

cheers,
Paul
>             panel.abline(v=c(quantile(as.vector(x),prob=lqp,na.rm = T)),
>             col="dark green",lwd=2,lty=2)
>             },
>             strip=strip.custom( strip.names=F,
>                                 strip.levels=T,
>                                 par.strip.text=list(cex=0.75)),
> )
>
> ############
>
> Thanks again,
> Santosh
> On Thu, Apr 15, 2010 at 12:41 AM, Paul Hiemstra <p.hiemstra@geo.uu.nl 
> <mailto:p.hiemstra@geo.uu.nl>> wrote:
>
>     Santosh wrote:
>
>         Dear R gurus...
>
>         How do I control "smoothing" of a density plot in
>         panel.densityplot when
>         using histogram?
>
>         Thanks much,
>         Santosh
>
>                [[alternative HTML version deleted]]
>
>
>         ______________________________________________
>         R-help@r-project.org <mailto:R-help@r-project.org> mailing list
>         https://stat.ethz.ch/mailman/listinfo/r-help
>         PLEASE do read the posting guide
>         http://www.R-project.org/posting-guide.html
>         and provide commented, minimal, self-contained, reproducible code.
>          
>
>     Hi,
>
>     From ?panel.densityplot, argument darg, I was referred to
>     ?density. I think the 'bw' argument is what you need. Pass it to
>     panel.densityplot in the darg argument.
>
>     cheers,
>     Paul
>
>
>     -- 
>     Drs. Paul Hiemstra
>     Department of Physical Geography
>     Faculty of Geosciences
>     University of Utrecht
>     Heidelberglaan 2
>     P.O. Box 80.115
>     3508 TC Utrecht
>     Phone:  +3130 274 3113 Mon-Tue
>     Phone:  +3130 253 5773 Wed-Fri
>     http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul>
>     http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>
>


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



------------------------------

Message: 5
Date: Thu, 15 Apr 2010 04:11:13 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Santosh <santosh2005@gmail.com>
Cc: r-help <r-help@r-project.org>
Subject: Re: [R] histogram
Message-ID: <4BC6E641.6030500@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 2010-04-15 3:35, Santosh wrote:
> Thanks for your email... yes, I had tried that "bw" thing.. for some reason
> it does not seem to work.. could not figure out where I am wrong...
>
> Below is an example for your convenience.. you might notice that the density
> plots appear to be a curve of connected segments. Changing breaks, nint or
> bw didn't seem to help.
>
> ############
> library(reshape)
> set.seed(13454)
> aa<-
> data.frame(a1=rnorm(500),b1=rnorm(500,0.8),c1=rnorm(500,0.5),cat1=rep(1:5,each=100))
> ab<- melt(aa,measure.vars=c("a1","b1","c1"))
> histogram(~
> value|variable,ab,breaks=NULL,nint=10,type="density",layout=c(2,2),as.table=T,scales=list(relation='free'),
>              panel=function(x,lqp=c(0.05,0.975),...) {
>              panel.histogram(x,col='lightblue',...)
>              panel.densityplot(x,col.line='blue',lwd=1.75,bw=2,...)
>              panel.abline(v=c(quantile(as.vector(x),prob=lqp,na.rm = T)),
>              col="dark green",lwd=2,lty=2)
>              },
>              strip=strip.custom( strip.names=F,
>                                  strip.levels=T,
>                                  par.strip.text=list(cex=0.75)),
> )
>
> ############

You need to supply a *list* 'darg' to panel.densityplot; see
the help page.

  panel.densityplot(x, darg = list(bw = "nrd", adjust = 1.2), ...)

(I would use one of the built-in bandwidth selectors with a
suitable 'adjust' value.)

  -Peter Ehlers

>
> Thanks again,
> Santosh
> On Thu, Apr 15, 2010 at 12:41 AM, Paul Hiemstra<p.hiemstra@geo.uu.nl>wrote:
>
>> Santosh wrote:
>>
>>> Dear R gurus...
>>>
>>> How do I control "smoothing" of a density plot in panel.densityplot when
>>> using histogram?
>>>
>>> Thanks much,
>>> Santosh
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>> Hi,
>>
>>  From ?panel.densityplot, argument darg, I was referred to ?density. I think
>> the 'bw' argument is what you need. Pass it to panel.densityplot in the darg
>> argument.
>>
>> cheers,
>> Paul
>>
>>
>> --
>> Drs. Paul Hiemstra
>> Department of Physical Geography
>> Faculty of Geosciences
>> University of Utrecht
>> Heidelberglaan 2
>> P.O. Box 80.115
>> 3508 TC Utrecht
>> Phone:  +3130 274 3113 Mon-Tue
>> Phone:  +3130 253 5773 Wed-Fri
>> http://intamap.geo.uu.nl/~paul<http://intamap.geo.uu.nl/%7Epaul>
>> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>>
>>
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 6
Date: Thu, 15 Apr 2010 04:29:40 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Uwe Dippel <udippel@uniten.edu.my>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Consistent behaviour of for-loop
Message-ID: <4BC6EA94.1010207@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 2010-04-15 4:03, Uwe Dippel wrote:
> Peter Ehlers wrote:
>>> > par(mfrow=c(1,1))
>>> > qqnorm(rnorm(20))
>>> > qqmath(rnorm(20))
>>> > par(mfrow=c(3,4))
>>> > for(i in 1:12)qqnorm(rnorm(20))
>>> Until here everything works as expected, and the last line prints 12
>>> samples of qqnorm. However,
>>> > for(i in 1:12)qqmath(rnorm(20))
>>> is doing nothing at all.
>>
>> You should always tell us what contributed packages you are using.
>> Here, the qqmath function is from pkg:lattice.
>> Now check FAQ 7.22.
> Thanks, Peter!
> (And to the offline-reply as well!)
> The question is not completely answered in FAQ 7.22, though:
>  > par(mfrow=c(3,4))
>  > for(i in 1:12)print(qqmath(rnorm(20)))
> prints 12 after another; not in (3,4)
>
> Why, and how to print 12 samples on a single sheet?

You are mixing 'traditional' graphics (par(...)) and
'lattice' graphics.
That won't work. In lattice, you use the 'layout' argument to
select the number of columns/rows. This is easiest if you set
up a conditioning variable:

  cond <- gl(12, 20, labels = letters[1:12])
  x <- rnorm(12*20)
  qqmath(~x | cond, layout = c(4, 3))

Note that layout = c(columns, rows), not c(rows, columns).

Since you're new to R, let me also recommend very strongly
that you learn to use the str() function (not needed for
this problem, but undoubtedly indispensible in your further
adventures in R-land).

  -Peter Ehlers

>
> Uwe
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 7
Date: Thu, 15 Apr 2010 19:00:57 +0800
From: Uwe Dippel <udippel@uniten.edu.my>
To: Peter Ehlers <ehlers@ucalgary.ca>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Consistent behaviour of for-loop
Message-ID: <4BC6F1E9.7060302@uniten.edu.my>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Peter Ehlers wrote:
> You are mixing 'traditional' graphics (par(...)) and
> 'lattice' graphics.
> That won't work. In lattice, you use the 'layout' argument to
> select the number of columns/rows. This is easiest if you set
> up a conditioning variable:
>
>   cond <- gl(12, 20, labels = letters[1:12])
>   x <- rnorm(12*20)
>   qqmath(~x | cond, layout = c(4, 3))
>
> Note that layout = c(columns, rows), not c(rows, columns).
>
> Since you're new to R, let me also recommend very strongly
> that you learn to use the str() function (not needed for
> this problem, but undoubtedly indispensible in your further
> adventures in R-land).
>   
[[elided Yahoo spam]]

(It is difficult to satisfy me:)
How can one know/see, what is traditional graphics, and what is lattice 
graphics? Or is it try-and-fail-and-use-the-alternative?

Thanks,

Uwe



------------------------------

Message: 8
Date: Thu, 15 Apr 2010 05:06:37 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Uwe Dippel <udippel@uniten.edu.my>
Cc: r-help@r-project.org
Subject: Re: [R] classes and functions for qqnorm and stem
Message-ID: <4BC6F33D.9050501@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 2010-04-14 21:20, Uwe Dippel wrote:
> Referring to "Using R for Data Analysis and Graphics" by J H Maindonald,
> and available from the R site, I found the example on p.30 non-working:
>  > stem(qqnorm(possum$hdlngth))
> Error in stem(qqnorm(possum$hdlngth)) : 'x' must be numeric
> Since qqnorm(possum$hdlngth) plots, and
>  > class(possum$hdlngth)
> [1] "numeric"
> , the problem must be here:
>  > class(qqnorm(possum$hdlngth))
> [1] "list"
> Does 'stem' require numerical input? The help says so.
> But how to render it numeric?:
>  > class(as.numeric(qqnorm(possum$hdlngth)))
> Error: (list) object cannot be coerced to type 'double'
>
> Can someone please enlighten me about what goes wrong/has changed here?

This is a perfect time to learn about str().
If you check

  str(qqnorm(possum$hdlngth))

You will see that it is a list of two numeric vectors. But
stem() expects just one vector. The stem(....) call is an
error; it should be just stem(possum$hdlngth).

  -Peter Ehlers

>
> Uwe
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 9
Date: Thu, 15 Apr 2010 05:16:13 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Uwe Dippel <udippel@uniten.edu.my>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Consistent behaviour of for-loop
Message-ID: <4BC6F57D.4080000@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 2010-04-15 5:00, Uwe Dippel wrote:
> Peter Ehlers wrote:
>> You are mixing 'traditional' graphics (par(...)) and
>> 'lattice' graphics.
>> That won't work. In lattice, you use the 'layout' argument to
>> select the number of columns/rows. This is easiest if you set
>> up a conditioning variable:
>>
>> cond <- gl(12, 20, labels = letters[1:12])
>> x <- rnorm(12*20)
>> qqmath(~x | cond, layout = c(4, 3))
>>
>> Note that layout = c(columns, rows), not c(rows, columns).
>>
>> Since you're new to R, let me also recommend very strongly
>> that you learn to use the str() function (not needed for
>> this problem, but undoubtedly indispensible in your further
>> adventures in R-land).
[[elided Yahoo spam]]
>
> (It is difficult to satisfy me:)
> How can one know/see, what is traditional graphics, and what is lattice
> graphics? Or is it try-and-fail-and-use-the-alternative?

You have to do a fair amount of reading. There's a whole chapter
on base graphics in the Intro to R, which also (briefly) mentions
lattice graphics. And then there's the ggplot2 package ...

Beginners should definitely work through the Intro to R.

It takes time and patience.

  -Peter Ehlers

>
> Thanks,
>
> Uwe
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 10
Date: Thu, 15 Apr 2010 12:18:28 +0100 (BST)
From: (Ted Harding) <Ted.Harding@manchester.ac.uk>
To: r-help@r-project.org
Cc: cgenolin@u-paris10.fr
Subject: Re: [R] Exporting an rgl graph
Message-ID: <XFMail.100415121828.Ted.Harding@manchester.ac.uk>
Content-Type: text/plain; charset=iso-8859-1

On 15-Apr-10 10:10:54, Barry Rowlingson wrote:
> On Thu, Apr 15, 2010 at 10:24 AM,  <cgenolin@u-paris10.fr> wrote:
>> Hi the list,
>>
>> I use rgl to produce a 3D graph. I would like to "show" this graph
>> to some collaborator. Is there a way to save it and send it to
>> someone else?
> 
> See ?rgl.postscript and ?rgl.snapshot
> 
>  Or use some kind of screen capture system - on Windows the 'Print
> Screen' key can copy the screen to the clipboard, paste into Photoshop
> or other graphics program.
> 
>  On Linux, I use 'scrot' from the command line - type 'scrot -s',
> click on a window, and it makes a PNG file of it.

Again on Linux, since ImageMagick is installed, I use the 'import'
programme from that suite. When you start that, it produces a
"+"-shaped mouse cursor which you can use (selecting a top-left-hand
corner to start with, and holding down the left mouse button) to
drag out a bounding frame for the part of the screen you want to
save. Then, when you release the button, an image of that portion
of the screen is saved to a file of your choice, in any graphics
format of your choice that is supported by ImageMagick (including
PS and EPS, as well as all the common butmap formats).

See 'man import' for pointers to more information.

I have this set up as an icon on my "launch" panel, so it is just
a matter of clicking on that, and then doing the above. The command
behind the icon is

  /usr/local/bin/mkscreengrab

and my script file 'mkscreengrab' contains:

  #! /bin/bash
  export ScrGrbTmp=`mktemp /home/ted/Screengrabs/screengrabXXXX`
  import $ScrGrbTmp.jpg
  rm $ScrGrbTmp

so this makes JPEGs (I could have chosen somthing else, but that's
the default I mostly want for that activity). This produces a file
with a name like "screengrab4913.jpg" which will be unique in that
directory, and it can later be renamed to your taste.

If I wanted a different file format, I would use 'import' from
the command line, with appropriate filenam extension (e.g. ".png",
".ps", ".eps", ... ).

I hadn't heard of scrot before, but now I've looked it up it
seems that its output format is limited to PNG.

I've now also located more info about various ways of taking
screenshots in Linux:

http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 15-Apr-10                                       Time: 12:18:25
------------------------------ XFMail ------------------------------



------------------------------

Message: 11
Date: Thu, 15 Apr 2010 07:21:33 -0400
From: "Tighiouart, Hocine" <htighiouart@tuftsmedicalcenter.org>
To: "Peter Ehlers" <ehlers@ucalgary.ca>
Cc: r-help@r-project.org
Subject: Re: [R] graphic question
Message-ID:
    <53192604D1423A4DBADEC7E8F556658202AF67FE@neexchange06.tufts-nemc.org>
Content-Type: text/plain;    charset="US-ASCII"

Thanks Peter. This worked fine. I guess my problem was that when I
maximize the graph window everything seems to expand, this is why I was
having trouble with it.


-----Original Message-----
From: Peter Ehlers [mailto:ehlers@ucalgary.ca] 
Sent: Thursday, April 15, 2010 4:54 AM
To: Tighiouart, Hocine
Cc: r-help@r-project.org
Subject: Re: [R] graphic question

On 2010-04-14 19:57, Tighiouart, Hocine wrote:
> Hello,
>
> I have a simple question that I could not really figure out. I am
plotting labels within a graph using the text function. I first plot the
first label by specifying the x and y coordinates on the graph. Then to
plot the second label next to it, I am using te strwidth function to get
the width of the previous label in user coordinate then add the maximum
width to the x value. However, this is not working:
>
> Here is an example:
>
> lab1<-c("Hocine&  Ruba 2000", "Yasmine 2004","Ziad was born in 2006")
> lab2<-c(20,22,45)
> lab3<-c(54677,10900,200)
> plot(-10:5,1:6)
> text(par("usr")[1],2:4,lab1,adj=c(0,0.5))
> text(par("usr")[1]+max(strwidth(lab1)),2:4,lab1,adj=c(0,0.5))
>
> However, this is not working OK. I would like to get the max width of
lab1 as it appears in the figure then add that amount to plot lab2 and
so forth. I would like to leave only one blank column between successive
labels.

Does this give you what you have in mind:

  text(par("usr")[1] + max(strwidth(paste(lab1, ""))),
       2:4,lab1,adj=c(0,0.5))

  -Peter Ehlers

>
> Thanks!
>
> Hocine
>
>
>
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 12
Date: Thu, 15 Apr 2010 13:22:25 +0200
From: Petr PIKAL <petr.pikal@precheza.cz>
To: Uwe Dippel <udippel@uniten.edu.my>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Consistent behaviour of for-loop
Message-ID:
    <OF455DD9DA.1CFC62B2-ONC1257706.003D6D23-C1257706.003E8F6C@precheza.cz>
    
Content-Type: text/plain; charset="UTF-8"

Hi

r-help-bounces@r-project.org napsal dne 15.04.2010 13:00:57:

> Peter Ehlers wrote:
> > You are mixing 'traditional' graphics (par(...)) and
> > 'lattice' graphics.
> > That won't work. In lattice, you use the 'layout' argument to
> > select the number of columns/rows. This is easiest if you set
> > up a conditioning variable:
> >
> >   cond <- gl(12, 20, labels = letters[1:12])
> >   x <- rnorm(12*20)
> >   qqmath(~x | cond, layout = c(4, 3))
> >
> > Note that layout = c(columns, rows), not c(rows, columns).
> >
> > Since you're new to R, let me also recommend very strongly
> > that you learn to use the str() function (not needed for
> > this problem, but undoubtedly indispensible in your further
> > adventures in R-land).
> > 
[[elided Yahoo spam]]
> 
> (It is difficult to satisfy me:)
> How can one know/see, what is traditional graphics, and what is lattice 

I would prefer to name it base and grid graphics. 

Base is in graphics and grDevices packages and grid graphics is in grid 
package. Only some packages use grid graphics (lattice, ggplot2, nlme for 
some) many more packages use base graphics. You can not simply mix 
functions from one with another, however if you dig deeper you can find 
that it is possible.

Basically if you do not intend to develop graphic package you probably 
will use what others developed for you and you will use base graphics most
of the time.

Fro lattice help page

Lattice is built upon the Grid graphics engine and requires the
     ?grid? add-on package.  It is not (readily) compatible with
     traditional R graphics tools. 

Regards
Petr


> graphics? Or is it try-and-fail-and-use-the-alternative?
> 
> Thanks,
> 
> Uwe
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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: 13
Date: Thu, 15 Apr 2010 08:00:10 -0400
From: S?bastien Bihorel <pomchip@free.fr>
To: David Scott <d.scott@auckland.ac.nz>
Cc: "r-help@r-project.org" <r-help@r-project.org>,
    "tobias.verbeke@openanalytics.eu" <tobias.verbeke@openanalytics.eu>
Subject: Re: [R] R package documentation
Message-ID:
    <u2qecd262691004150500yd2e3272ch6430bcfa0d32c7fd@mail.gmail.com>
Content-Type: text/plain

Thanks David,

After a bit of research, I believe that I've found the post you are
referring to:

http://tolstoy.newcastle.edu.au/R/e9/help/10/03/8779.html

I will look into the proposed solutions.

Sebastien

On Wed, Apr 14, 2010 at 6:01 PM, David Scott <d.scott@auckland.ac.nz> wrote:

> Sébastien Bihorel wrote:
>
>> Thanks Tobias,
>>
>> If there is no automated way to combine both documents, I will stack them
>> manually... that will likely cause some problems with page numbering
>> tough.
>>
>> Sebastien
>>
>>
> There was a thread a while back (this year) about someone who wanted to
> incorporate his package manual in his thesis. A solution was offered to this
> as I recall and it seems like the same problem to me.
>
> What you need is the LaTeX that comes out of the package check. Just add it
> to your vignette LaTeX and that should do the trick.
>
> David
>
> _________________________________________________________________
> David Scott     Department of Statistics
>                The University of Auckland, PB 92019
>                Auckland 1142,    NEW ZEALAND
> Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
> Email:  d.scott@auckland.ac.nz,  Fax: +64 9 373 7018
>
> Director of Consulting, Department of Statistics
>
>

    [[alternative HTML version deleted]]



------------------------------

Message: 14
Date: Thu, 15 Apr 2010 14:01:59 +0200
From: cgenolin@u-paris10.fr
To: ted.harding@manchester.ac.uk, Barry Rowlingson
    <b.rowlingson@lancaster.ac.uk>
Cc: r-help@r-project.org
Subject: Re: [R] Exporting an rgl graph
Message-ID: <20100415140159.dnnzxxb9k44skg0k@webmail.u-paris10.fr>
Content-Type: text/plain;    charset=ISO-8859-1;    format="flowed"

Thanks for you answer. Let me precise my question.

In fact, I do not want to "capture" a screen, I want to save an object 
that can be seen in 3D. With rgl, using my mouse, I can make the object 
move. This is what I want to export: an real 3D object that my 
collaborator will have the possibility to see in 3D.

Christophe


> On 15-Apr-10 10:10:54, Barry Rowlingson wrote:
>> On Thu, Apr 15, 2010 at 10:24 AM,  <cgenolin@u-paris10.fr> wrote:
>>> Hi the list,
>>>
>>> I use rgl to produce a 3D graph. I would like to "show" this graph
>>> to some collaborator. Is there a way to save it and send it to
>>> someone else?
>>
>> See ?rgl.postscript and ?rgl.snapshot
>>
>>  Or use some kind of screen capture system - on Windows the 'Print
>> Screen' key can copy the screen to the clipboard, paste into Photoshop
>> or other graphics program.
>>
>>  On Linux, I use 'scrot' from the command line - type 'scrot -s',
>> click on a window, and it makes a PNG file of it.
>
> Again on Linux, since ImageMagick is installed, I use the 'import'
> programme from that suite. When you start that, it produces a
> "+"-shaped mouse cursor which you can use (selecting a top-left-hand
> corner to start with, and holding down the left mouse button) to
> drag out a bounding frame for the part of the screen you want to
> save. Then, when you release the button, an image of that portion
> of the screen is saved to a file of your choice, in any graphics
> format of your choice that is supported by ImageMagick (including
> PS and EPS, as well as all the common butmap formats).
>
> See 'man import' for pointers to more information.
>
> I have this set up as an icon on my "launch" panel, so it is just
> a matter of clicking on that, and then doing the above. The command
> behind the icon is
>
>  /usr/local/bin/mkscreengrab
>
> and my script file 'mkscreengrab' contains:
>
>  #! /bin/bash
>  export ScrGrbTmp=`mktemp /home/ted/Screengrabs/screengrabXXXX`
>  import $ScrGrbTmp.jpg
>  rm $ScrGrbTmp
>
> so this makes JPEGs (I could have chosen somthing else, but that's
> the default I mostly want for that activity). This produces a file
> with a name like "screengrab4913.jpg" which will be unique in that
> directory, and it can later be renamed to your taste.
>
> If I wanted a different file format, I would use 'import' from
> the command line, with appropriate filenam extension (e.g. ".png",
> ".ps", ".eps", ... ).
>
> I hadn't heard of scrot before, but now I've looked it up it
> seems that its output format is limited to PNG.
>
> I've now also located more info about various ways of taking
> screenshots in Linux:
>
> http://tips.webdesign10.com/how-to-take-a-screenshot-on-ubuntu-linux
>
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding@manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 15-Apr-10                                       Time: 12:18:25
> ------------------------------ XFMail ------------------------------
>



------------------------------

Message: 15
Date: Thu, 15 Apr 2010 03:03:23 -0800 (PST)
From: baxy77 <baxy@hi.htnet.hr>
To: r-help@r-project.org
Subject: [R] debian lenny R GUI instalation problems
Message-ID: <1271329403056-1880797.post@n4.nabble.com>
Content-Type: text/plain; charset=UTF-8


hi, i have a problem installing any type of GUI interface on my debian lenny
64x OS, can anybody spare some time to help me?. so i have installed the R
by apt-get and then in R used command : 


baxy:~#  update-alternatives --config java

There are 3 alternatives which provide `java'.

  Selection    Alternative
-----------------------------------------------
          1    /usr/bin/gij-4.3
          2    /usr/lib/jvm/java-gcj/jre/bin/java
*+        3    /usr/lib/jvm/java-6-openjdk/jre/bin/java

Press enter to keep the default[*], or type selection number: 
baxy:~#  R CMD javareconf 
Java interpreter : /usr/bin/java
Java version     : 1.6.0_0
Java home path   : /usr/lib/jvm/java-6-openjdk/jre
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path:
$(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib:/usr/lib/jni
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/lib/amd64
-L$(JAVA_HOME)/../lib/amd64 -L -L/usr/java/packages/lib/amd64 -L/usr/lib64
-L/lib64 -L/lib -L/usr/lib -L/usr/lib/jni -ljvm
JNI cpp flags    : -I$(JAVA_HOME)/../include

Updating Java configuration in /etc/R
Done.

baxy:~# R

R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

>  install.packages('JGR', dep=TRUE) 
Warning in install.packages("JGR", dep = TRUE) :
  argument 'lib' is missing: using '/root/R/x86_64-pc-linux-gnu-library/2.7'
--- Please select a CRAN mirror for use in this session ---
CRAN mirror 


...




  to install GUI but the message that i'm geting is 

Warning message:
In install.packages("JGR", dep = TRUE) : package ?JGR? is not available

so is there any other package so i can just plot my graphs .... i'm seeking
for just minimal tools so i can plot my images distributions and stuff ...

thank you 


baxy

-- 
View this message in context: http://n4.nabble.com/debian-lenny-R-GUI-instalation-problems-tp1880797p1880797.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 16
Date: Thu, 15 Apr 2010 13:12:53 +0100
From: Barry Rowlingson <b.rowlingson@lancaster.ac.uk>
To: cgenolin@u-paris10.fr
Cc: r-help@r-project.org, ted.harding@manchester.ac.uk
Subject: Re: [R] Exporting an rgl graph
Message-ID:
    <j2id8ad40b51004150512u3adc914ag44f251d4868344ad@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Apr 15, 2010 at 1:01 PM,  <cgenolin@u-paris10.fr> wrote:
> Thanks for you answer. Let me precise my question.
>
> In fact, I do not want to "capture" a screen, I want to save an object that
> can be seen in 3D. With rgl, using my mouse, I can make the object move.
> This is what I want to export: an real 3D object that my collaborator will
> have the possibility to see in 3D.
>

You mean without them having to install R and rgl and run the code
that produces your graphic?

I guess you could somehow export a VRML or some other 3d file:

http://en.wikipedia.org/wiki/VRML

but I suspect of all the billions of people on the planet only Duncan
Murdoch knows enough about rgl to figure that one out...

The person at the other end would still need a VRML viewer. Just get
them to install R.

Barry



------------------------------

Message: 17
Date: Thu, 15 Apr 2010 08:17:56 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: maithili davda <mdmdmd.83@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Non-parametric Tests for location in R
Message-ID: <2FBF647B-F6F1-49DE-AFBA-629AEF8418B5@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 14, 2010, at 7:19 PM, maithili davda wrote:

> How do I do the sign test and the sign rank test that SAS gives as  
> an output
> in proc univariate in R?
>
> sign.test
> and
> wilcox.test
>
> do not give the same output.

No data, no specifics, no code. Rather difficult to determine whether  
you made an error or  .... what?
>
> Also how do you pick what output you want displayed in R?
> like if I want only the test statistic and p value displayed and  
> nothing
> else how do I do that.

Most such functions return lists. One can look at the names of the  
components of such lists with str and extract the desired components.  
In the case of wilcox.test you do not need str because you can just go  
to the Value section of the help page and it's all laid out for you  
(as it should be.) You could assign the results to say, wres, and then :

wres$statistic
wres$p.value

-- 
David Winsemius, MD
West Hartford, CT



------------------------------

Message: 18
Date: Thu, 15 Apr 2010 04:22:34 -0800 (PST)
From: Walmes Zeviani <walmeszeviani@hotmail.com>
To: r-help@r-project.org
Subject: Re: [R] predict.lm with NAs
Message-ID: <1271334154915-1886457.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


You can use predict() by specifying a complete data.frame() for prediction to
the argument newdata=. Look:

da <- expand.grid(x1=LETTERS[1:4], x2=1:9)
da$y <- rnorm(da$x1)
da$y[sample(length(da$y), 5)] <- NA

m0 <- lm(y~x1+x2, data=da)
predict(m0) # NA not predicted
predict(m0, newdata=da) # NA predicted

Sincerely.
Walmes.

-----
..ooo0
...................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani@hotmail.com, Lavras - MG, Brasil
............
(_/............................................................................................
-- 
View this message in context: http://n4.nabble.com/predict-lm-with-NAs-tp1840661p1886457.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 19
Date: Thu, 15 Apr 2010 08:24:22 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: Bogdan Tanasa <tanasa@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sequence clustering and assembly
Message-ID: <57319F6D-8973-4866-9DE8-82A2DD6723F9@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 14, 2010, at 11:19 PM, Bogdan Tanasa wrote:

> Dear all,
>
> please could you suggest any R functions or packages (or external  
> programs),
> that
>
> a. take as input a large number (> 10 000) of short 20-30 nt  
> sequences, and
> do
> sequence assembly, to reconstruct larger (extended) 30-50 sequences ?
>
> b. take as input a larger number of sequences (100 000 - 1 mil) and  
> cluster
> these
> sequences in distinct classes based on the sequence similarity  ?

Most of the discussion about genetics/omics applications occurs on the  
BioConductor mailing list. You should definitely seek it out, get the  
base installed and review their available online resources (before  
sending your next message to the correct mailing list.

http://www.bioconductor.org/docs

-- 

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 20
Date: Thu, 15 Apr 2010 07:26:18 -0500
From: Frank E Harrell Jr <f.harrell@Vanderbilt.Edu>
To: Michael Dykes <thedoctor81877@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Regression w/ interactions
Message-ID: <4BC705EA.1030202@vanderbilt.edu>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

Michael Dykes wrote:
> I have a project due in my Linear Regression class re: regression on a data
> set & my professor gave us a hint that there were *exactly *2 sig
> interactions. The data set is attached. We have to find which predictors are
> significant, & which 2 interactions are sig. Also, I nedd some guidance for
> this & selecting the best model. I tried the `full' model, that being:
> z=lm(y~x1+x2+x3+x4+x1*x2+x2*x3...+x3*x4). I then ran an anova(z), &
> summary(z). My R^2 & R^2_a were *really* low. I am not sure how to do PRESS,
> AIC & Cp in R yet though. Any help would be appreciated.
> 
> 

Michael this is not really the place for help on homework other than 
perhaps on technical roadblocks.  Note that the strategy you are being 
told to follow is one whose statistical properties have been severely 
criticized in the statistical literature.  Only with a very high signal 
to noise ratio (e.g., high true R^2) can torturing data lead to a 
confession to something other than what the analyst wants to hear.  I 
suppose that in simulated data there is a "true" model out there waiting 
to be found, but beware of using this approach with real data with low 
signal to noise ratios.

Frank


-- 
Frank E Harrell Jr   Professor and Chairman        School of Medicine
                      Department of Biostatistics   Vanderbilt University



------------------------------

Message: 21
Date: Thu, 15 Apr 2010 05:33:11 -0700
From: Martin Morgan <mtmorgan@fhcrc.org>
To: Bogdan Tanasa <tanasa@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sequence clustering and assembly
Message-ID: <4BC70787.3060104@fhcrc.org>
Content-Type: text/plain; charset=ISO-8859-1

Hi Bogdan --

On 04/14/2010 08:19 PM, Bogdan Tanasa wrote:
> Dear all,
> 
> please could you suggest any R functions or packages (or external
> programs), that
likely you'll have more luck on the Bioconductor mailing list,

http://bioconductor.org/docs/mailList.html

but...

> a. take as input a large number (> 10 000) of short 20-30 nt
> sequences, and do sequence assembly, to reconstruct larger (extended)
> 30-50 sequences ?

I don't know of any sequence assemblers in R; velvet would be a first
stop third party tool but it sounds like you have some fairly specific
requirements....

> b. take as input a larger number of sequences (100 000 - 1 mil) and
> cluster these sequences in distinct classes based on the sequence
> similarity  ?

The Biostrings package has various functions to calculate edit distance,
which might form the input to familiar R clustering algorithms. See
installation instructions at

http://www.bioconductor.org/packages/release/bioc/html/Biostrings.html

This thread

https://stat.ethz.ch/pipermail/bioconductor/2010-March/032580.html

might suggest some directions.

Martin

> 
> thanks a lot,
> 
> bogdan
> 
> [[alternative HTML version deleted]]
> 
> ______________________________________________ R-help@r-project.org
> mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
> read the posting guide http://www.R-project.org/posting-guide.html 
> and provide commented, minimal, self-contained, reproducible code.


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



------------------------------

Message: 22
Date: Thu, 15 Apr 2010 14:33:11 +0200
From: baptiste auguie <baptiste.auguie@googlemail.com>
To: r-help <r-help@r-project.org>
Subject: Re: [R] Exporting an rgl graph
Message-ID:
    <k2sde4e29f51004150533qde25b012x2d67a481455c4c78@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I have seen pdf files with 3D objects embedded in it, using the U3D format,
http://en.wikipedia.org/wiki/Universal_3D

but I don't think there's a device for this in R; in fact there may
not even exist a third-party post-processing route available at this
time to bridge the gap between rgl and this format. It sure would be
nice, though.

Best,

baptiste



On 15 April 2010 14:12, Barry Rowlingson <b.rowlingson@lancaster.ac.uk> wrote:
> On Thu, Apr 15, 2010 at 1:01 PM, ?<cgenolin@u-paris10.fr> wrote:
>> Thanks for you answer. Let me precise my question.
>>
>> In fact, I do not want to "capture" a screen, I want to save an object that
>> can be seen in 3D. With rgl, using my mouse, I can make the object move.
>> This is what I want to export: an real 3D object that my collaborator will
>> have the possibility to see in 3D.
>>
>
> ?You mean without them having to install R and rgl and run the code
> that produces your graphic?
>
> ?I guess you could somehow export a VRML or some other 3d file:
>
> ?http://en.wikipedia.org/wiki/VRML
>
> ?but I suspect of all the billions of people on the planet only Duncan
> Murdoch knows enough about rgl to figure that one out...
>
> ?The person at the other end would still need a VRML viewer. Just get
> them to install R.
>
> Barry
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 23
Date: Thu, 15 Apr 2010 14:37:42 +0200
From: "Wilmar Igl" <schimpanski@gmx.de>
To: r-help@r-project.org
Subject: [R] sum() returns 0 not NA
Message-ID: <20100415123742.60050@gmx.net>
Content-Type: text/plain; charset="us-ascii"

Dear all,

just a stupid R question, since the results puzzle me a bit:

> sum(c(NA,NA), na.rm=TRUE)
[1] 0
>  NA + NA   
[1] NA
> NA + 1
[1] NA
> 

Why does sum(c(NA,NA), na.rm=TRUE) return 0 and not NA?

Thanks in advance,

Will



------------------------------

Message: 24
Date: Thu, 15 Apr 2010 13:54:06 +0100 (BST)
From: (Ted Harding) <Ted.Harding@manchester.ac.uk>
To: r-help <r-help@r-project.org>
Subject: Re: [R] Exporting an rgl graph
Message-ID: <XFMail.100415135406.Ted.Harding@manchester.ac.uk>
Content-Type: text/plain; charset=iso-8859-1

On 15-Apr-10 12:33:11, baptiste auguie wrote:
> I have seen pdf files with 3D objects embedded in it, using the U3D
> format,
> http://en.wikipedia.org/wiki/Universal_3D

At the bottom of that page is a link to a very nice example:

  http://meshlab.sourceforge.net/wiki/images/c/cc/Laurana.pdf

"Embedding interactive 3D object in a PDF using MeshLab and U3D,
Visual Computing Group. ISTI CNR. Example of an embedded U3D in a pdf."

Nice to play with! (With the mouse cursor over her, hold down the
button, and move around). According to the caption at the bottom:

  "This pdf was produced with open source tools. The object
   was converted in the pdf-ready U3D format with MeshLab
   ( http://meshlab.sourceforge.net ) and assembled in a pdf
   with pdfLATEX and the movie15 package."

[[elided Yahoo spam]]
Ted.


> but I don't think there's a device for this in R; in fact there may
> not even exist a third-party post-processing route available at this
> time to bridge the gap between rgl and this format. It sure would be
> nice, though.
> 
> Best,
> 
> baptiste
> 
> 
> 
> On 15 April 2010 14:12, Barry Rowlingson <b.rowlingson@lancaster.ac.uk>
> wrote:
>> On Thu, Apr 15, 2010 at 1:01 PM, _<cgenolin@u-paris10.fr> wrote:
>>> Thanks for you answer. Let me precise my question.
>>>
>>> In fact, I do not want to "capture" a screen, I want to save an
>>> object that
>>> can be seen in 3D. With rgl, using my mouse, I can make the object
>>> move.
>>> This is what I want to export: an real 3D object that my collaborator
>>> will
>>> have the possibility to see in 3D.
>>>
>>
>> _You mean without them having to install R and rgl and run the code
>> that produces your graphic?
>>
>> _I guess you could somehow export a VRML or some other 3d file:
>>
>> _http://en.wikipedia.org/wiki/VRML
>>
>> _but I suspect of all the billions of people on the planet only Duncan
>> Murdoch knows enough about rgl to figure that one out...
>>
>> _The person at the other end would still need a VRML viewer. Just get
>> them to install R.
>>
>> Barry
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 15-Apr-10                                       Time: 13:54:02
------------------------------ XFMail ------------------------------



------------------------------

Message: 25
Date: Thu, 15 Apr 2010 08:56:57 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: "arnaud Gaboury" <arnaud.gaboury@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sum rows in a data.frame
Message-ID: <6AAA40CD-2C40-42BE-B7E4-3161F8430655@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 3:50 AM, arnaud Gaboury wrote:

> Dear group,
>
> Here is a data.frame, "lme":
>
>> lme
>                          DESCRIPTION CLOSING.PRICE POSITION
> 4        PRIMARY NICKEL USD 04/06/10    25,755.7100        0
> 5        PRIMARY NICKEL USD 10/06/10    25,760.8600        0
> 6  PRM HGH GD ALUMINIUM USD 09/07/10     2,415.9000        0
> 8  SPCL HIGH GRADE ZINC USD 06/07/10     2,420.1000       -1
> 9  SPCL HIGH GRADE ZINC USD 07/07/10     2,420.4100       -1
> 10 SPCL HIGH GRADE ZINC USD 08/07/10     2,420.7300        1
> 11 SPCL HIGH GRADE ZINC USD 09/07/10     2,421.0500        1
> 12 SPCL HIGH GRADE ZINC USD 13/04/10     2,388.4300        0
> 13 SPCL HIGH GRADE ZINC USD 14/04/10     2,389.0000        0
> 14 SPCL HIGH GRADE ZINC USD 15/04/10     2,389.5700        0
> 15 SPCL HIGH GRADE ZINC USD 17/05/10     2,402.2900        0
> 16 SPCL HIGH GRADE ZINC USD 18/05/10     2,402.6400       -2
>
> DESCRIPTION and CLOSING.PRICE are factors, POSITION is numeric.


Lacking a reproducible example   ... that is one that can be readily  
pasted into a console session ... this code remains untested and  
probably full of bugs so it is more a pseudo-code approach to the  
problem than a solution:

DESCRIPgrep <- sub(".{13}$",    "",  lme$DESCRIPTION, perl=TRUE)
with( lme, tapply(as.numeric(as.character(CLOSING.PRICE),   
DESCRIPgrep, mean)

Please reread the Posting Guide and submit data examples constructed  
with dput or dump so that responders can work on representative data.  
It would be a real pain to reconstruct that data example but you could  
have trivially offered it for testing.

>
> I want to sum POSITION by products, i.e. PRIMARY NICKEL, PRM HGH GD
> ALUMINIUM and SPCL HIGH GRADE ZINC. The problem is that, as you can  
> see,
> there is a different date as a part of each product description. Can  
> anyone
> tell me how to get rid of these dates so I can sum the position  
> column? The
> number of rows is not fixed and will change every day.
>
> TY.
--

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 26
Date: Thu, 15 Apr 2010 09:04:52 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: "arnaud Gaboury" <arnaud.gaboury@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sum rows in a data.frame...solution
Message-ID: <56913908-2A76-4B16-9271-9B145EE08B2D@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 5:33 AM, arnaud Gaboury wrote:

> Found this solution. It is maybe not the most elegant way, but it  
> does the
> job.
>
>> a=as.data.frame(substr(lme$DESCRIPTION,1,14))
>> colnames(a)=c("DESCRIPTION")
>> lme=as.data.frame(c(a,lme[,2:3]))
>
>> lme
>
>         DESCRIPTION CLOSING.PRICE POSITION
> 1  PRIMARY NICKEL   25,755.7100        0
> 2  PRIMARY NICKEL   25,760.8600        0
> 3  PRM HGH GD ALU    2,415.9000        0
> 4  SPCL HIGH GRAD    2,420.1000       -1
> 5  SPCL HIGH GRAD    2,420.4100       -1
> 6  SPCL HIGH GRAD    2,420.7300        1
> 7  SPCL HIGH GRAD    2,421.0500        1
> 8  SPCL HIGH GRAD    2,388.4300        0
> 9  SPCL HIGH GRAD    2,389.0000        0
> 10 SPCL HIGH GRAD    2,389.5700        0
> 11 SPCL HIGH GRAD    2,402.2900        0
> 12 SPCL HIGH GRAD    2,402.6400       -2
> 13 SPCL HIGH GRAD    2,391.8600        0
> 14 SPCL HIGH GRAD    2,403.0000        2
> 15 SPCL HIGH GRAD    2,392.4300        0
> 16 SPCL HIGH GRAD    2,393.0000        0
>
>
> If someone has a better idea, it is welcomed.
>
>
> -----Original Message-----
> From: arnaud Gaboury [mailto:arnaud.gaboury@gmail.com]
> Sent: Thursday, April 15, 2010 9:50 AM
> To: 'r-help@r-project.org'
> Subject: sum rows in a data.frame
>
> Dear group,
>
> Here is a data.frame, "lme":
>
>> lme
>                          DESCRIPTION CLOSING.PRICE POSITION
> 4        PRIMARY NICKEL USD 04/06/10    25,755.7100        0
> 5        PRIMARY NICKEL USD 10/06/10    25,760.8600        0
> 6  PRM HGH GD ALUMINIUM USD 09/07/10     2,415.9000        0
> 8  SPCL HIGH GRADE ZINC USD 06/07/10     2,420.1000       -1
> 9  SPCL HIGH GRADE ZINC USD 07/07/10     2,420.4100       -1
> 10 SPCL HIGH GRADE ZINC USD 08/07/10     2,420.7300        1
> 11 SPCL HIGH GRADE ZINC USD 09/07/10     2,421.0500        1
> 12 SPCL HIGH GRADE ZINC USD 13/04/10     2,388.4300        0
> 13 SPCL HIGH GRADE ZINC USD 14/04/10     2,389.0000        0
> 14 SPCL HIGH GRADE ZINC USD 15/04/10     2,389.5700        0
> 15 SPCL HIGH GRADE ZINC USD 17/05/10     2,402.2900        0
> 16 SPCL HIGH GRADE ZINC USD 18/05/10     2,402.6400       -2
>
> DESCRIPTION and CLOSING.PRICE are factors, POSITION is numeric.
>
> I want to sum POSITION by products, i.e. PRIMARY NICKEL, PRM HGH GD
> ALUMINIUM and SPCL HIGH GRADE ZINC. The problem is that, as you can  
> see,
> there is a different date as a part of each product description. Can  
> anyone
> tell me how to get rid of these dates so I can sum the position  
> column? The
> number of rows is not fixed and will change every day.

See earlier post for one approach to the sum within description  
problem. But I did use mean instead of sum.

>
> TY.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 27
Date: Thu, 15 Apr 2010 14:07:14 +0100 (BST)
From: (Ted Harding) <Ted.Harding@manchester.ac.uk>
To: r-help@r-project.org
Subject: Re: [R] sum() returns 0 not NA
Message-ID: <XFMail.100415140714.Ted.Harding@manchester.ac.uk>
Content-Type: text/plain; charset=iso-8859-1

On 15-Apr-10 12:37:42, Wilmar Igl wrote:
> Dear all,
> 
> just a stupid R question, since the results puzzle me a bit:
> 
>> sum(c(NA,NA), na.rm=TRUE)
> [1] 0
>>  NA + NA   
> [1] NA
>> NA + 1
> [1] NA
>> 
> 
> Why does sum(c(NA,NA), na.rm=TRUE) return 0 and not NA?
> 
> Thanks in advance,
> 
> Will

For the same reason that:

  sum(logical(0))
  # [1] 0

If x is a numeric vector, possibly with NAs,

  sum(x,na.rm=TRUE)

will first remove any NAs from x, and then execute sum() on
what is left.

In the case of your example, after removing the NAs from c(NA,NA)
there is nothing left. The fact that it comes out 'logical' is
another issue:

  x <- c(NA,NA)
  x[!is.na(x)]
  # logical(0)

  c(NA,NA)[-(1:2)]
  # logical(0)

while:

  c(3,4)[-(1:2)]
  numeric(0)

The point is that the type of c(NA,NA) is "logical"

  str(c(NA,NA))
  # logi [1:2] NA NA

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 15-Apr-10                                       Time: 14:07:10
------------------------------ XFMail ------------------------------



------------------------------

Message: 28
Date: Thu, 15 Apr 2010 05:13:17 -0800 (PST)
From: Jeroen Ooms <jeroenooms@gmail.com>
To: r-help@r-project.org
Subject: [R] [announce] yeroon.net/ggplot2 web application v0.2
Message-ID: <1271337197556-1890003.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


A new version of the ggplot2 web interface has been released. Info and a demo
video are available here: http://www.stat.ucla.edu/~jeroen/ggplot2/. The new
version has a lot of new features, like advanced data import, integration
with Google docs, converting variables from numeric to factor to dates and
vice versa, and a lot of new geom's. 

For those that missed it: http://yeroon.net/ggplot2 is a web interface for
Hadley Wickham's R package ggplot2. It is used as a tool for rapid
prototyping, exploratory graphical analysis and education of statistics and
R. The interface is written completely in javascript, therefore there is no
need to install anything on the client side: a standard browser will do. All
major browsers are supported but a recent and standards-compliant browser is
highly recommended. Best performance is achieved by using Google Chrome. 

The easiest way to learn how to use the application is by taking 5 minutes
to watch the introductory demo video. 
-- 
View this message in context: http://n4.nabble.com/announce-yeroon-net-ggplot2-web-application-v0-2-tp1890003p1890003.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 29
Date: Thu, 15 Apr 2010 09:14:22 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: "Wilmar Igl" <schimpanski@gmx.de>
Cc: r-help@r-project.org
Subject: Re: [R] sum() returns 0 not NA
Message-ID: <21D6867E-6EB9-437F-B392-34E32A4F4912@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Apr 15, 2010, at 8:37 AM, Wilmar Igl wrote:

> Dear all,
>
> just a stupid R question, since the results puzzle me a bit:
>
>> sum(c(NA,NA), na.rm=TRUE)
> [1] 0
>> NA + NA
> [1] NA
>> NA + 1
> [1] NA
>>
>
> Why does sum(c(NA,NA), na.rm=TRUE) return 0 and not NA?
>

> sum(c())
[1] 0

?sum

"NB: the sum of an empty set is zero, by definition."

-- 
David Winsemius, MD
West Hartford, CT



------------------------------

Message: 30
Date: Thu, 15 Apr 2010 17:22:02 +0400
From: ????? ???????? <A-Morkovin@yandex.ru>
To: r-help@r-project.org
Subject: [R] Weighted Spearman Correlation with significance test
Message-ID: <94411271337722@web145.yandex.ru>
Content-Type: text/plain

Hi all,
does anybody know a useful function in R to calculate Weighted Spearman Correlation with p-values, particularly for matrices?

Thanks,

A. Morkovin



------------------------------

Message: 31
Date: Thu, 15 Apr 2010 13:23:37 +0000
From: Steve Murray <smurray444@hotmail.com>
To: <r-help@r-project.org>
Subject: [R] Alignment of x-axis labels
Message-ID: <BAY135-W13906DF6F578C3857527F0880F0@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"


Dear all,

I'm having trouble getting the correct spacing between x-axis labels on a barplot. This is the command I'm using to generate the plot:

temp <- barplot(precip, beside=TRUE, xaxt="n", las=1, xpd=FALSE, col="grey28", ylim=c(0, max(precip)))

Here is the structure of temp:
> str(temp)
?num [1:96, 1] 0.7 1.9 3.1 4.3 5.5 6.7 7.9 9.1 10.3 11.5 ...

And here is the structure of the data being plotted:
> str(precip)
?num [1:96] 1841 2871 9254 22335 30682 ...

> length(precip)
[1] 96

These are monthly data points for 8 years (8 * 12 = 96), but I only want to have labels for each year (1978 to 1985), rather than every month. So I tried using the following command, but this results in the labels not being far enough apart, and therefore they don't fill the length of the x-axis (and don't align properly with the corresponding first bar of every year):

axis(1, at=seq(1,96,12), 1978:1985)


This one has stumped me somewhat, so I'd be grateful to receive any suggestions as to how I might resolve this.

Many thanks,

Steve
                          
_________________________________________________________________

We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now


------------------------------

Message: 32
Date: Thu, 15 Apr 2010 09:28:40 -0400
From: Duncan Murdoch <murdoch@stats.uwo.ca>
To: Dwayne Blind <dwayneblind@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] curve
Message-ID: <4BC71488.9010202@stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 14/04/2010 4:59 PM, Dwayne Blind wrote:
> Dear R users,
>
> How can I use "curve" with a function of two variables ?
>   

See Ben Bolker's reply if you want to plot a surface.  If you want to 
plot a curve by holding one of the two variables fixed, just set it to a 
constant value, and use "x" as the other variable, e.g.

f <- function(x, y) { x^2 + y^2 }

curve(f(x, 2), from= .... )

curve(f(3, x), from= .... )

or wrap the function in a one variable function if you want to follow 
some complicated path, e.g.

curve(function(t) f(t, t^2), from=....)

Duncan Murdoch



------------------------------

Message: 33
Date: Thu, 15 Apr 2010 13:09:17 +0000
From: hadley wickham <h.wickham@gmail.com>
To: Chuck <vijay.nori@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sum specific rows in a data frame
Message-ID:
    <z2pf8e6ff051004150609w448457aakeb845113c3060fd@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Apr 15, 2010 at 1:16 AM, Chuck <vijay.nori@gmail.com> wrote:
> Depending on the size of the dataframe and the operations you are
> trying to perform, aggregate or ddply may be better. ?In the function
> below, df has the same structure as your dataframe.

Current version of plyr:

         agg  ddply
X10    0.005  0.007
X100   0.007  0.026
X1000  0.086  0.248
X10000 0.577  3.136
X1e.05 4.493 44.147

Development version of plyr:

         agg ddply
X10    0.003 0.005
X100   0.007 0.007
X1000  0.042 0.044
X10000 0.410 0.443
X1e.05 4.479 4.237

So there are some big speed improvements in the works.

Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



------------------------------

Message: 34
Date: Thu, 15 Apr 2010 10:17:46 -0400
From: "Prof. John C Nash" <nashjc@uottawa.ca>
To: r-help@r-project.org
Subject: Re: [R] R CMD REMOVE  etc. query
Message-ID: <4BC7200A.4010509@uottawa.ca>
Content-Type: text/plain; charset=us-ascii; format=flowed

I've been working on a fairly complex package that is a wrapper for several optimization 
routines. In this work, I've attempted to do the following:

- edit the package code   foo.R
- in a root terminal at the right directory location
    R CMD REMOVE foo
    R CMD INSTALL foo

However, I don't get the right code. In fact, if I just do the remove,

     library(foo)

does not throw an error. If I stop my R session and restart it, I do.

Is this expected behaviour?

For information, I run scripted tests that start with
    rm(list=ls())
    library(foo)

to ensure I'm getting "new" code each time.

If desired I can provide a minimal package to show this, but I expect that it is a known 
issue for which I've missed the documentation. Perhaps there is a command to reset the
session. I did a brief search, but appropriate keywords pick up a lot of irrelevant material.

JN



------------------------------

Message: 35
Date: Thu, 15 Apr 2010 07:33:54 -0700
From: Jeff Newmiler <jdnewmil@dcn.davis.ca.us>
To: hadley wickham <h.wickham@gmail.com>, Chuck <vijay.nori@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sum specific rows in a data frame
Message-ID: <soir00jj75txqx2h1jpwniga.1271342034630@email.android.com>
Content-Type: text/plain; charset=utf-8

This is good news, although I have recently encountered what I consider excessive memory usage in the addition of key columns that don't affect the number of groups.  For example, grouping by Year and Month, if I add MonthBegin, a POSIXct column from which the Year and Month columns were derived, I run out of memory. 

hadley wickham <h.wickham@gmail.com> wrote:

>On Thu, Apr 15, 2010 at 1:16 AM, Chuck <vijay.nori@gmail.com> wrote:
>> Depending on the size of the dataframe and the operations you are
>> trying to perform, aggregate or ddply may be better. ?In the function
>> below, df has the same structure as your dataframe.
>
>Current version of plyr:
>
>         agg  ddply
>X10    0.005  0.007
>X100   0.007  0.026
>X1000  0.086  0.248
>X10000 0.577  3.136
>X1e.05 4.493 44.147
>
>Development version of plyr:
>
>         agg ddply
>X10    0.003 0.005
>X100   0.007 0.007
>X1000  0.042 0.044
>X10000 0.410 0.443
>X1e.05 4.479 4.237
>
>So there are some big speed improvements in the works.
>
>Hadley
>
>
>-- 
>Assistant Professor / Dobelman Family Junior Chair
>Department of Statistics / Rice University
>http://had.co.nz/
>
>______________________________________________
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/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: 36
Date: Thu, 15 Apr 2010 10:34:55 -0400
From: Zev Ross <zev@zevross.com>
To: r-help@R-project.org
Subject: [R] Add header line to large text file
Message-ID: <4BC7240F.1020704@zevross.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

All,

I have a 30 million record text file without header information. I would 
like to add a header to this file without reading it first. Is this 
possible? The code below does what I want except that the readLines 
portion takes quite a long time. Is there a way around reading the 
lines? I'm working on Windows XP.

Zev

input<-readLines("c:/junk/forR.csv")
input<-c(c('"a", "b", "c", "d", "e", "f"'), input)
writeLines(input, "c:/junk/forRfix.csv")

-- 
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
zev@zevross.com



------------------------------

Message: 37
Date: Thu, 15 Apr 2010 14:42:13 +0000
From: hadley wickham <h.wickham@gmail.com>
To: Jeff Newmiler <jdnewmil@dcn.davis.ca.us>
Cc: Chuck <vijay.nori@gmail.com>, r-help@r-project.org
Subject: Re: [R] sum specific rows in a data frame
Message-ID:
    <v2rf8e6ff051004150742ye5f715d4ve4a362a3c74fe949@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I think the development version also fixes that problem, but it's hard
to know without a reproducible example ....

Hadley

On Thu, Apr 15, 2010 at 2:33 PM, Jeff Newmiler <jdnewmil@dcn.davis.ca.us> wrote:
> This is good news, although I have recently encountered what I consider excessive memory usage in the addition of key columns that don't affect the number of groups. ?For example, grouping by Year and Month, if I add MonthBegin, a POSIXct column from which the Year and Month columns were derived, I run out of memory.
>
> hadley wickham <h.wickham@gmail.com> wrote:
>
>>On Thu, Apr 15, 2010 at 1:16 AM, Chuck <vijay.nori@gmail.com> wrote:
>>> Depending on the size of the dataframe and the operations you are
>>> trying to perform, aggregate or ddply may be better. ?In the function
>>> below, df has the same structure as your dataframe.
>>
>>Current version of plyr:
>>
>> ? ? ? ? agg ?ddply
>>X10 ? ?0.005 ?0.007
>>X100 ? 0.007 ?0.026
>>X1000 ?0.086 ?0.248
>>X10000 0.577 ?3.136
>>X1e.05 4.493 44.147
>>
>>Development version of plyr:
>>
>> ? ? ? ? agg ddply
>>X10 ? ?0.003 0.005
>>X100 ? 0.007 0.007
>>X1000 ?0.042 0.044
>>X10000 0.410 0.443
>>X1e.05 4.479 4.237
>>
>>So there are some big speed improvements in the works.
>>
>>Hadley
>>
>>
>>--
>>Assistant Professor / Dobelman Family Junior Chair
>>Department of Statistics / Rice University
>>http://had.co.nz/
>>
>>______________________________________________
>>R-help@r-project.org mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>and provide commented, minimal, self-contained, reproducible code.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



------------------------------

Message: 38
Date: Thu, 15 Apr 2010 14:42:50 +0000
From: hadley wickham <h.wickham@gmail.com>
To: Vijay Nori <vijay.nori@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sum specific rows in a data frame
Message-ID:
    <g2rf8e6ff051004150742m4be44b67k311a8dcc3f5be86@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

The problem is that the new version of plyr is incompatible with
ggplot2, so I need to make some changes there before I can release it.
Hopefully this summer.

Hadley

On Thu, Apr 15, 2010 at 1:33 PM, Vijay Nori <vijay.nori@gmail.com> wrote:
> This is very cool...thanks Hadley. When are you planning to release that
> version?
>
> On Thu, Apr 15, 2010 at 9:09 AM, hadley wickham <h.wickham@gmail.com> wrote:
>>
>> On Thu, Apr 15, 2010 at 1:16 AM, Chuck <vijay.nori@gmail.com> wrote:
>> > Depending on the size of the dataframe and the operations you are
>> > trying to perform, aggregate or ddply may be better. ?In the function
>> > below, df has the same structure as your dataframe.
>>
>> So there are some big speed improvements in the works.
>>
>> Hadley
>>
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



------------------------------

Message: 39
Date: Thu, 15 Apr 2010 14:46:08 +0000 (GMT)
From: Amit Patel <amitrhelp@yahoo.co.uk>
To: R-help@r-project.org
Subject: [R] Help with TukeyHSD
Message-ID: <572829.14480.qm@web28405.mail.ukl.yahoo.com>
Content-Type: text/plain; charset=utf-8

Hi

I am conducting ANOVA using the aov function
I am also conducting TukeyHSD to obtain which of the groups show variance
How can I obtain the first three p values from the list below?

>zzz.aov <- aov(Intensity ~ Group, data = zzzanova)

> TukeyHSD(zzz.aov) 
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = Intensity ~ Group, data = zzzanova)

$Group
                      diff       lwr      upr     p adj
Group2-Group1  0.778354812 -3.414233 4.970943 0.9607836
Group3-Group1 -0.734044848 -5.073786 3.605696 0.9698685
Group4-Group1 -0.000158625 -4.192747 4.192429 1.0000000
Group3-Group2 -1.512399661 -5.852140 2.827341 0.7933015
Group4-Group2 -0.778513438 -4.971101 3.414075 0.9607611
Group4-Group3  0.733886223 -3.605855 5.073627 0.9698870







------------------------------

Message: 40
Date: Thu, 15 Apr 2010 15:53:27 +0100
From: Simon Wood <s.wood@bath.ac.uk>
To: r-help@r-project.org
Subject: Re: [R] Selecting derivative order penalty for thin plate
    spline    regression (GAM - mgcv)
Message-ID: <201004151553.27725.s.wood@bath.ac.uk>
Content-Type: text/plain;  charset="iso-8859-1"

Christos, 

I would base choise of `m' on the AIC or GCV scores, (or on the REML or 
Marginal likelihood scores, if these have been used for smoothness 
selection). I don't think the m=2 basis will be strictly nested within the 
m=3 basis will it? So that rules out you option a. Option b is poor since the 
smoothing parameters really have a different meaning in the two cases. 

Choosing `m' according to the same criterion you used for smoothness selection 
seems like the most self consistent approach. 

best,
Simon

On Wednesday 14 April 2010 19:19, Christos Argyropoulos wrote:
> Hi,
>
>
>
> I am using GAMs (package mgcv) to smooth event rates in a penalized
> regression setting and I was wondering if/how one can
>
> select the order of the derivative penalty.
>
>
>
> For my particular problem the order of the penalty (parameter "m" inside
> the "s" terms of the formula argument) appears to
>
> have a larger effect on the AIC/deviance of the estimated model than the
> number (or even the location!) of the knots for the covariate
>
> of interest. In particular, the estimated smooth changes shape from a
> linear (default "m" (=2) value for a TP smooth or a P-spline
>
> smooth) with a edf of 2.06 to a non-linear one with a edf of 4.8-5.1 when
> the "m" is raised to 3. There are no changes in the
>
> estimate shape of the smooth when I tried higher values of m and different 
> bases (thin plate, p-spline).
>
>
>
> The overall significance of the smooth term changes, but is <0.05 in both
> cases, however the interpretation afforded by the
>
> shapes of the smooths are different.
>
>
>
> Smoothing the same dataset with a different approach to GAMs (BayesX)
> results in shapes that are more like the ones I have been getting with m>=3
> rather than m=2 (I have not tried the conditional autoregressive
> regressions of WinBUGS yet).
>
> Any suggestion on how to proceed to test the optimal order of the penalty
> would be appreciated. The 2 approaches I am thinking of trying are:
>
> a) use un-penalized smoothing regressions and comparing the 2 models with
> ANOVA
>
> b) First, fit the "m=2" model and extract the smoothing parameters of all
> other smooth terms from that model. Second, fit a model in which the smooth
> of the covariate of interest is set to "m=3" , fixing the parameters of all
> other smooth terms appearing in the model statement to the values estimated
> in the first step. Then I could compare the (m=2) v.s. (m=3) models with
> ANOVA as the 2 models are properly nested within each other.
>
>
>
> Any other ideas?
>
>
>
> Sincerely,
>
>
>
> Christos Argyropoulos
>
> University of Pittsburgh
>
>
>
>
>
> _________________________________________________________________
> Hotmail: Trusted email with powerful SPAM protection.
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283



------------------------------

Message: 41
Date: Thu, 15 Apr 2010 11:05:29 -0400
From: Nupur Gupta <nupur.gupta.700@gmail.com>
To: r-help@r-project.org
Subject: [R] Connecting to Rserve remotely
Message-ID:
    <j2p31a8ff211004150805p5b8f1568k9e375e18d3b9df57@mail.gmail.com>
Content-Type: text/plain

Hi All,
I am having problems connecting to Rserve remotely.

I am trying to connect to Rserve which is running on a developer machine. At
the developer machine, I have created a file C:\Program
Files\R\R-2.7.1\etc\Rserve.conf with a single line
remote enable

At this machine, I check the IP address by 'ip config'. It is something like
151.120.xx.xxx . This machine is running Rserve.

>From another machine, at the command line, I type

telnet 151.120.xx.xxx 6311

which should connect to the Rserve. However, I am getting a connection
refused.

Anyone have any advice on connecting remotely? Any help MUCH appreciated.

Thanks
Nupur.

    [[alternative HTML version deleted]]



------------------------------

Message: 42
Date: Thu, 15 Apr 2010 11:09:01 -0400
From: jim holtman <jholtman@gmail.com>
To: Zev Ross <zev@zevross.com>
Cc: r-help@r-project.org
Subject: Re: [R] Add header line to large text file
Message-ID:
    <k2x644e1f321004150809o28e36b45y994bbc5b22735ed2@mail.gmail.com>
Content-Type: text/plain

If you want to place the header at the beginning of the file, then you have
to read/write the entire file to get that first line in.

On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross <zev@zevross.com> wrote:

> All,
>
> I have a 30 million record text file without header information. I would
> like to add a header to this file without reading it first. Is this
> possible? The code below does what I want except that the readLines portion
> takes quite a long time. Is there a way around reading the lines? I'm
> working on Windows XP.
>
> Zev
>
> input<-readLines("c:/junk/forR.csv")
> input<-c(c('"a", "b", "c", "d", "e", "f"'), input)
> writeLines(input, "c:/junk/forRfix.csv")
>
> --
> Zev Ross
> ZevRoss Spatial Analysis
> 120 N Aurora, Suite 3A
> Ithaca, NY 14850
> 607-277-0004 (phone)
> 866-877-3690 (fax, toll-free)
> zev@zevross.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<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?

    [[alternative HTML version deleted]]



------------------------------

Message: 43
Date: Thu, 15 Apr 2010 11:13:02 -0400
From: jim holtman <jholtman@gmail.com>
To: Zev Ross <zev@zevross.com>
Cc: r-help@r-project.org
Subject: Re: [R] Add header line to large text file
Message-ID:
    <m2t644e1f321004150813hede55472t9d90d0e00202f4da@mail.gmail.com>
Content-Type: text/plain

You also might take a look at using file.append to speed up the process.

On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross <zev@zevross.com> wrote:

> All,
>
> I have a 30 million record text file without header information. I would
> like to add a header to this file without reading it first. Is this
> possible? The code below does what I want except that the readLines portion
> takes quite a long time. Is there a way around reading the lines? I'm
> working on Windows XP.
>
> Zev
>
> input<-readLines("c:/junk/forR.csv")
> input<-c(c('"a", "b", "c", "d", "e", "f"'), input)
> writeLines(input, "c:/junk/forRfix.csv")
>
> --
> Zev Ross
> ZevRoss Spatial Analysis
> 120 N Aurora, Suite 3A
> Ithaca, NY 14850
> 607-277-0004 (phone)
> 866-877-3690 (fax, toll-free)
> zev@zevross.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<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?

    [[alternative HTML version deleted]]



------------------------------

Message: 44
Date: Thu, 15 Apr 2010 11:15:49 -0400
From: Wensui Liu <liuwensui@gmail.com>
To: Zev Ross <zev@zevross.com>
Cc: r-help@r-project.org
Subject: Re: [R] Add header line to large text file
Message-ID:
    <q2l1115a2b01004150815pd9e12099la45d00a47cb60c26@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

if i were you, i probably will use 1 line of sed to do such task
instead of R to insert headers in the file.

On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross <zev@zevross.com> wrote:
> All,
>
> I have a 30 million record text file without header information. I would
> like to add a header to this file without reading it first. Is this
> possible? The code below does what I want except that the readLines portion
> takes quite a long time. Is there a way around reading the lines? I'm
> working on Windows XP.
>
> Zev
>
> input<-readLines("c:/junk/forR.csv")
> input<-c(c('"a", "b", "c", "d", "e", "f"'), input)
> writeLines(input, "c:/junk/forRfix.csv")
>
> --
> Zev Ross
> ZevRoss Spatial Analysis
> 120 N Aurora, Suite 3A
> Ithaca, NY 14850
> 607-277-0004 (phone)
> 866-877-3690 (fax, toll-free)
> zev@zevross.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
==============================
WenSui Liu
Blog   : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do.  - Robert Schuller



------------------------------

Message: 45
Date: Thu, 15 Apr 2010 05:23:45 -0800 (PST)
From: Guy Green <guygreen@netvigator.com>
To: r-help@r-project.org
Subject: Re: [R] Problems getting symbols() to show table data
Message-ID: <1271337825686-1890724.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Thanks, balloonplot() is great and gets me really close to what I am after.

However it then brings me to a slightly different problem - I wonder if
anyone can suggest where I am going wrong?

Again with simplified data (
http://n4.nabble.com/file/n1890724/test-data.txt test-data.txt ):

           Aug-03   Nov-03   Feb-04   May-04   Aug-04
Row1       1         -1.1         1.2        1.3        -1.4
Row2       3         -3.1         3.2        3.3        -3.4
Row3       5         -5.1         5.2       -5.3         5.4

library(gplots)
Read_data=read.table("C:/files/test-data.txt", head = T)
number_rows = nrow(Read_data)
number_cols = ncol(Read_data)
matrix_data = as.matrix(Read_data)
row_names = rep(rownames(matrix_data),number_cols)
col_names = rep(colnames(matrix_data),number_rows)
x11(width=120, height=80)
balloonplot(col_names, row_names, abs(matrix_data),
    dotcolor = c("lightblue", "red")[(c(matrix_data) < 0) + 1],
    show.margins = FALSE, cum.margins = FALSE, 
    xlab = "", ylab = "", label=T, label.lines= F, colsrt=90, sorted = F,
    rowmar=3, colmar=2.5,) 

This gives this graphic:  http://n4.nabble.com/file/n1890724/R_upload.jpeg
R_upload.jpeg .

The data colours go in the "right" places within the grid - i.e. with the
correct numbers.  However the numbers themselves are mixed up within each
row.  Transposing the matrix_data within balloonplot() doesn't correct it.

Can someone see something simple that I am missing here?  Thanks,

Guy
-- 
View this message in context: http://n4.nabble.com/Problems-getting-symbols-to-show-table-data-tp1839676p1890724.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 46
Date: Thu, 15 Apr 2010 17:01:19 +0200
From: Judith Trunschke <J.Trunschke@stud.unibas.ch>
To: r-help@r-project.org
Subject: [R] step size truncated out of bounds
Message-ID: <A7201CEE-EB3F-4512-9CCF-FEE8A1B33610@stud.unibas.ch>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Dear helpers,

in course of my master thesis I trie to program a GLM to model the  
number of seeds produced per flower relates to the time they were  
exposed to pollinators (categorical with two levels), the altitude of  
population (categorical with two levels) and the species (categorical  
with six levels).
Since I have lots of zeros in my data and detected overdispersion when  
simply using family=poisson, I choose the quasi family. With the  
according default link option the homogeneity of variance in the  
residuals is violated and so I tried to set link=sqrt and the  
variance=mu^2. This combination should work, but unfortunately it does 
not. I first got the warning message to specify starting values which  
I hopefully solved right and I got the summary output and residuals  
plots. But the anova output still do not work by printing the  
following warning message: step size truncated out of bounds. I  
searched in the R helping mail list and also tried to contact people  
that once had similar problems, but got no reply.
I would be glad if anybody cound explain what happens, and point out a  
solution for me to get the anova(model) output.

Thank you a lot in advance.

Sincerely,

Judith Trunschke



------------------------------

Message: 47
Date: Thu, 15 Apr 2010 08:52:26 -0400
From: Vijay Nori <vijay.nori@gmail.com>
To: Dennis Murphy <djmuser@gmail.com>, r-help@r-project.org
Subject: Re: [R] search and replace
Message-ID:
    <n2t87dab4e81004150552rd4b503edu8e6fb7c679231713@mail.gmail.com>
Content-Type: text/plain

Dennis -- it does! However, how can a more generic situation be handled
where
South,North,East,West are replaced by x2,d6,qqw,mQ  respectively?  Thanks.

On Wed, Apr 14, 2010 at 11:41 PM, Dennis Murphy <djmuser@gmail.com> wrote:

> Hi:
>
> Does this work for you?
>

    [[alternative HTML version deleted]]



------------------------------

Message: 48
Date: Thu, 15 Apr 2010 09:33:37 -0400
From: Vijay Nori <vijay.nori@gmail.com>
To: hadley wickham <h.wickham@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] sum specific rows in a data frame
Message-ID:
    <w2n87dab4e81004150633y40c6183az703868c8f14a620e@mail.gmail.com>
Content-Type: text/plain

This is very cool...thanks Hadley. When are you planning to release that
version?

On Thu, Apr 15, 2010 at 9:09 AM, hadley wickham <h.wickham@gmail.com> wrote:

> On Thu, Apr 15, 2010 at 1:16 AM, Chuck <vijay.nori@gmail.com> wrote:
> > Depending on the size of the dataframe and the operations you are
> > trying to perform, aggregate or ddply may be better.  In the function
> > below, df has the same structure as your dataframe.
>
> So there are some big speed improvements in the works.
>
> Hadley
>
>

    [[alternative HTML version deleted]]



------------------------------

Message: 49
Date: Thu, 15 Apr 2010 11:32:09 -0400
From: Ines Azaiez <iazaiez@mit.edu>
To: Ravi Varadhan <rvaradhan@jhmi.edu>,
    "r-help-bounces@stat.math.ethz.ch"    <r-help-bounces@stat.math.ethz.ch>,
    "r-help@r-project.org"    <r-help@r-project.org>
Subject: Re: [R] Gaussian Quadrature Numerical Integration In R
Message-ID:
    <3BC44BCACA60F3439EE06B100CC1B7EA0274E819@EXPO17.exchange.mit.edu>
Content-Type: text/plain; charset="us-ascii"

Hi Ravi,
Thanks for your response. I already considered the change of variables but I was wondering if there were already a function in R which do the same thing in an optimized way. My function f(x) is complicated so adding a change of variable makes the algorithm takes a lot of time to give outputs.
Thanks,
Iazaiez.
________________________________________
From: Ravi Varadhan [rvaradhan@jhmi.edu]
Sent: Wednesday, April 14, 2010 12:50 PM
To: Ines Azaiez; r-help-bounces@stat.math.ethz.ch; r-help@r-project.org
Subject: RE: [R] Gaussian Quadrature Numerical Integration In R

Just do a variable transformation. If your function is f(x), your new
function would be:
        f'(x) = sigma * f(sigma * x + mu).  You can integrate f'(x) using
the Hermite quadrature.

Ravi.

-----Original Message-----
From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] On
Behalf Of Ines Azaiez
Sent: Tuesday, April 13, 2010 9:25 PM
To: r-help-bounces@stat.math.ethz.ch; r-help@r-project.org
Subject: [R] Gaussian Quadrature Numerical Integration In R

Hi All,

I am trying to use A Gaussian quadrature over the interval (-infty,infty)
with weighting function W(x)=exp(-(x-mu)^2/sigma) to estimate an integral.
Is there a way to do it in R? Is there a function already implemented which
uses such weighting function.
I have been searching in the statmode package and I found the function
"gauss.quad(100, kind="hermite")" which uses the weighting function
W(x)=exp(-x^2). Is there a more general version of this weighting function
(using mu and sigma)?

Thanks for your help

Iazaiez
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 50
Date: Thu, 15 Apr 2010 17:37:08 +0200
From: Asif Wazir <asifwazir01@gmail.com>
To: r-help@r-project.org
Subject: [R] using nls for gamma distribution (a,b,d)
Message-ID:
    <t2xcf12e85c1004150837y5c06384fz80bee7ab9b2df03d@mail.gmail.com>
Content-Type: text/plain

Dear all
i want to estimated the parameter of the gamma density(a,b,d)

f(x) = (1/gamma(b)*(a^b)) * ((x-d)^(b-1)) * exp{-(x-d)/a)} for x>d

f(x) = Age specific fertility rate
x = age
when i run this in R by usling nls()

gamma.asfr <- formula(asfr ~ (((age-d)^(b-1))/((gamma(b))*(a^b)))*
exp(-((age-d)/a)))

gamma.asfr1 <- nls(gamma.asfr, data= asfr.aus, start = list(b = 28, a = 1,
d= 0.5), trace = TRUE)

error: Error in numericDeriv(form[[3L]], names(ind), env) :  Missing value
or an infinity produced when evaluating the model

when I use plinear algoritm, and run this

gamma.asfr1 <- nls(gamma.asfr, data= asfr.aus, start = list(b = 28, a = 1,
d= 0.5), trace = TRUE, algorithm="plinear")

error: number of iterations exceeded maximum of 50

then i fix the iteration and minFactor even then its can't work

gamma.asfr1 <- nls(gamma.asfr, data= asfr.aus, start = list(b = 28, a = 1,
d= 0.5), trace = TRUE, algorithm="plinear", nls.control(maxiter=500,
minFactor=0.000001))

error: Missing value or an infinity produced when evaluating the model

Can any body tell the problem, where i am doing wrong


thanks in advanc
..
Muhammad Asif Wazir
Ph.D student
Institut für Statistik und Decision Support Systems (ISDS).
University of Vienna, Austria
cell: 00436509092298

    [[alternative HTML version deleted]]



------------------------------

Message: 51
Date: Thu, 15 Apr 2010 15:42:26 +0000
From: David Hardie <dreamwaters@hotmail.com>
To: <r-help@r-project.org>
Subject: [R] can't find "daphnia.txt" and others while working through
    Crawley's R-Book
Message-ID: <BLU137-W23C27FA9633E0AAA7CFC74B60F0@phx.gbl>
Content-Type: text/plain


I have a feeling that this is an embarassingly simple fix, but I've been at it for most of the morning and can't get things figured out.



I'm trying to work through some examples in Crawley's "The R Book".  I have installed packages and libraries as described in the book, but when I try, for example:



data<-read.table("c:\\temp\\daphnia.txt", header=T)



I get:



Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'c:\temp\daphnia.txt': No such file or directory


There is nothing in my c:\temp folder, so I'm not suprised that it doesn't work, but I can't for the life of me figure out which package or library I will need to gain access to this and other data files used in this book.



Thanks in advance,

-Dave
                          
_________________________________________________________________


    [[alternative HTML version deleted]]



------------------------------

Message: 52
Date: Thu, 15 Apr 2010 08:49:15 -0700
From: "Charles C. Berry" <cberry@tajo.ucsd.edu>
To: Kenneth Lo <kenchlo2@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Efficient algorithm to get a solution path for ridge
    regression?
Message-ID: <Pine.LNX.4.64.1004150846300.32211@tajo.ucsd.edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Wed, 14 Apr 2010, Kenneth Lo wrote:

> With the use of the LARS algorithm, a path of solutions corresponding to a 
> sequence of the regularization parameter can be obtained for LASSO (or even 
> the elastic net, a hybrid between LASSO and ridge) at the cost of one linear 
> regression. In terms of computational speed LASSO seems to have beaten ridge 
> regression, the solution of which needs to be computed individually, at the 
> cost of one linear regression, for each regularization parameter. Is there 
> any efficient method to compute a path of solutions for ridge regression
> corresponding to a sequence of the regularization parameter? Thanks.

Yes.

Check a textbook like Draper and Smith. Or Google for course notes.

HTH,

Chuck

>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry@tajo.ucsd.edu                UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



------------------------------

Message: 53
Date: Thu, 15 Apr 2010 12:01:41 -0400
From: "R Heberto Ghezzo, Dr" <heberto.ghezzo@mcgill.ca>
To: "r-help@r-project.org" <r-help@r-project.org>
Subject: [R] Poblems wih EBImage
Message-ID:
    <C0F68778F3A5F545A370AECD9CC6BD9D07BFE0CE8C@EXMBXVS1.campus.mcgill.ca>
Content-Type: text/plain; charset="us-ascii"

Hello, Working with Windows 7 in a HP laptop with R-2.10.1
I download and installed ImageMagick-6.3.7.7-Q16-Windows-dll.exe and GTK 2.12.9-win32-2, then downloaded and installed from local file EBImage_3.2.0.zip and I got:
> library(EBImage)
Loading required package: abind
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared library 'C:/Programs/R/Cran/EBImage/libs/EBImage.dll':
  LoadLibrary failure:  The specified module could not be found.

In addition: Warning message:
package 'abind' was built under R version c(2, 5, 0) and help will not work correctly
Please re-install it 
Error: package/namespace load failed for 'EBImage'
>
the location "C:\Programs\R\Cran\EBImage\libs\EBImage.dll" exists
Can somebody tell me what is wrong?
Thanks
Heberto Ghezzo
McGill University
Canada


------------------------------

Message: 54
Date: Thu, 15 Apr 2010 09:05:01 -0700 (PDT)

To: Amit Patel <amitrhelp@yahoo.co.uk>, R-help@r-project.org
Subject: Re: [R] Help with TukeyHSD
Message-ID: <629880.57321.qm@web38601.mail.mud.yahoo.com>
Content-Type: text/plain; charset=us-ascii

Hi,
Is this what you want?


?TukeyHSD
summary(fm1 <- aov(breaks ~ wool + tension, data = warpbreaks))
tk.fm1<-TukeyHSD(fm1, "tension", ordered = TRUE)
tk.fm1
(tk.fm1[[1]][,4])




Eugen Pircalabelu
(0032)471 842 140
(0040)727 839 293



----- Original Message ----
From: Amit Patel <amitrhelp@yahoo.co.uk>
To: R-help@r-project.org
Sent: Thu, April 15, 2010 4:46:08 PM
Subject: [R] Help with TukeyHSD

Hi

I am conducting ANOVA using the aov function
I am also conducting TukeyHSD to obtain which of the groups show variance
How can I obtain the first three p values from the list below?

>zzz.aov <- aov(Intensity ~ Group, data = zzzanova)

> TukeyHSD(zzz.aov) 
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = Intensity ~ Group, data = zzzanova)

$Group
                      diff       lwr      upr     p adj
Group2-Group1  0.778354812 -3.414233 4.970943 0.9607836
Group3-Group1 -0.734044848 -5.073786 3.605696 0.9698685
Group4-Group1 -0.000158625 -4.192747 4.192429 1.0000000
Group3-Group2 -1.512399661 -5.852140 2.827341 0.7933015
Group4-Group2 -0.778513438 -4.971101 3.414075 0.9607611
Group4-Group3  0.733886223 -3.605855 5.073627 0.9698870





______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: Thu, 15 Apr 2010 12:09:46 -0400
From: "Ravi Varadhan" <rvaradhan@jhmi.edu>
To: "'Ines Azaiez'" <iazaiez@MIT.EDU>,
    <r-help-bounces@stat.math.ethz.ch>,    <r-help@r-project.org>
Subject: Re: [R] Gaussian Quadrature Numerical Integration In R
Message-ID: <000001cadcb6$119a6490$34cf2db0$@edu>
Content-Type: text/plain;    charset="us-ascii"

Here is an example showing how to use variable transformation:

    k <- 5

    myfn <- function(x, k) exp(-k * x^2)  # this is the integrand over
(-Inf, +Inf)

    # Integration using `integrate' function

    ans1 <- integrate(myfn, lower=-Inf, upper=Inf, k=k)$val

    # Now we integrate using Gauss-Hermite quadrature

    require(statmod)

    n <- 10

    gherm <- gauss.quad(n, kind="hermite")

    myfn.new <- function(x) 1

    mu <- 0

    sigma <- 1/sqrt(k)

    # following line shows how to use variable transformation 

    ans2 <- sum(gherm$weights * sigma * myfn.new(sigma*gherm$nodes +
mu))  

    ans2

    all.equal(ans1, ans2)
     
Hope this helps,
Ravi.

-----Original Message-----
From: Ines Azaiez [mailto:iazaiez@MIT.EDU] 
Sent: Thursday, April 15, 2010 11:32 AM
To: Ravi Varadhan; r-help-bounces@stat.math.ethz.ch; r-help@r-project.org
Subject: RE: [R] Gaussian Quadrature Numerical Integration In R

Hi Ravi,
Thanks for your response. I already considered the change of variables but I
was wondering if there were already a function in R which do the same thing
in an optimized way. My function f(x) is complicated so adding a change of
variable makes the algorithm takes a lot of time to give outputs.
Thanks,
Iazaiez.
________________________________________
From: Ravi Varadhan [rvaradhan@jhmi.edu]
Sent: Wednesday, April 14, 2010 12:50 PM
To: Ines Azaiez; r-help-bounces@stat.math.ethz.ch; r-help@r-project.org
Subject: RE: [R] Gaussian Quadrature Numerical Integration In R

Just do a variable transformation. If your function is f(x), your new
function would be:
        f'(x) = sigma * f(sigma * x + mu).  You can integrate f'(x) using
the Hermite quadrature.

Ravi.

-----Original Message-----
From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] On
Behalf Of Ines Azaiez
Sent: Tuesday, April 13, 2010 9:25 PM
To: r-help-bounces@stat.math.ethz.ch; r-help@r-project.org
Subject: [R] Gaussian Quadrature Numerical Integration In R

Hi All,

I am trying to use A Gaussian quadrature over the interval (-infty,infty)
with weighting function W(x)=exp(-(x-mu)^2/sigma) to estimate an integral.
Is there a way to do it in R? Is there a function already implemented which
uses such weighting function.
I have been searching in the statmode package and I found the function
"gauss.quad(100, kind="hermite")" which uses the weighting function
W(x)=exp(-x^2). Is there a more general version of this weighting function
(using mu and sigma)?

Thanks for your help

Iazaiez
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: Thu, 15 Apr 2010 10:15:28 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Steve Murray <smurray444@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Alignment of x-axis labels
Message-ID: <4BC73BA0.9020105@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 2010-04-15 7:23, Steve Murray wrote:
>
> Dear all,
>
> I'm having trouble getting the correct spacing between x-axis labels on a barplot. This is the command I'm using to generate the plot:
>
> temp<- barplot(precip, beside=TRUE, xaxt="n", las=1, xpd=FALSE, col="grey28", ylim=c(0, max(precip)))
>
> Here is the structure of temp:
>> str(temp)
>   num [1:96, 1] 0.7 1.9 3.1 4.3 5.5 6.7 7.9 9.1 10.3 11.5 ...
>
> And here is the structure of the data being plotted:
>> str(precip)
>   num [1:96] 1841 2871 9254 22335 30682 ...
>
>> length(precip)
> [1] 96
>
> These are monthly data points for 8 years (8 * 12 = 96), but I only want to have labels for each year (1978 to 1985), rather than every month. So I tried using the following command, but this results in the labels not being far enough apart, and therefore they don't fill the length of the x-axis (and don't align properly with the corresponding first bar of every year):
>
> axis(1, at=seq(1,96,12), 1978:1985)

Your seq() needs to index the elements of temp.
Something like

  axis(1, at = temp[seq(...)], ...)

  -Peter Ehlers

>
>
> This one has stumped me somewhat, so I'd be grateful to receive any suggestions as to how I might resolve this.
>
> Many thanks,
>
> Steve
>                           
> _________________________________________________________________
>
> We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 57
Date: Thu, 15 Apr 2010 18:22:30 +0200
From: "Michael Stegh" <r-project@michael-stegh.com>
To: r-help@r-project.org
Subject: [R] Problem with ONE of the Special German Characters
Message-ID: <4BC73D46.23462.5D58D8C@r-project.michael-stegh.com>
Content-Type: text/plain

Dear List,

I have data which contain the special German characters "ä", "ö", "ü" etc. After reading the
text files into R those characters are displayed strangely, e. g. "ä" is  "Ã¤". The first step is to
replace those with their typical transcription, e. g. "ä" becomes "ae" by using the gsub
command.

Until I upgraded to version 2.10.1 (from 2.8.0) this worked perfectly for all characters. Now it
works for all characters but "Ü".

temp1<-gsub("Ãoe","Ue",temp1)

This letter is displayed as "Ãoe" (as before), but R is no longer able to find this character. The
problem seems to be linked to the "oe" part, since I could substitute for "Ã" without a problem.
Strangely if I get the two characters by extracting them with the substr command to a variable
and then using the variable I am able to substitute without a problem. Any ideas, what I am
missing?

Thanks,

Michael

    [[alternative HTML version deleted]]



------------------------------

Message: 58
Date: Thu, 15 Apr 2010 12:28:54 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: David Hardie <dreamwaters@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] can't find "daphnia.txt" and others while working
    through    Crawley's R-Book
Message-ID: <FBBCCB21-E1B4-4173-8E92-AF44EFF64E56@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 11:42 AM, David Hardie wrote:

>
> I have a feeling that this is an embarassingly simple fix, but I've  
> been at it for most of the morning and can't get things figured out.
>
> I'm trying to work through some examples in Crawley's "The R Book".   
> I have installed packages and libraries as described in the book,  
> but when I try, for example:
>
> data<-read.table("c:\\temp\\daphnia.txt", header=T)
>
>
> I get:
>
> Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
> cannot open file 'c:\temp\daphnia.txt': No such file or directory
>
>
> There is nothing in my c:\temp folder, so I'm not suprised that it  
> doesn't work, but I can't for the life of me figure out which  
> package or library I will need to gain access to this and other data  
> files used in this book.

This would appear to be more a problem with you lack of understanding  
regarding the file management utilities of Windows. In Linux or a Mac  
you could use the locate function to track down where the file ended  
up, but surely whatever Windows version you have allows such searching.

-- 
David.
>
>
>
> Thanks in advance,
>
> -Dave
>                     


David Winsemius, MD
West Hartford, CT



------------------------------

Message: 59
Date: Thu, 15 Apr 2010 16:34:07 +0000
From: David Hardie <dreamwaters@hotmail.com>
To: <dwinsemius@comcast.net>
Cc: r-help@r-project.org
Subject: Re: [R] can't find "daphnia.txt" and others while working
    through Crawley's R-Book
Message-ID: <BLU137-W53D985B840F378A721D28B60F0@phx.gbl>
Content-Type: text/plain


Thanks David, but I have searched my hard drive using the search utility in Windows (not just c:\temp - the whole drive) for the file in question and it is not there.  I have also used:

data() to see the names of all dataframes in the datasets package as well as:

data(package=.packages(all.available=TRUE)) to see all available data sets

Both methods provide an extensive list, but not "daphnia.txt"



-Dave

> CC: r-help@r-project.org
> From: dwinsemius@comcast.net
> To: dreamwaters@hotmail.com
> Subject: Re: [R] can't find "daphnia.txt" and others while working through Crawley's R-Book
> Date: Thu, 15 Apr 2010 12:28:54 -0400
> 
> 
> On Apr 15, 2010, at 11:42 AM, David Hardie wrote:
> 
> >
> > I have a feeling that this is an embarassingly simple fix, but I've 
> > been at it for most of the morning and can't get things figured out.
> >
> > I'm trying to work through some examples in Crawley's "The R Book". 
> > I have installed packages and libraries as described in the book, 
> > but when I try, for example:
> >
> > data<-read.table("c:\\temp\\daphnia.txt", header=T)
> >
> >
> > I get:
> >
> > Error in file(file, "rt") : cannot open the connection
> > In addition: Warning message:
> > In file(file, "rt") :
> > cannot open file 'c:\temp\daphnia.txt': No such file or directory
> >
> >
> > There is nothing in my c:\temp folder, so I'm not suprised that it 
> > doesn't work, but I can't for the life of me figure out which 
> > package or library I will need to gain access to this and other data 
> > files used in this book.
> 
> This would appear to be more a problem with you lack of understanding 
> regarding the file management utilities of Windows. In Linux or a Mac 
> you could use the locate function to track down where the file ended 
> up, but surely whatever Windows version you have allows such searching.
> 
> -- 
> David.
> >
> >
> >
> > Thanks in advance,
> >
> > -Dave
> > 
> 
> 
> David Winsemius, MD
> West Hartford, CT
> 
                          
_________________________________________________________________


    [[alternative HTML version deleted]]



------------------------------

Message: 60
Date: Thu, 15 Apr 2010 11:34:47 -0500 (CDT)
From: luke@stat.uiowa.edu
To: baptiste auguie <baptiste.auguie@googlemail.com>
Cc: r-help <r-help@r-project.org>
Subject: Re: [R] Exporting an rgl graph
Message-ID:
    <alpine.LFD.2.00.1004151128410.12182@nokomis.stat.uiowa.edu>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"

The current issue of JCGS (Vol 18 No 1,
http://pubs.amstat.org/toc/jcgs/19/1) has an editorial on including
animations, 3D visualizations, and movies in on-line PDF files
supporting JCGS articles. The online supplements to the editorial
include examples.  The 3D examples related to the misc3d packages are
also available in
http://www.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/.  At some point
the code there will be added to misc3d.  It should be possible to
adapt these ideas to other objects rendered with rgl.

luke


On Thu, 15 Apr 2010, baptiste auguie wrote:

> I have seen pdf files with 3D objects embedded in it, using the U3D format,
> http://en.wikipedia.org/wiki/Universal_3D
>
> but I don't think there's a device for this in R; in fact there may
> not even exist a third-party post-processing route available at this
> time to bridge the gap between rgl and this format. It sure would be
> nice, though.
>
> Best,
>
> baptiste
>
>
>
> On 15 April 2010 14:12, Barry Rowlingson <b.rowlingson@lancaster.ac.uk> wrote:
>> On Thu, Apr 15, 2010 at 1:01 PM, ?<cgenolin@u-paris10.fr> wrote:
>>> Thanks for you answer. Let me precise my question.
>>>
>>> In fact, I do not want to "capture" a screen, I want to save an object that
>>> can be seen in 3D. With rgl, using my mouse, I can make the object move.
>>> This is what I want to export: an real 3D object that my collaborator will
>>> have the possibility to see in 3D.
>>>
>>
>> ?You mean without them having to install R and rgl and run the code
>> that produces your graphic?
>>
>> ?I guess you could somehow export a VRML or some other 3d file:
>>
>> ?http://en.wikipedia.org/wiki/VRML
>>
>> ?but I suspect of all the billions of people on the planet only Duncan
>> Murdoch knows enough about rgl to figure that one out...
>>
>> ?The person at the other end would still need a VRML viewer. Just get
>> them to install R.
>>
>> Barry
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke@stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

------------------------------

Message: 61
Date: Thu, 15 Apr 2010 12:35:12 -0400
From: Zev Ross <zev@zevross.com>
To: Wensui Liu <liuwensui@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Add header line to large text file
Message-ID: <4BC74040.3010609@zevross.com>
Content-Type: text/plain; charset="ISO-8859-1"


   Thanks to Wensui Liu and Jim Holtman for responses. Using sed was a good,
   quick (non-R) suggestion. Thanks! Zev
   Wensui Liu wrote:

if i were you, i probably will use 1 line of sed to do such task
instead of R to insert headers in the file.

On Thu, Apr 15, 2010 at 10:34 AM, Zev Ross [1]<zev@zevross.com> wrote:


All,

I have a 30 million record text file without header information. I would
like to add a header to this file without reading it first. Is this
possible? The code below does what I want except that the readLines portion
takes quite a long time. Is there a way around reading the lines? I'm
working on Windows XP.

Zev

input<-readLines("c:/junk/forR.csv")
input<-c(c('"a", "b", "c", "d", "e", "f"'), input)
writeLines(input, "c:/junk/forRfix.csv")

--
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
[2]zev@zevross.com

______________________________________________
[3]R-help@r-project.org mailing list
[4]https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide [5]http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.







--
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
[6]zev@zevross.com

References

   1. mailto:zev@zevross.com
   2. mailto:zev@zevross.com
   3. mailto:R-help@r-project.org
   4. https://stat.ethz.ch/mailman/listinfo/r-help
   5. http://www.R-project.org/posting-guide.html
   6. mailto:zev@zevross.com


------------------------------

Message: 62
Date: Thu, 15 Apr 2010 11:40:30 -0500
From: Frank E Harrell Jr <f.harrell@Vanderbilt.Edu>
To: Michael Dykes <thedoctor81877@gmail.com>, r-help-request Mailing
    List    <r-help@r-project.org>
Subject: Re: [R] Regression w/ interactions
Message-ID: <4BC7417E.8000709@vanderbilt.edu>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

Michael Dykes wrote:
> So, am i wrong to /assume /that the reasons my professor is asking us to
> find a high R^2 & adjusted R^2, low Cp (near what p+1, if i remember 
> correctly), low PRESS, & AIC is b/c the data is randomly generated (b/c 
> he has stated that all of the data for *all *of these hw assignments are
> randomly generated)?  And i am not /exactly /sure to what you are 
> referring when you say: 'low signal to noise ratios'. Do you mean /low 
> /R^2 to epsilon_i's? or /low /predictors to epsilon i's? Please excuse 
> my ignorance in these matters, but I am not only asking these questions 
> for hw sakes's but for my future, as I hope to study for the actuarial 
> exams & take the Probability Test sometime either next Spring or Summer 
> [after taking this professors Calculus-based Prob & Stat sequence in the
> coming Fall & Spring Semester].
> 
> Thanks again for your help, Professor.

Let me just add that a valid test of whether any of the variables or 
interactions is associated with Y is to formulate a model with all the 
parameters in it and to use the global F test.

Stepwise techniques such as you are being asked to use are not 
scientific.  If the true R^2 (which you do not know) is not high, the 
low signal:noise ratio makes the data incapable to telling you the 
"right" variables to include with any reliability.  Unfortunately, most 
teachers of statistics do not understand this point, so you might be 
graded off for providing the right answer.

Frank

> 
> On Thu, Apr 15, 2010 at 8:26 AM, Frank E Harrell Jr 
> <f.harrell@vanderbilt.edu <mailto:f.harrell@vanderbilt.edu>> wrote:
> 
>     Michael Dykes wrote:
> 
>         I have a project due in my Linear Regression class re:
>         regression on a data
>         set & my professor gave us a hint that there were *exactly *2 sig
>         interactions. The data set is attached. We have to find which
>         predictors are
>         significant, & which 2 interactions are sig. Also, I nedd some
>         guidance for
>         this & selecting the best model. I tried the `full' model, that
>         being:
>         z=lm(y~x1+x2+x3+x4+x1*x2+x2*x3...+x3*x4). I then ran an anova(z), &
>         summary(z). My R^2 & R^2_a were *really* low. I am not sure how
>         to do PRESS,
>         AIC & Cp in R yet though. Any help would be appreciated.
> 
> 
> 
>     Michael this is not really the place for help on homework other than
>     perhaps on technical roadblocks.  Note that the strategy you are
>     being told to follow is one whose statistical properties have been
>     severely criticized in the statistical literature.  Only with a very
>     high signal to noise ratio (e.g., high true R^2) can torturing data
>     lead to a confession to something other than what the analyst wants
>     to hear.  I suppose that in simulated data there is a "true" model
>     out there waiting to be found, but beware of using this approach
>     with real data with low signal to noise ratios.
> 
>     Frank
> 
> 
>     -- 
>     Frank E Harrell Jr   Professor and Chairman        School of Medicine
>                         Department of Biostatistics   Vanderbilt University
> 
> 
>



------------------------------

Message: 63
Date: Thu, 15 Apr 2010 11:42:21 -0500
From: Christian Raschke <crasch2@tigers.lsu.edu>
To: r-help@r-project.org
Subject: Re: [R] can't find "daphnia.txt" and others while working
    through Crawley's R-Book
Message-ID: <4BC741ED.4030002@tigers.lsu.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

The files associated with the book can be found on the author's website 
here:

http://www.bio.ic.ac.uk/research/mjcraw/therbook/index.htm 
<http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/>

Just download what you need and put the files somewhere where you can 
find them.

HTH,
Christian


On 04/15/2010 11:34 AM, David Hardie wrote:
> Thanks David, but I have searched my hard drive using the search utility in Windows (not just c:\temp - the whole drive) for the file in question and it is not there.  I have also used:
>
> data() to see the names of all dataframes in the datasets package as well as:
>
> data(package=.packages(all.available=TRUE)) to see all available data sets
>
> Both methods provide an extensive list, but not "daphnia.txt"
>
>
>
> -Dave
>
>    
>> CC: r-help@r-project.org
>> From: dwinsemius@comcast.net
>> To: dreamwaters@hotmail.com
>> Subject: Re: [R] can't find "daphnia.txt" and others while working through Crawley's R-Book
>> Date: Thu, 15 Apr 2010 12:28:54 -0400
>>
>>
>> On Apr 15, 2010, at 11:42 AM, David Hardie wrote:
>>
>>      
>>> I have a feeling that this is an embarassingly simple fix, but I've
>>> been at it for most of the morning and can't get things figured out.
>>>
>>> I'm trying to work through some examples in Crawley's "The R Book".
>>> I have installed packages and libraries as described in the book,
>>> but when I try, for example:
>>>
>>> data<-read.table("c:\\temp\\daphnia.txt", header=T)
>>>
>>>
>>> I get:
>>>
>>> Error in file(file, "rt") : cannot open the connection
>>> In addition: Warning message:
>>> In file(file, "rt") :
>>> cannot open file 'c:\temp\daphnia.txt': No such file or directory
>>>
>>>
>>> There is nothing in my c:\temp folder, so I'm not suprised that it
>>> doesn't work, but I can't for the life of me figure out which
>>> package or library I will need to gain access to this and other data
>>> files used in this book.
>>>        
>> This would appear to be more a problem with you lack of understanding
>> regarding the file management utilities of Windows. In Linux or a Mac
>> you could use the locate function to track down where the file ended
>> up, but surely whatever Windows version you have allows such searching.
>>
>> -- 
>> David.
>>      
>>>
>>>
>>> Thanks in advance,
>>>
>>> -Dave
>>>
>>>        
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>      
>                           
> _________________________________________________________________
>
>
>     [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>    


-- 
Christian Raschke
Department of Economics
and
ISDS Research Lab (HSRG)
Louisiana State University
Patrick Taylor Hall, Rm 2128
Baton Rouge, LA 70803
(225)226-0017
crasch2@lsu.edu



------------------------------

Message: 64
Date: Thu, 15 Apr 2010 10:48:20 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Asif Wazir <asifwazir01@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] using nls for gamma distribution (a,b,d)
Message-ID: <4BC74354.5080703@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I don't know what else is wrong, but do you really want
a shape parameter equal to 28? gamma(28) is about 10^28.
That's not a model I would trust.

  -Peter Ehlers

On 2010-04-15 9:37, Asif Wazir wrote:
> Dear all
> i want to estimated the parameter of the gamma density(a,b,d)
>
> f(x) = (1/gamma(b)*(a^b)) * ((x-d)^(b-1)) * exp{-(x-d)/a)} for x>d
>
> f(x) = Age specific fertility rate
> x = age
> when i run this in R by usling nls()
>
> gamma.asfr<- formula(asfr ~ (((age-d)^(b-1))/((gamma(b))*(a^b)))*
> exp(-((age-d)/a)))
>
> gamma.asfr1<- nls(gamma.asfr, data= asfr.aus, start = list(b = 28, a = 1,
> d= 0.5), trace = TRUE)
>
> error: Error in numericDeriv(form[[3L]], names(ind), env) :  Missing value
> or an infinity produced when evaluating the model
>
> when I use plinear algoritm, and run this
>
> gamma.asfr1<- nls(gamma.asfr, data= asfr.aus, start = list(b = 28, a = 1,
> d= 0.5), trace = TRUE, algorithm="plinear")
>
> error: number of iterations exceeded maximum of 50
>
> then i fix the iteration and minFactor even then its can't work
>
> gamma.asfr1<- nls(gamma.asfr, data= asfr.aus, start = list(b = 28, a = 1,
> d= 0.5), trace = TRUE, algorithm="plinear", nls.control(maxiter=500,
> minFactor=0.000001))
>
> error: Missing value or an infinity produced when evaluating the model
>
> Can any body tell the problem, where i am doing wrong
>
>
> thanks in advanc
> ..
> Muhammad Asif Wazir
> Ph.D student
> Institut f?r Statistik und Decision Support Systems (ISDS).
> University of Vienna, Austria
> cell: 00436509092298
>
>     [[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 65
Date: Thu, 15 Apr 2010 13:00:45 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: luke@stat.uiowa.edu
Cc: r-help <r-help@r-project.org>
Subject: Re: [R] Exporting an rgl graph
Message-ID: <51420041-379B-4D5A-BBFA-69717A89458C@comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes


On Apr 15, 2010, at 12:34 PM, luke@stat.uiowa.edu wrote:

> The current issue of JCGS (Vol 18 No 1,
> http://pubs.amstat.org/toc/jcgs/19/1 ) has an editorial on including
> animations, 3D visualizations, and movies in on-line PDF files
> supporting JCGS articles. The online supplements to the editorial
> include examples.  The 3D examples related to the misc3d packages are
> also available in
> http://www.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/.  At some point
> the code there will be added to misc3d.  It should be possible to
> adapt these ideas to other objects rendered with rgl.

Very kewl. On a Mac the greyscale plots opened in Adobe Acrobat Reader  
v8.2.2 displays properly, but the color version supp_j.pdf looks like  
a m?nage ? trois of three psychedelic sea urchins. I think that Adobe  
may need to do some work on their display engine for this to be a  
fully cross-platform combination. The color version of the volcano  
example is likewise carpeted with spiky artifacts.

(I have not yet tried producing plots de novo with the Mac pdf device.)

-- 
David.

> luke
>
>
> On Thu, 15 Apr 2010, baptiste auguie wrote:
>
>> I have seen pdf files with 3D objects embedded in it, using the U3D  
>> format,
>> http://en.wikipedia.org/wiki/Universal_3D
>>
>> but I don't think there's a device for this in R; in fact there may
>> not even exist a third-party post-processing route available at this
>> time to bridge the gap between rgl and this format. It sure would be
>> nice, though.
>>
>> Best,
>>
>> baptiste
>>
>> On 15 April 2010 14:12, Barry Rowlingson <b.rowlingson@lancaster.ac.uk 
>> > wrote:
>>> On Thu, Apr 15, 2010 at 1:01 PM,  <cgenolin@u-paris10.fr> wrote:
>>>> Thanks for you answer. Let me precise my question.
>>>>
>>>> In fact, I do not want to "capture" a screen, I want to save an  
>>>> object that
>>>> can be seen in 3D. With rgl, using my mouse, I can make the  
>>>> object move.
>>>> This is what I want to export: an real 3D object that my  
>>>> collaborator will
>>>> have the possibility to see in 3D.
>>>>
>>>
>>>  You mean without them having to install R and rgl and run the code
>>> that produces your graphic?
>>>
>>>  I guess you could somehow export a VRML or some other 3d file:
>>>
>>>  http://en.wikipedia.org/wiki/VRML
>>>
>>>  but I suspect of all the billions of people on the planet only  
>>> Duncan
>>> Murdoch knows enough about rgl to figure that one out...
>>>
>>>  The person at the other end would still need a VRML viewer. Just 
>>> get
>>> them to install R.
>>>
>>> Barry
>>
>
> -- 
> Luke Tierney
> Chair, Statistics and Actuarial Science


David Winsemius, MD
West Hartford, CT



------------------------------

Message: 66
Date: Thu, 15 Apr 2010 13:07:40 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: David Hardie <dreamwaters@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] can't find "daphnia.txt" and others while working
    through    Crawley's R-Book
Message-ID: <A9C919E6-1567-42E1-8DE6-8C98ABAF31C3@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 12:34 PM, David Hardie wrote:

> Thanks David, but I have searched my hard drive using the search  
> utility in Windows (not just c:\temp - the whole drive) for the file  
> in question and it is not there.  I have also used:
> data() to see the names of all dataframes in the datasets package as  
> well as:
> data(package=.packages(all.available=TRUE)) to see all available  
> data sets
> Both methods provide an extensive list, but not "daphnia.txt"
>
> -Dave

A google search suggested that it was at one time available here, and  
testing shows that it still is:

http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/Daphnia.txt

Looking inside the first few pages of the book, it appears this should  
have been accessible from the book's associated website. I bought the  
book several months ago, but it has remained mostly unused because I  
found it quite limited in its depth of presentation of topics in which  
I had an interest.

-- 
David

>
> > CC: r-help@r-project.org
> > From: dwinsemius@comcast.net
> > To: dreamwaters@hotmail.com
> > Subject: Re: [R] can't find "daphnia.txt" and others while working  
> through Crawley's R-Book
> > Date: Thu, 15 Apr 2010 12:28:54 -0400
> >
> >
> > On Apr 15, 2010, at 11:42 AM, David Hardie wrote:
> >
> > >
> > > I have a feeling that this is an embarassingly simple fix, but  
> I've
> > > been at it for most of the morning and can't get things figured  
> out.
> > >
> > > I'm trying to work through some examples in Crawley's "The R  
> Book".
> > > I have installed packages and libraries as described in the book,
> > > but when I try, for example:
> > >
> > > data<-read.table("c:\\temp\\daphnia.txt", header=T)
> > >
> > >
> > > I get:
> > >
> > > Error in file(file, "rt") : cannot open the connection
> > > In addition: Warning message:
> > > In file(file, "rt") :
> > > cannot open file 'c:\temp\daphnia.txt': No such file or directory
> > >
> > >
> > > There is nothing in my c:\temp folder, so I'm not suprised that it
> > > doesn't work, but I can't for the life of me figure out which
> > > package or library I will need to gain access to this and other  
> data
> > > files used in this book.
> >
> > This would appear to be more a problem with you lack of  
> understanding
> > regarding the file management utilities of Windows. In Linux or a  
> Mac
> > you could use the locate function to track down where the file ended
> > up, but surely whatever Windows version you have allows such  
> searching.
> >
> > --
> > David.
> > >
> > >
> > >
> > > Thanks in advance,
> > >
> > > -Dave
> > >
> >
> >
> > David Winsemius, MD
> > West Hartford, CT
> >
>


David Winsemius, MD
West Hartford, CT



------------------------------

Message: 67
Date: Thu, 15 Apr 2010 17:10:05 +0000
From: Steve Murray <smurray444@hotmail.com>
To: <r-help@r-project.org>
Subject: [R] Unwanted boxes in legend
Message-ID: <BAY135-W26F077F8761892FA58BF09880F0@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"


Dear all,

I am using the following code to generate a legend in my plot (consisting of both bars and points), but end up with boxes around my points:

legend(10, par("usr")[4], c("A", "B", "C", "D"), fill=c(NA,NA, "grey28", NA), pch=c(16,4,NA,18), col=c("red","blue","grey28","yellow"), lty=FALSE, bty="n", horiz=FALSE)

I want a box around the third element of the legend (to represent the bar 'fill' colour), but not for the others, where points are shown instead.

What am I doing wrong above and how do I correct it?

Many thanks,

Steve
                          



------------------------------

Message: 68
Date: Thu, 15 Apr 2010 09:25:23 -0800 (PST)
From: Walmes Zeviani <walmeszeviani@hotmail.com>
To: r-help@r-project.org
Subject: Re: [R] using nls for gamma distribution (a,b,d)
Message-ID: <1271352323838-1909193.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


I never had seen someone using a density function for a mean function in
nonlinear regression. The convergence problem observed can be due the model
derivatives respect to the parameters. How could computationally be
d.gamma/d.alpha? digamma function? Does R understand this?

If your phenomena exhibit a gamma density form you could use a mean function
like:

fun <- function(x, alpha, beta, theta){
  x*(alpha+beta*x)^(-1/theta)
}

da <- data.frame(x=1:20)
da$y <- fun(da$x, 1, 2, 0.9)+rnorm(da$x,0,0.001)

plot(y~x, da)
curve(fun(x, 1,2,0.9), 1, 100, add=TRUE)

n0 <- nls(y~fun(x, alpha, beta, theta), data=da,
          start=list(alpha=1, beta=2, theta=0.9))

Or you can use a gamma density without the integration equal one. So, you
can replace the gamma(alpha) for B term:

gammafun <- function(x, alpha, B, b){
  (1/B)*alpha^b*x^(b-1)*exp(-x/alpha)
}

curve(gammafun(x, 5, 1, 2), 0, 20)

da <- data.frame(x=1:20)
da$z <- gammafun(da$x, 5, 1, 2)+rnorm(da$x,0,1)

plot(z~x, da)
curve(gammafun(x, 5, 1, 2), add=TRUE)

n1 <- nls(z~gammafun(x, alpha, B, b), data=da,
          start=list(alpha=5, B=1, b=2))

Sincerely.
Walmes.

-----
..ooo0
...................................................................................................
..(....)... 0ooo...                              Walmes Zeviani
...\..(.....(.....)...     Master in Statistics and Agricultural
Experimentation
....\_)..... )../....       walmeszeviani@hotmail.com, Lavras - MG, Brasil
............
(_/............................................................................................
-- 
View this message in context: http://n4.nabble.com/using-nls-for-gamma-distribution-a-b-d-tp1899967p1909193.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 69
Date: Thu, 15 Apr 2010 13:32:48 -0400
From: Duncan Murdoch <murdoch@stats.uwo.ca>
To: Michael Stegh <r-project@michael-stegh.com>
Cc: r-help@r-project.org
Subject: Re: [R] Problem with ONE of the Special German Characters
Message-ID: <4BC74DC0.8000007@stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 15/04/2010 12:22 PM, Michael Stegh wrote:
> Dear List,
>
> I have data which contain the special German characters "?", "?", "?" etc. After reading the
> text files into R those characters are displayed strangely, e. g. "?" is  "??". The first step is to
> replace those with their typical transcription, e. g. "?" becomes "ae" by using the gsub
> command.
>   

Your example of  "?" is what you would see if you stored it in UTF-8 
encoding, then read it in Latin1.  So I suspect you need to declare the 
encoding of the files you are reading before reading them.  You can do 
this as follows:

con <- file("foo.txt", encoding="UTF-8", open="r")
readLines(con)
close(con)

By default, R assumes the encoding of files matches the default encoding 
on your system. 
> Until I upgraded to version 2.10.1 (from 2.8.0) this worked perfectly for all characters. Now it
> works for all characters but "?".
>
> temp1<-gsub("?oe","Ue",temp1)
>   

You might want to try perl=TRUE in the gsub() call; it seems to handle 
strange characters in regular expressions better than the default TRE 
library does.

Duncan Murdoch

> This letter is displayed as "?oe" (as before), but R is no longer able to find this character. The
> problem seems to be linked to the "oe" part, since I could substitute for "?" without a problem.
> Strangely if I get the two characters by extracting them with the substr command to a variable
> and then using the variable I am able to substitute without a problem. Any ideas, what I am
> missing?
>
> Thanks,
>
> Michael
>
>     [[alternative HTML version deleted]]
>
>   
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 70
Date: Thu, 15 Apr 2010 13:34:39 -0400 (EDT)
From: Jacob Wegelin <jacobwegelin@fastmail.fm>
To: r-help@stat.math.ethz.ch
Subject: [R] fixed portion of lme4 model in newdata
Message-ID: <alpine.OSX.2.01.1004151229020.2838@sphbstr3083-2.local>
Content-Type: text/plain; charset="utf-8"; Format="flowed"


Suppose we have

    ?       An lmer{lme4} model, MyModel, computed on dataframe SomeDATA;

    ?       Dataframe NEWDATA, which contains the variables used in computing MyModel, but different values for these variables.

In NEWDATA I would like to compute (in an automated, quick, easy, non-error-prone manner) the fitted values of the fixed portion of the model. Also I want to compute the standard errors for these fits.

One use of this would be to display graphically the fitted portion of an lmer model so as to see the "effects" of selected variables. For instance, such a display would be useful for judging the *practical* significance of variables that have tested as *statistically* significant.

To this end, I would like to obtain (in an automated manner) the "design matrix" of the model for the NEWDATA, say NEWDATA_designMatrix.  Then the fits would be

NEWDATA_designMatrix %*% cbind(fixef(MyModel))

and the variance of the fits

NEWDATA_designMatrix %*% vcov(MyModel)  %*% t(NEWDATA_designMatrix)

Are not model.frame() and model.matrix() the way to obtain NEWDATA_designMatrix?  Below is an unsuccessful attempt to use these functions.

Can anyone explain how to obtain the desired result?

#    Simulate unbalanced longitudinal data which include a factor (categorical predictor).
set.seed(5)
obsPerID<-5
N_ID<-10
SomeDATA<-data.frame(
    ID=rep( 1:N_ID, each=obsPerID)
    , X=rnorm( obsPerID * N_ID )
    , categ=factor(sample(LETTERS[1:3], size=obsPerID * N_ID, replace=T))
    )
SomeDATA$Y <- SomeDATA$X + SomeDATA$ID + rnorm( obsPerID * N_ID ) / 2 + ifelse(SomeDATA$categ=="C", 5, 0)
SomeDATA<-SomeDATA[order(SomeDATA$ID, SomeDATA$X),]
print(summary(SomeDATA))
library(lattice)
print(
xyplot( Y ~ X | categ, groups=ID, data=SomeDATA, type="l"
    , layout=c(3,1)
    )
)
#    I would like to easily slap the fixed portion of the fits of a regression model on top of this plot. 
library(lme4)
MyModel<-lmer( Y ~ X + categ + (1|ID), data=SomeDATA)
print(MyModel)

#    Create an orderly NEWDATA. 
N_NEWDATA<-7
NEWDATA<-data.frame(
    X=seq(-2, 2, length=N_NEWDATA)
    , ID=2
    , categ=factor(
        sample(c("A", "C"), replace=T, size=N_NEWDATA)
        , levels=levels(SomeDATA$categ))
    , Y=0
)
NEWDATA$nuisance<-sample(1:3, replace=T, size=nrow(NEWDATA))
print(NEWDATA)
NEWDATA_frame<-model.frame( formula=formula(MyModel), data=NEWDATA)
print(NEWDATA_frame)
#    The following generates an error:
NEWDATA_matrix<-model.matrix( object=formula(MyModel), data=NEWDATA_frame)
#    The following does not conform to NEWDATA but instead reverts to SomeDATA:
NEWDATA_matrix<-model.matrix( object=MyModel, data=NEWDATA_frame)
print(NEWDATA_matrix)

Thanks for any insights

Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032

APPENDIX

> sessionInfo()
R version 2.10.1 (2009-12-14) 
i386-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_0.999375-32   Matrix_0.999375-33 lattice_0.17-26

loaded via a namespace (and not attached):
[1] grid_2.10.1  tools_2.10.1

END APPENDIX

------------------------------

Message: 71
Date: Thu, 15 Apr 2010 19:37:11 +0200
From: Matthieu Decorde <matthieu.decorde@ens-lyon.fr>
To: r-help@r-project.org
Subject: [R] Rserve : CStack usage too close to the limit
Message-ID: <4BC74EC7.5050209@ens-lyon.fr>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi,

I use the Rserve package (RserveEngine.jar) and
the Java client (REngine.jar) from Rforge.

I manipulate R matrices from within Java.

When calling a R function from the Java client on
a R matrix, Rserve gives an error :
"CStack too close to the limit"
That error happens when the matrix has a minimum
size (about 29x10000).

Here is the Java stacktrace I obtain from the execution :
org.rosuda.REngine.Rserve.RserveException: eval failed
  at org.rosuda.REngine.Rserve.RConnection.eval(RConnection.java:233)
  at main(ConnectToRserve.java:17)

When I call the same function from within R, with
exactly the same environment (I dumped my matrix in a file
which is then loaded in R), there is no error.

Thus, I believe the error comes from the Rserve protocol.

I have written a small Groovy script producing the error.
It is attached to this mail. Please contact me if you want
the complete matrix dump also.

I have already tried to contact Simon Urbanek, the author
of RServe, one month ago. Without success.

Does someone has encountered (and resolved) the same problem as me ?
Is there a more robust alternative to Rserve ?
Before beginning to work to bind the whole R core to the JVM, I would
like to explore all the possibilities to connect to R seamless.

If you know a more appropriate list for that kind of request, I would be 
glad to know it.

Thanks for your help,
Matthieu Decorde



------------------------------

Message: 72
Date: Thu, 15 Apr 2010 13:45:15 -0400
From: "Prof. John C Nash" <nashjc@uottawa.ca>
To: r-help@r-project.org
Subject: Re: [R] R CMD REMOVE etc. query
Message-ID: <4BC750AB.2010004@uottawa.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Brian Ripley pointed out that the library() documentation (third screen, however) says 
that library() and require() check current environment to see if a package is loaded and 
only load if it is not present. I may have oversimplified, and clarifications welcome. But 
this is clearly NOT what I want, since I need the latest package version to test.

Tentative solution is outlined, but suggestions welcome on string cleanup issue mentioned.

As I need to remove a package and its dependencies before reloading, I can use 
tool::pkgDepends to get a list.

I found that a character string extracted from the dependency vector gives 'invalid name' 
error in detach(). That is, I can create a variable myfoo="package:foo", but detach(myfoo) 
gives the error while typing detach("package:foo") works fine.  Workaround seems to be

    slist<-search()
    idx<-which(slist==myfoo)
    detach(idx)

There's still a nuisance issue of how to strip off  the (>=0.7.11) descriptors in the 
dependency list. strsplit() will work, but I seem to need to loop through the list to use 
it when only some of the packages are restricted by qualifiers.

If someone has already dealt with this type of issue, I'd be happy to know. For example, 
if there is a forceLoad() somewhere, it would save the effort above and could be useful 
for developers to ensure they are using the right version of a package.

JN



> From: Prof. John C Nash <nashjc_at_uottawa.ca>
> Date: Thu, 15 Apr 2010 10:17:46 -0400
> 
> I've been working on a fairly complex package that is a wrapper for several optimization routines. In this work, I've attempted to do the following:
> 
>     * edit the package code foo.R
>     * in a root terminal at the right directory location 

> R CMD REMOVE foo 

> R CMD INSTALL foo 
> 
> However, I don't get the right code. In fact, if I just do the remove,
> 
>      library(foo)
> 
> does not throw an error. If I stop my R session and restart it, I do.
> 
> Is this expected behaviour?
> 
> For information, I run scripted tests that start with
> 
>     rm(list=ls())
>     library(foo)
> 
> to ensure I'm getting "new" code each time.
> 
> If desired I can provide a minimal package to show this, but I expect that it is a known issue for which I've missed the documentation. Perhaps there is a command to reset the session. I did a brief search, but appropriate keywords pick up a lot of irrelevant material.
> 
> JN



------------------------------

Message: 73
Date: Thu, 15 Apr 2010 09:51:20 -0800 (PST)
From: prem_R <mtechprem@gmail.com>
To: r-help@r-project.org
Subject: [R] Replace / with - in date
Message-ID: <1271353880691-1911391.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi,every one .I have searched the solutions in the forum  for replacing my
date value which is in a data frame  ,01/01/2000 to 01-01-2000 using replace
function but got the following warning message
x<-"2000/01/01"
xd<-as.data.frame(x)
xd$x<-replace(xd$x,xd$x=="/","-")


Warning message:
In `[<-.factor`(`*tmp*`, list, value = "-") :
  invalid factor level, NAs generated

Is there any other method of doing it? or am i missing something?. please
let me know if you need any more information.

Thanks.

Prem
-- 
View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1911391.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 74
Date: Thu, 15 Apr 2010 18:52:33 +0100
From: Gavin Simpson <gavin.simpson@ucl.ac.uk>
To: David Winsemius <dwinsemius@comcast.net>
Cc: r-help <r-help@r-project.org>, luke@stat.uiowa.edu
Subject: Re: [R] Exporting an rgl graph
Message-ID: <1271353953.6002.309.camel@localhost>
Content-Type: text/plain; charset="UTF-8"

On Thu, 2010-04-15 at 13:00 -0400, David Winsemius wrote:
> On Apr 15, 2010, at 12:34 PM, luke@stat.uiowa.edu wrote:
> 
> > The current issue of JCGS (Vol 18 No 1,
> > http://pubs.amstat.org/toc/jcgs/19/1 ) has an editorial on including
> > animations, 3D visualizations, and movies in on-line PDF files
> > supporting JCGS articles. The online supplements to the editorial
> > include examples.  The 3D examples related to the misc3d packages are
> > also available in
> > http://www.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/.  At some point
> > the code there will be added to misc3d.  It should be possible to
> > adapt these ideas to other objects rendered with rgl.
> 
> Very kewl. On a Mac the greyscale plots opened in Adobe Acrobat Reader 
> v8.2.2 displays properly, but the color version supp_j.pdf looks like 
> a m?nage ? trois of three psychedelic sea urchins. I think that Adobe 
> may need to do some work on their display engine for this to be a  
> fully cross-platform combination. The color version of the volcano  
> example is likewise carpeted with spiky artifacts.
> 
> (I have not yet tried producing plots de novo with the Mac pdf device.)
> 

Have you tried in Acrobat Reader >=9 ? The editorial says you need that
to view the pdfs properly.

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: 75
Date: Thu, 15 Apr 2010 17:57:20 +0000
From: David Hardie <dreamwaters@hotmail.com>
To: <dwinsemius@comcast.net>
Cc: r-help@r-project.org
Subject: Re: [R] can't find "daphnia.txt" and others while working
    through Crawley's R-Book
Message-ID: <BLU137-W280C08485C94CB7B865C66B60F0@phx.gbl>
Content-Type: text/plain


Thanks again David.  Looking again I now see the last line of the Acknowledgements which directs the reader to the author's website to get the datafiles.  Of all the places I thought to look I had never considered reading the Acknowlegements!  It seems to be that moving it about one line farther in the book - into the "Getting Started" chapter - would have been a better idea!  Oh well, I have highlighted the website for future users of my copy!

Cheers,

-Dave

> CC: r-help@r-project.org
> From: dwinsemius@comcast.net
> To: dreamwaters@hotmail.com
> Subject: Re: [R] can't find "daphnia.txt" and others while working through Crawley's R-Book
> Date: Thu, 15 Apr 2010 13:07:40 -0400
> 
> 
> On Apr 15, 2010, at 12:34 PM, David Hardie wrote:
> 
> > Thanks David, but I have searched my hard drive using the search 
> > utility in Windows (not just c:\temp - the whole drive) for the file 
> > in question and it is not there. I have also used:
> > data() to see the names of all dataframes in the datasets package as 
> > well as:
> > data(package=.packages(all.available=TRUE)) to see all available 
> > data sets
> > Both methods provide an extensive list, but not "daphnia.txt"
> >
> > -Dave
> 
> A google search suggested that it was at one time available here, and 
> testing shows that it still is:
> 
> http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/Daphnia.txt
> 
> Looking inside the first few pages of the book, it appears this should 
> have been accessible from the book's associated website. I bought the 
> book several months ago, but it has remained mostly unused because I 
> found it quite limited in its depth of presentation of topics in which 
> I had an interest.
> 
> -- 
> David
> 
> >
> > > CC: r-help@r-project.org
> > > From: dwinsemius@comcast.net
> > > To: dreamwaters@hotmail.com
> > > Subject: Re: [R] can't find "daphnia.txt" and others while working 
> > through Crawley's R-Book
> > > Date: Thu, 15 Apr 2010 12:28:54 -0400
> > >
> > >
> > > On Apr 15, 2010, at 11:42 AM, David Hardie wrote:
> > >
> > > >
> > > > I have a feeling that this is an embarassingly simple fix, but 
> > I've
> > > > been at it for most of the morning and can't get things figured 
> > out.
> > > >
> > > > I'm trying to work through some examples in Crawley's "The R 
> > Book".
> > > > I have installed packages and libraries as described in the book,
> > > > but when I try, for example:
> > > >
> > > > data<-read.table("c:\\temp\\daphnia.txt", header=T)
> > > >
> > > >
> > > > I get:
> > > >
> > > > Error in file(file, "rt") : cannot open the connection
> > > > In addition: Warning message:
> > > > In file(file, "rt") :
> > > > cannot open file 'c:\temp\daphnia.txt': No such file or directory
> > > >
> > > >
> > > > There is nothing in my c:\temp folder, so I'm not suprised that it
> > > > doesn't work, but I can't for the life of me figure out which
> > > > package or library I will need to gain access to this and other 
> > data
> > > > files used in this book.
> > >
> > > This would appear to be more a problem with you lack of 
> > understanding
> > > regarding the file management utilities of Windows. In Linux or a 
> > Mac
> > > you could use the locate function to track down where the file ended
> > > up, but surely whatever Windows version you have allows such 
> > searching.
> > >
> > > --
> > > David.
> > > >
> > > >
> > > >
> > > > Thanks in advance,
> > > >
> > > > -Dave
> > > >
> > >
> > >
> > > David Winsemius, MD
> > > West Hartford, CT
> > >
> >

> 
> David Winsemius, MD
> West Hartford, CT
> 
                          
_________________________________________________________________


    [[alternative HTML version deleted]]



------------------------------

Message: 76
Date: Thu, 15 Apr 2010 10:59:36 -0700
From: Santosh <santosh2005@gmail.com>
To: p.hiemstra@geo.uu.nl, ehlers@ucalgary.ca
Cc: r-help <r-help@r-project.org>
Subject: Re: [R] histogram
Message-ID:
    <l2v816b5ce41004151059kda602d5fta47b3ca6c8efaee3@mail.gmail.com>
Content-Type: text/plain

[[elided Yahoo spam]]
-santosh

On Thu, Apr 15, 2010 at 3:11 AM, Paul Hiemstra <p.hiemstra@geo.uu.nl> wrote:

> Santosh wrote:
>
>> Thanks for your email... yes, I had tried that "bw" thing.. for some
>> reason it does not seem to work.. could not figure out where I am wrong...
>>
>> Below is an example for your convenience.. you might notice that the
>> density plots appear to be a curve of connected segments. Changing breaks,
>> nint or bw didn't seem to help.
>>
>> ############
>> library(reshape)
>> set.seed(13454)
>> aa <-
>> data.frame(a1=rnorm(500),b1=rnorm(500,0.8),c1=rnorm(500,0.5),cat1=rep(1:5,each=100))
>> ab <- melt(aa,measure.vars=c("a1","b1","c1"))
>> histogram(~
>> value|variable,ab,breaks=NULL,nint=10,type="density",layout=c(2,2),as.table=T,scales=list(relation='free'),
>>            panel=function(x,lqp=c(0.05,0.975),...) {
>>            panel.histogram(x,col='lightblue',...)
>>            panel.densityplot(x,col.line='blue',lwd=1.75,bw=2,...)
>>
> replace bw = 2 by darg = list(bw = 2), then it works for me. Read the
> documentation of panel.densityplot carefully, it says that you need to use
> darg = list().
>
> cheers,
> Paul
>
>>            panel.abline(v=c(quantile(as.vector(x),prob=lqp,na.rm = T)),
>>            col="dark green",lwd=2,lty=2)
>>            },
>>            strip=strip.custom( strip.names=F,
>>                                strip.levels=T,
>>                                par.strip.text=list(cex=0.75)),
>> )
>>
>> ############
>>
>> Thanks again,
>> Santosh
>> On Thu, Apr 15, 2010 at 12:41 AM, Paul Hiemstra <p.hiemstra@geo.uu.nl<mailto:
>> p.hiemstra@geo.uu.nl>> wrote:
>>
>>    Santosh wrote:
>>
>>        Dear R gurus...
>>
>>        How do I control "smoothing" of a density plot in
>>        panel.densityplot when
>>        using histogram?
>>
>>        Thanks much,
>>        Santosh
>>
>>               [[alternative HTML version deleted]]
>>
>>
>>        ______________________________________________
>>        R-help@r-project.org <mailto:R-help@r-project.org> mailing list
>>
>>        https://stat.ethz.ch/mailman/listinfo/r-help
>>        PLEASE do read the posting guide
>>        http://www.R-project.org/posting-guide.html
>>        and provide commented, minimal, self-contained, reproducible code.
>>
>>    Hi,
>>
>>    From ?panel.densityplot, argument darg, I was referred to
>>    ?density. I think the 'bw' argument is what you need. Pass it to
>>    panel.densityplot in the darg argument.
>>
>>    cheers,
>>    Paul
>>
>>
>>    --     Drs. Paul Hiemstra
>>    Department of Physical Geography
>>    Faculty of Geosciences
>>    University of Utrecht
>>    Heidelberglaan 2
>>    P.O. Box 80.115
>>    3508 TC Utrecht
>>    Phone:  +3130 274 3113 Mon-Tue
>>    Phone:  +3130 253 5773 Wed-Fri
>>    http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul> <
>> http://intamap.geo.uu.nl/%7Epaul>
>>
>>    http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>>
>>
>>
>
> --
> Drs. Paul Hiemstra
> Department of Physical Geography
> Faculty of Geosciences
> University of Utrecht
> Heidelberglaan 2
> P.O. Box 80.115
> 3508 TC Utrecht
> Phone:  +3130 274 3113 Mon-Tue
> Phone:  +3130 253 5773 Wed-Fri
> http://intamap.geo.uu.nl/~paul <http://intamap.geo.uu.nl/%7Epaul>
> http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
>
>

    [[alternative HTML version deleted]]



------------------------------

Message: 77
Date: Thu, 15 Apr 2010 20:08:07 +0200
From: baptiste auguie <baptiste.auguie@googlemail.com>
To: luke <luke@stat.uiowa.edu>
Cc: r-help <r-help@r-project.org>
Subject: Re: [R] Exporting an rgl graph
Message-ID:
    <i2vde4e29f51004151108wa535ded1r1e44d5c4db84a4b1@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 15 April 2010 18:34,  <luke@stat.uiowa.edu> wrote:
> The current issue of JCGS (Vol 18 No 1,
> http://pubs.amstat.org/toc/jcgs/19/1) has an editorial on including
> animations, 3D visualizations, and movies in on-line PDF files
> supporting JCGS articles. The online supplements to the editorial
> include examples. ?The 3D examples related to the misc3d packages are
> also available in
> http://www.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/. ?At some point
> the code there will be added to misc3d. ?It should be possible to
> adapt these ideas to other objects rendered with rgl.
>
> luke
>
>
> On Thu, 15 Apr 2010, baptiste auguie wrote:
>
>> I have seen pdf files with 3D objects embedded in it, using the U3D
>> format,
>> http://en.wikipedia.org/wiki/Universal_3D
>>
>> but I don't think there's a device for this in R; in fact there may
>> not even exist a third-party post-processing route available at this
>> time to bridge the gap between rgl and this format. It sure would be
>> nice, though.

[[elided Yahoo spam]]

Thanks,

baptiste



------------------------------

Message: 78
Date: Thu, 15 Apr 2010 14:08:57 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: prem_R <mtechprem@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <2BF89328-F038-49D8-8F7A-364443660413@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 1:51 PM, prem_R wrote:

>
> Hi,every one .I have searched the solutions in the forum  for  
> replacing my
> date value which is in a data frame  ,01/01/2000 to 01-01-2000 using 
> replace
> function but got the following warning message
> x<-"2000/01/01"
> xd<-as.data.frame(x)
> xd$x<-replace(xd$x,xd$x=="/","-")

The replace function does not work with factors, it works with  
(complete) vectors, not substrings. It's also a real hassle to do such  
operations on factors, so just use character vectors and try gsub  
instead:

> x<-"2000/01/01"
> xd<-as.data.frame(x, stringsAsFactors=FALSE)
> xd$x2<-gsub("/","-", xd$x)
> xd
            x         x2
1 2000/01/01 2000-01-01

>
>
> Warning message:
> In `[<-.factor`(`*tmp*`, list, value = "-") :
>  invalid factor level, NAs generated
>
> Is there any other method of doing it? or am i missing something?.  
> please
> let me know if you need any more information.
>
> Thanks.
>
> Prem
> -- 
> View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1911391.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 79
Date: Thu, 15 Apr 2010 12:13:40 -0600
From: Peter Ehlers <ehlers@ucalgary.ca>
To: Steve Murray <smurray444@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Unwanted boxes in legend
Message-ID: <4BC75754.5030207@ucalgary.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 2010-04-15 11:10, Steve Murray wrote:
>
> Dear all,
>
> I am using the following code to generate a legend in my plot (consisting of both bars and points), but end up with boxes around my points:
>
> legend(10, par("usr")[4], c("A", "B", "C", "D"), fill=c(NA,NA, "grey28", NA), pch=c(16,4,NA,18), col=c("red","blue","grey28","yellow"), lty=FALSE, bty="n", horiz=FALSE)
>
> I want a box around the third element of the legend (to represent the bar 'fill' colour), but not for the others, where points are shown instead.
>
> What am I doing wrong above and how do I correct it?

Add the 'border' argument:

either

  border = FALSE  # in which case no box is drawn for any element

or

  border = c(NA, NA, "black", NA)

  -Peter Ehlers

>
> Many thanks,
>
> Steve
>                           
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

-- 
Peter Ehlers
University of Calgary



------------------------------

Message: 80
Date: Thu, 15 Apr 2010 18:04:32 +0200
From: "arnaud Gaboury" <arnaud.gaboury@gmail.com>
To: <r-help@r-project.org>
Subject: [R] data.frame and ddply
Message-ID: <4bc7391d.0d1abc0a.50c4.7316@mx.google.com>
Content-Type: text/plain;    charset="us-ascii"

Dear group,

I have this following data.frame:


> c
      DESCRIPTION CREATED.DATE QUANITY CLOSING.PRICE
26 PRM HGH GD ALU   2010-04-09      -1    2,415.9000
27 PRM HGH GD ALU   2010-04-09       1    2,415.9000
28 PRIMARY NICKEL   2010-03-04       1   25,755.7100
29 PRIMARY NICKEL   2010-03-05      -1   25,755.7100
30 PRIMARY NICKEL   2010-03-10      -1   25,760.8600
31 PRIMARY NICKEL   2010-03-10       1   25,760.8600
32 STANDARD LEAD    2010-04-01       1    2,355.9600
33 STANDARD LEAD    2010-04-01      -1    2,355.9600
34 STANDARD LEAD    2010-04-01       1    2,355.9600
35 STANDARD LEAD    2010-04-01      -1    2,355.9600
36 STANDARD LEAD    2010-04-01      -1    2,355.9600
37 STANDARD LEAD    2010-04-01       1    2,355.9600
38 STANDARD LEAD    2010-04-01      -1    2,355.9600
39 STANDARD LEAD    2010-04-06       1    2,357.1200
40 STANDARD LEAD    2010-04-08       1    2,420.7300
41 SPCL HIGH GRAD   2010-04-08       1    2,420.7300
42 SPCL HIGH GRAD   2010-04-08      -1    2,420.7300
43 SPCL HIGH GRAD   2010-04-09      -1    2,421.0500
44 SPCL HIGH GRAD   2010-04-09       1    2,421.0500
45 SPCL HIGH GRAD   2010-04-09      -1    2,421.0500
46 SPCL HIGH GRAD   2010-04-09       1    2,421.0500
47 SPCL HIGH GRAD   2010-04-09       1    2,421.0500
48 SPCL HIGH GRAD   2010-01-13       1    2,388.4300
49 SPCL HIGH GRAD   2010-01-25      -1    2,388.4300

The goal is to get a smaller df, with only PRM HGH GD ALU, PRIMARY NICKEL,
STANDARD LEAD, STANDARD LEAD as rows, with QUANITY column as a sum of
QUANITY, DATE column as the max CREATED.DATE with the corresponding
CLOSING.PRICE.

If I pass this :

    >  op=ddply(c, c("DESCRIPTION"), summarise, POSITION=
sum(QUANITY),DATE=max(CREATED.DATE)) 

It returns this :

> op
     DESCRIPTION POSITION       DATE
1 PRIMARY NICKEL        0 2010-03-10
2 PRM HGH GD ALU        0 2010-04-09
3 SPCL HIGH GRAD        2 2010-04-09
4 STANDARD LEAD         0 2010-04-06

Not bad, as I have my 4 elements, the sum of QUANITY for each one, the max
DATE for each one, BUT I would like to add the CLOSING.PRICE column with the
CLOSING.PRICE corresponding to the max date.
I have no idea how to do this.

Any help would be appreciated.

TY



------------------------------

Message: 81
Date: Thu, 15 Apr 2010 11:01:24 -0700
From: Kenneth Lo <kenchlo2@gmail.com>
To: "Charles C. Berry" <cberry@tajo.ucsd.edu>
Cc: r-help@r-project.org
Subject: Re: [R] Efficient algorithm to get a solution path for ridge
    regression?
Message-ID: <42E86E4A-7A90-4282-8FE2-8ED94BD67633@gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Thanks for your pointer. I looked into "Applied Regression Analysis"  
by Draper and Smith, and the ridge trace solution can be obtained  
efficiently by expressing it in canonical form. It could be coded  
without much difficulty, but I'm just wondering if there's any package  
which has already implemented this (or other) efficient way of  
returning a solution path for a sequence of regularization parameter?  
The function provided by MASS computes the solution individually for  
each value of the parameter. A quick look into the parcor and  
penalized packages seems to be promising, but I need to check the  
source code to see if they really implement an efficient algorithm as  
desired. Any input to this would be much appreciated.

Thanks again.


On 15-Apr-10, at 8:49 AM, Charles C. Berry wrote:

> On Wed, 14 Apr 2010, Kenneth Lo wrote:
>
>> With the use of the LARS algorithm, a path of solutions  
>> corresponding to a sequence of the regularization parameter can be  
>> obtained for LASSO (or even the elastic net, a hybrid between LASSO  
>> and ridge) at the cost of one linear regression. In terms of  
>> computational speed LASSO seems to have beaten ridge regression,  
>> the solution of which needs to be computed individually, at the  
>> cost of one linear regression, for each regularization parameter.  
>> Is there any efficient method to compute a path of solutions for  
>> ridge regression corresponding to a sequence of the regularization  
>> parameter? Thanks.
>
> Yes.
>
> Check a textbook like Draper and Smith. Or Google for course notes.
>
> HTH,
>
> Chuck
>
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> Charles C. Berry                            (858) 534-2098
>                                            Dept of Family/Preventive  
> Medicine
> E mailto:cberry@tajo.ucsd.edu                UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego  
> 92093-0901
>
>



------------------------------

Message: 82
Date: Thu, 15 Apr 2010 14:19:18 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: gavin.simpson@ucl.ac.uk
Cc: r-help <r-help@r-project.org>, luke@stat.uiowa.edu
Subject: Re: [R] Exporting an rgl graph
Message-ID: <0F134323-E69E-439D-BB52-081B94EEA127@comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes


On Apr 15, 2010, at 1:52 PM, Gavin Simpson wrote:

> On Thu, 2010-04-15 at 13:00 -0400, David Winsemius wrote:
>> On Apr 15, 2010, at 12:34 PM, luke@stat.uiowa.edu wrote:
>>
>>> The current issue of JCGS (Vol 18 No 1,
>>> http://pubs.amstat.org/toc/jcgs/19/1 ) has an editorial on including
>>> animations, 3D visualizations, and movies in on-line PDF files
>>> supporting JCGS articles. The online supplements to the editorial
>>> include examples.  The 3D examples related to the misc3d packages 
>>> are
>>> also available in
>>> http://www.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/.  At some point
>>> the code there will be added to misc3d.  It should be possible to
>>> adapt these ideas to other objects rendered with rgl.
>>
>> Very kewl. On a Mac the greyscale plots opened in Adobe Acrobat  
>> Reader
>> v8.2.2 displays properly, but the color version supp_j.pdf looks like
>> a m?nage ? trois of three psychedelic sea urchins. I think that Adobe
>> may need to do some work on their display engine for this to be a
>> fully cross-platform combination. The color version of the volcano
>> example is likewise carpeted with spiky artifacts.
>>
>> (I have not yet tried producing plots de novo with the Mac pdf  
>> device.)
>>
>
> Have you tried in Acrobat Reader >=9 ? The editorial says you need  
> that
> to view the pdfs properly.

Thank you, that was it. I thought that my version of Acrobat Reader  
was current for my OS, but it was not. Acrobat 9.3 for the Mac renders  
the plots correctly. Now I get quite lovely orientable images.

>
> G
>
> -- 
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
> ECRC, UCL Geography,          [f] +44 (0)20 7679 0565-

-- 
David Winsemius, MD
West Hartford, CT



------------------------------

Message: 83
Date: Thu, 15 Apr 2010 10:22:03 -0800 (PST)
From: prem_R <mtechprem@gmail.com>
To: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <1271355723218-1914541.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Thanks Mr.Winsemius  for the proposed solution ,it worked fine.But when came
to the entire data frame containing 400000 rows ,i used the following code
as proposed by you 

a$date1<-gsub("/","-",a$date)

got the following error:
Error in `$<-.data.frame`(`*tmp*`, "date1", value = character(0)) : 
  replacement has 0 rows, data has 441906

Please provide solution with the problem.

Thanks.
-- 
View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1914541.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 84
Date: Thu, 15 Apr 2010 12:24:42 -0600
From: "=?ISO-8859-1?Q?H=E9ctor_Villalobos?=" <hvillalo@ipn.mx>
To: R-help@r-project.org
Subject: [R] nested (hierarchical) anova
Message-ID: <4BC759EA.15172.DBDF3B@hvillalo.ipn.mx>
Content-Type: text/plain

Hi,

I'm having difficulty  to replicate in R a nested (hierarchical) anova example found in p. 308 of
Zar, J.H. 1996. Bostatistical Analysis. Prentice Hall. 3rd ed.

The example (15.1) is as follows:
The variable is blood cholesterol concentration in women (in mg/100 ml of plasma). This
variable was measured after the administration of one of three different drugs, each drug
having been obtained from two sources

  DRUG 1   DRUG 2      DRUG 3
     A   Q       D      B          L   S
  102 103   108  1091   104 105
  104 104   110  1082   106 107

Zar results are these:
----------------------------------------------------------------------------
Source of variation             SS   DF      MS        F       P
----------------------------------------------------------------------------
*Total                              71.67   11
*Among all subgroups    62.67     5
  *Groups                        61.17     2   30.58   61.16  0.0037
  *Subgroups                    1.50     3     0.50     0.33   0.80
*Error                               9.00     6     1.50
----------------------------------------------------------------------------

It is straightforward to follow the equations from the book step by step to obtain those results.

Now, when trying the 'aov()' function in R:

## creating the data frame
zar <- data.frame(
       cChol=c(102, 104, 103, 104, 108, 110, 109, 108, 104, 106, 105, 107),
       drug=gl(3, 4, 12),
       dsource=gl(6, 2, 12, labels=c("A", "Q", "D", "B", "L", "S")) )


## This gives the relevant SS, DF and MS values, but only the F and P corresponding to drug
## effect (Zar's Groups)
summary( aov(cChol ~ drug + Error(dsource/drug), data=zar) )

## The F and P values corresponding to subgroups can be obtained by:
0.5/1.5 # F
pf(0.5/1.5, 3, 6, lower.tail=FALSE) # P

## or from the second row in the two way anova:
summary( aov(cChol ~  drug + dsource, data=zar) )


In order to avoid confussion in our students (and myself!) I wonder if we can obtain the
desired results in one step?

Thank you in advance for your kind help.

Héctor


--
Héctor Villalobos <hvillalo@ipn.mx>
CICIMAR - IPN
A.P. 592. Col. Centro
La Paz, Baja California Sur, MÉXICO. 23000
Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34  ext. 82425
Fax.  (+52 612) 122 53 22

    [[alternative HTML version deleted]]



------------------------------

Message: 85
Date: Thu, 15 Apr 2010 13:28:24 -0500
From: Christian Raschke <crasch2@tigers.lsu.edu>
To: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <4BC75AC8.1040709@tigers.lsu.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Is there anything that speaks against just applying gsub to the factor 
levels if one would like to keep everything as factors (and not consider 
true Date classes or character vectors)? I.e:

> x <- c("2000/01/01", "2001/02/01")
> xd <- as.data.frame(x)
> levels(xd$x) <- gsub("/", "-", levels(xd$x))

Christian


On 04/15/2010 01:08 PM, David Winsemius wrote:
>
> On Apr 15, 2010, at 1:51 PM, prem_R wrote:
>
>>
>> Hi,every one .I have searched the solutions in the forum  for 
>> replacing my
>> date value which is in a data frame  ,01/01/2000 to 01-01-2000 using 
>> replace
>> function but got the following warning message
>> x<-"2000/01/01"
>> xd<-as.data.frame(x)
>> xd$x<-replace(xd$x,xd$x=="/","-")
>
> The replace function does not work with factors, it works with 
> (complete) vectors, not substrings. It's also a real hassle to do such 
> operations on factors, so just use character vectors and try gsub 
> instead:
>
> > x<-"2000/01/01"
> > xd<-as.data.frame(x, stringsAsFactors=FALSE)
> > xd$x2<-gsub("/","-", xd$x)
> > xd
>            x         x2
> 1 2000/01/01 2000-01-01
>
>>
>>
>> Warning message:
>> In `[<-.factor`(`*tmp*`, list, value = "-") :
>>  invalid factor level, NAs generated
>>
>> Is there any other method of doing it? or am i missing something?. 
>> please
>> let me know if you need any more information.
>>
>> Thanks.
>>
>> Prem
>> -- 
>> View this message in context: 
>> http://n4.nabble.com/Replace-with-in-date-tp1911391p1911391.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Christian Raschke
Department of Economics
and
ISDS Research Lab (HSRG)
Louisiana State University
Patrick Taylor Hall, Rm 2128
Baton Rouge, LA 70803
crasch2@lsu.edu



------------------------------

Message: 86
Date: Thu, 15 Apr 2010 14:28:53 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: prem_R <mtechprem@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <9245E79C-CAA2-4BE3-A9B2-9D2319231181@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 2:22 PM, prem_R wrote:

>
> Thanks Mr.Winsemius  for the proposed solution ,it worked fine.But  
> when came
> to the entire data frame containing 400000 rows ,i used the  
> following code
> as proposed by you
>
> a$date1<-gsub("/","-",a$date)
>
> got the following error:
> Error in `$<-.data.frame`(`*tmp*`, "date1", value = character(0)) :
>  replacement has 0 rows, data has 441906
>
> Please provide solution with the problem.

Please provide sample data for the problem.

>
> Thanks.
> -- 
> View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1914541.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 87
Date: Thu, 15 Apr 2010 14:45:08 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: Christian Raschke <crasch2@tigers.lsu.edu>
Cc: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <C4F3AAAE-95A2-43F4-870C-09AC3103BF5B@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 2:28 PM, Christian Raschke wrote:

> Is there anything that speaks against just applying gsub to the  
> factor levels if one would like to keep everything as factors (and  
> not consider true Date classes or character vectors)? I.e:
>
> > x <- c("2000/01/01", "2001/02/01")
> > xd <- as.data.frame(x)
> > levels(xd$x) <- gsub("/", "-", levels(xd$x))

Nothing. Other than the fact (which is not at all obvious to the new  
useRs) that it requires knowledge that the string representations are  
stored within the factor levels and not the factor values, and that  
operations on factors are often quite puzzling to the uninitiated. If  
one were to attempt applying a function that takes Date or Datetime  
arguments to such a "date-like-factor", it is very likely that the  
initial results would be failures. The OP referred to the strings as a  
"date value" rather than as a factor level. I doubt that he realized  
the default operation of as.data.frame().

-- 
David.

>
> Christian
>
>
> On 04/15/2010 01:08 PM, David Winsemius wrote:
>>
>> On Apr 15, 2010, at 1:51 PM, prem_R wrote:
>>
>>>
>>> Hi,every one .I have searched the solutions in the forum  for  
>>> replacing my
>>> date value which is in a data frame  ,01/01/2000 to 01-01-2000  
>>> using replace
>>> function but got the following warning message
>>> x<-"2000/01/01"
>>> xd<-as.data.frame(x)
>>> xd$x<-replace(xd$x,xd$x=="/","-")
>>
>> The replace function does not work with factors, it works with  
>> (complete) vectors, not substrings. It's also a real hassle to do  
>> such operations on factors, so just use character vectors and try  
>> gsub instead:
>>
>> > x<-"2000/01/01"
>> > xd<-as.data.frame(x, stringsAsFactors=FALSE)
>> > xd$x2<-gsub("/","-", xd$x)
>> > xd
>>           x         x2
>> 1 2000/01/01 2000-01-01
>>
>>>
>>>
>>> Warning message:
>>> In `[<-.factor`(`*tmp*`, list, value = "-") :
>>> invalid factor level, NAs generated
>>>
>>> Is there any other method of doing it? or am i missing something?.  
>>> please
>>> let me know if you need any more information.
>>>
>>> Thanks.
>>>
>>> Prem
>>> -- 
>>> View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1911391.html
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> -- 
> Christian Raschke
> Department of Economics
> and
> ISDS Research Lab (HSRG)
> Louisiana State University
> Patrick Taylor Hall, Rm 2128
> Baton Rouge, LA 70803
> crasch2@lsu.edu
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 88
Date: Thu, 15 Apr 2010 20:56:53 +0200 (CEST)
From: Jens Oehlschl?gel <joehl@web.de>
To: Anne Skoeries <home@anne-skoeries.de>
Cc: r-help@r-project.org
Subject: Re: [R] how to work with big matrices and the ff-package?
Message-ID: <12556094.238950.1271357813864.JavaMail.fmail@mwmweb017>
Content-Type: text/plain; charset=UTF-8

Anne,

?

> After the above step I need to convert my ff_matrix to a data.frame to discretize the whole matrix and calculate the mutual information.

> The calculated result should be saved as an ffdf-object or something similar.
> disc <- as.ffdf(discretize(as.data.frame(as.ffdf(ffmat)), disc="equalwidth", nbins=5))

?

ffdf are ff's aquivalent to data.frames: they handle many rows (2^31-1) and a limited number of columns (with potentially different
column types). Like data.frames, they are not suitable for millions of columns. You probably want to store your data in one big ff matrix.



If you use ff objects because you don't have the RAM for standard R objects, converting ff to a data.frame is not an option because it will require too much RAM.

If 'discretize' expects a data.frame, you cannot call it on an ff matrix either. But if 'discretize' works on single columns, you can call discretize on chunks of columns that you coerce to data.frames.

?

something like

for (i in chunk(from=1, to=ncol(ffmat), by=10))

ffmat[,i] <- as.matrix(discretize(as.data.frame(ffmat[,i])))

?

If discretize returns integers, you might want to write the results rather to an integer ff matrix because this saves disk space and improves caching.

?

HTH

Jens Oehlschl?gel

?

?

?

?



------------------------------

Message: 89
Date: Thu, 15 Apr 2010 14:08:12 -0600
From: Greg Snow <Greg.Snow@imail.org>
To: Duncan Murdoch <murdoch@stats.uwo.ca>, Dwayne Blind
    <dwayneblind@gmail.com>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] curve
Message-ID:
    <B37C0A15B8FB3C468B5BC7EBC7DA14CC633341E276@LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

Or here is a way to plot against one of the variables while interactively changing the other one:

library(TeachingDemos)

myfun <- function(x,y) sin(x^2) * cos(y^2)

myfun2 <- function(y) curve( myfun(x,y), from=-pi, to=pi, ylim=c(-1,1) )

tkexamp( myfun2,
    list( y=list('slider', from=-pi, to=pi, resolution=2*pi/50, init=0) ) )



-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Duncan Murdoch
> Sent: Thursday, April 15, 2010 7:29 AM
> To: Dwayne Blind
> Cc: r-help@r-project.org
> Subject: Re: [R] curve
> 
> On 14/04/2010 4:59 PM, Dwayne Blind wrote:
> > Dear R users,
> >
> > How can I use "curve" with a function of two variables ?
> >
> 
> See Ben Bolker's reply if you want to plot a surface.  If you want to
> plot a curve by holding one of the two variables fixed, just set it to
> a
> constant value, and use "x" as the other variable, e.g.
> 
> f <- function(x, y) { x^2 + y^2 }
> 
> curve(f(x, 2), from= .... )
> 
> curve(f(3, x), from= .... )
> 
> or wrap the function in a one variable function if you want to follow
> some complicated path, e.g.
> 
> curve(function(t) f(t, t^2), from=....)
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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: Thu, 15 Apr 2010 14:14:00 -0600
From: Greg Snow <Greg.Snow@imail.org>
To: Gabor Grothendieck <ggrothendieck@gmail.com>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] <<- how/when/why do you use it?
Message-ID:
    <B37C0A15B8FB3C468B5BC7EBC7DA14CC633341E27A@LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="iso-8859-1"

Thanks Gabor, I had not thought of using environments like that.  It looks like it can be done even simpler:

fun3 <- function() {

    e <- environment()
    tmp <- matrix( nrow=0, ncol=2 )

    fun4 <- function(x) {
        e$tmp <- rbind(e$tmp, x)
        (x[1] - 3)^2 + (x[2]-5)^2
    }

    out <- optim( c(0,0), fun4 )
    list( out=out, vals=tmp )
}

tmp <- fun3()
plot( tmp$vals, type='l' )

Now I can start removing all the "<<-"s from my code.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@imail.org
801.408.8111


> -----Original Message-----
> From: Gabor Grothendieck [mailto:ggrothendieck@gmail.com]
> Sent: Wednesday, April 14, 2010 11:36 AM
> To: Greg Snow
> Cc: Tal Galili; r-help@r-project.org
> Subject: Re: [R] <<- how/when/why do you use it?
> 
> x <<- will usually wind up assigning into the parent or global
> environment but since it depends on what is already there the
> following are safer:
> 
> e <- environment()
> parent.env(e)$x <- 1
> 
> globalenv()$x <- 2
> 
> Typically in cases like this the function that contains the assignment
> can be regarded as a method of the object containing x so an OO
> approach can be taken such as facilitated by the proto package.  Here
> p is defined to be a proto object with method square.x and property x.
> 
> > library(proto)
> > p <- proto(x = 2, square.x = function(.) .$x <- .$x^2)
> > p$x
> [1] 2
> > p$square.x()
> > p$x
> [1] 4
> 
> 
> 
> On Wed, Apr 14, 2010 at 11:42 AM, Greg Snow <Greg.Snow@imail.org>
> wrote:
> > The <<- assignment operator is very powerful, but can be dangerous as
> well. ?When tempted to use it, look for alternatives first, there may
> be a better way. ?But having said that, I am one of the more guilty
> people for using it (quite a few of the functions in the TeachingDemos
> package use <<-).
> >
> > The main use that I see is when you are using a function written by
> someone else that takes one of your functions as an argument and you
> want to save information from your function that is not being passed
> back through the calling function. ?For example you may want to trace
> the calls to your function that is being called by optim, just define
> your function A which defines within it function B which is to be
> optimized, A also contains an empty vector to store results in, then A
> calls optim passing B to it, B uses <<- to update the vector in A every
> time that it is called, now A has the results of optim and also a trace
> of info on all the calls to B.
> >
> > <<- can also be used for package local variables (less evil than
> globals) where within a package you can call one function to set some
> things up, then other functions in the package can refer to the
> variable created to see the setup as well as modifying options local to
> the package.
> >
> > Hope this helps,
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > Statistical Data Center
> > Intermountain Healthcare
> > greg.snow@imail.org
> > 801.408.8111
> >
> >
> >> -----Original Message-----
> >> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> >> project.org] On Behalf Of Tal Galili
> >> Sent: Tuesday, April 13, 2010 8:03 AM
> >> To: r-help@r-project.org
> >> Subject: [R] <<- how/when/why do you use it?
> >>
> >> Hi all,
> >>
> >> Today I came across scoping in the R
> >> intro<http://cran.r-project.org/doc/manuals/R-intro.html#Scope>
> (after
> >> reading Robert Gentleman
> >> fortune<http://rfortunes.posterous.com/im-always-thrilled-when-
> people-
> >> discover-what>
> >> on
> >> lexical scooping) , and am very curious about the <<- assignment.
> >>
> >> The manual showed one (very interesting) example for "<<-", which I
> >> feel I
> >> understood. What I am still missing is the context of when this can
> be
> >> useful.
> >>
> >> So what I would love to read from you are examples (or links to
> >> examples) on
> >> when using "<<-" can be interesting/useful. What might be the
> dangers
> >> of
> >> using it (it looks easy to loose track of), and any tips you might
> feel
> >> like
> >> sharing.
> >>
> >> Thanks,
> >> Tal
> >>
> >>
> >> ----------------Contact
> >> Details:-------------------------------------------------------
> >> Contact me: Tal.Galili@gmail.com | ?972-52-7275845
> >> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il
> (Hebrew)
> >> |
> >> www.r-statistics.com (English)
> >> --------------------------------------------------------------------
> ---
> >> -----------------------
> >>
> >> ? ? ? [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/posting-
> >> guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/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: 91
Date: Thu, 15 Apr 2010 13:24:35 -0700
From: Changbin Du <changbind@gmail.com>
To: r-help@r-project.org
Subject: [R] r-loop
Message-ID:
    <j2q840048831004151324ve59f8f26u8a7949118da4fcf2@mail.gmail.com>
Content-Type: text/plain

HI, Dear community,

I am building the following loop,

ww<-function(file) {
  lossw<-vector()
  for (x in seq(0.1, 0.9, by=0.1)) {
  cat('xweight ', x, '\n')

  lossw[i] <- cross.validation(file, x)$avg

                                   }
return(lossw)  }


MY question is how to index the lossw[i]?



for (i in 1:9)
for (x in seq(0.1, 0.9, by=0.1))



Thanks so much!

-- 
Sincerely,
Changbin
--

    [[alternative HTML version deleted]]



------------------------------

Message: 92
Date: Thu, 15 Apr 2010 12:39:18 -0800 (PST)
From: Bio7 <maustenfeld@elearning.uni-kiel.de>
To: r-help@r-project.org
Subject: Re: [R] Rserve : CStack usage too close to the limit
Message-ID: <1271363958480-1932149.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


I successfully use RServe with big matrices for e.g. image analysis and as a
computational backend for my GUI.

http://www.uni-bielefeld.de/biologie/Oekosystembiologie/bio7app/flashtut/rperspective.htm
http://www.uni-bielefeld.de/biologie/Oekosystembiologie/bio7app/flashtut/rperspective.htm


http://www.uni-bielefeld.de/biologie/Oekosystembiologie/bio7app/flashtut/supervisedimages.htm
http://www.uni-bielefeld.de/biologie/Oekosystembiologie/bio7app/flashtut/supervisedimages.htm 

Often memory errors occurs if the size of the heap is to small on the java
side.
Try to start your application with more memory:
e.g.: java -Xmx512M yourprogramm

i hope this info helps.
-- 
View this message in context: http://n4.nabble.com/Rserve-CStack-usage-too-close-to-the-limit-tp1910695p1932149.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 93
Date: Thu, 15 Apr 2010 13:41:43 -0700
From: Changbin Du <changbind@gmail.com>
To: "Marius 't Hart" <M.t.Hart@ai.rug.nl>
Cc: r-help@r-project.org
Subject: Re: [R] r-loop
Message-ID:
    <n2o840048831004151341k4f873aeam732f0c76d34cf13d@mail.gmail.com>
Content-Type: text/plain

[[elided Yahoo spam]]



On Thu, Apr 15, 2010 at 1:35 PM, Marius 't Hart <M.t.Hart@ai.rug.nl> wrote:

> lossw[i] <- cross.validation(file, x)$avg
>
> change to:
>
> lossw <- append(lossw,cross.validation(file, x)$avg)
>
>
>
>
> Changbin Du wrote:
>
>> HI, Dear community,
>>
>> I am building the following loop,
>>
>> ww<-function(file) {
>>  lossw<-vector()
>>  for (x in seq(0.1, 0.9, by=0.1)) {
>>  cat('xweight ', x, '\n')
>>
>>  lossw[i] <- cross.validation(file, x)$avg
>>
>>                                   }
>> return(lossw)  }
>>
>>
>> MY question is how to index the lossw[i]?
>>
>>
>>
>>  for (i in 1:9)
>>  for (x in seq(0.1, 0.9, by=0.1))
>>
>>
>>
>> Thanks so much!
>>
>>
>>
>
>


-- 
Sincerely,
Changbin
--

Changbin Du
DOE Joint Genome Institute
Bldg 400 Rm 457
2800 Mitchell Dr
Walnut Creet, CA 94598
Phone: 925-927-2856

    [[alternative HTML version deleted]]



------------------------------

Message: 94
Date: Thu, 15 Apr 2010 16:41:51 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: Changbin Du <changbind@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] r-loop
Message-ID: <88379598-A114-4FF7-9B45-3544A95A178A@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed


On Apr 15, 2010, at 4:24 PM, Changbin Du wrote:

> HI, Dear community,
>
> I am building the following loop,
>
> ww<-function(file) {
>  lossw<-vector()
>  for (x in seq(0.1, 0.9, by=0.1)) {
>  cat('xweight ', x, '\n')
>
>  lossw[i] <- cross.validation(file, x)$avg
>
>                                   }
> return(lossw)  }
>
>
> MY question is how to index the lossw[i]?

Perhaps lossw[round(x*10)]

>
>
>
> for (i in 1:9)
> for (x in seq(0.1, 0.9, by=0.1))


David Winsemius, MD
West Hartford, CT



------------------------------

Message: 95
Date: Thu, 15 Apr 2010 17:00:17 -0400
From: Michael Friendly <friendly@yorku.ca>
To: R-Help <r-help@stat.math.ethz.ch>
Subject: [R] [R-pkgs] vcdExtra 0.5-0 is released to CRAN
Message-ID: <4BC77E61.2080502@yorku.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I'm pleased to announce the release of the vcdExtra package, v. 0.5-0
from R-Forge to CRAN, on its way to a CRAN server near you.

vcdExtra was originally designed to serve  as a  sandbox for  introducing
extensions of mosaic plots and other visualizations for categorical
data, particularly those that apply to (poisson surrogate)
loglinear models fitted using glm() and
related,  generalized  nonlinear models  fitted  with gnm()  in  the gnm
package. See package?vcdExtra for information and an overview.
Heather Turner, Achim Zeileis and Duncan Murdoch contributed substantially
to the latest release.

In addition, it contains a tutorial vignette,
"Working with categorical data with R and the vcd package",
vignette("vcd-tutorial", package = "vcdExtra")
many new data sets (with worked examples), and a collection of demos
illustrating things that didn't fit into the standard .Rd format.

New in recent releases are:

o  An initial implementation of 3D mosaic plots, using the rgl package. See
   ?mosaic3d, example(mosaic3d) and demo("mosaic3d-hec").

o  The  method mosaic.glm  extends  the mosaic.loglm  method  in the  vcd
   package to wider class  of models fit using glm() and gnm() for
non-negative
   responses. There are also extensions of association plots (assoc) and 
sieve
   diagrams (sieve) for these models. See demo("mental-glm"), 
demo("vision-quasi")
   and others.

o  Some initial steps in collecting, handling and summarizing sets of 
related
   glm() and loglm() models provided by the functions glmlist(), loglmlist()
   summarize() methods, Kway() for fitting all k-way glm() models, etc.


-- 
Michael Friendly     Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA



------------------------------

Message: 96
Date: Thu, 15 Apr 2010 14:12:03 -0700 (PDT)

To: r-help@r-project.org
Subject: [R] Does "sink" stand for anything?
Message-ID: <854278.76665.qm@web57003.mail.re3.yahoo.com>
Content-Type: text/plain

Hello Everyone,
 
Learning about R and its wonderful array of functions. If it's not obvious, I usually try to find out what a function stands for. I think this helps me remember better.
 
One function that has me stumped is "sink." Can anyone tell me if this stands for something?
 
Thanks,
 
Paul
 
 
 
 

__________________________________________________



    [[alternative HTML version deleted]]



------------------------------

Message: 97
Date: Thu, 15 Apr 2010 17:24:17 -0400
From: David Winsemius <dwinsemius@comcast.net>

Cc: r-help@r-project.org
Subject: Re: [R] Does "sink" stand for anything?
Message-ID: <9619285A-980B-4109-8FA6-C846E26E1E90@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 5:12 PM, Paul Miller wrote:

> Hello Everyone,
>
> Learning about R and its wonderful array of functions. If it's not  
> obvious, I usually try to find out what a function stands for. I  
> think this helps me remember better.
>
> One function that has me stumped is "sink." Can anyone tell me if  
> this stands for something?

In the kitchen, a sink is the place you put the dishes in. In  
electronics, a sink is where the electrons go after they have made  
their way through the circuitry  ... also known as a "ground", whereas 
"sources" are the current inputs. There were a lot of EE types among  
the original cadre of computer scientitsts. In the NIXen class of  
OSes, there is a "pipe" operation, and I believe that the destination  
file or device is probably called a "sink" by some. This leads me to  
think that a hybrid argot of plumbing and circuitry analogies is the  
likely origin of the term.

>
> Thanks,
>
> Paul
>


David Winsemius, MD
West Hartford, CT



------------------------------

Message: 98
Date: Thu, 15 Apr 2010 13:27:55 -0800 (PST)
From: prem_R <mtechprem@gmail.com>
To: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <1271366875316-1934333.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


This is my sample data

2000/01/01
2000/01/01
2000/02/01
2000/10/01
2000/19/01
2000/20/01
2000/21/01
2000/22/01
2000/23/01
2000/25/01
2000/26/01
2000/27/01
2000/28/01
2000/29/01

Tried using levels function but got the following error .
Error in levels(a$date) <- gsub("/", "-", levels(a$date)) : 
  attempt to set an attribute on NULL

Thanks.


-- 
View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1934333.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 99
Date: Thu, 15 Apr 2010 17:29:01 -0400
From: Muhtar Osman <mjosman@gmail.com>
To: r-help@r-project.org
Subject: [R] multidimensional integration in R?
Message-ID:
    <r2q5712f42a1004151429k62a27845i20388b3104c8afba@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hello,

I was wondering if there is a R function can be used for
multidimensional integration.
There used to be a package called "adapt", but it seems not available anymore.

Thanks,

-MJO



------------------------------

Message: 100
Date: Thu, 15 Apr 2010 17:37:31 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: Muhtar Osman <mjosman@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] multidimensional integration in R?
Message-ID: <6A4D6266-01EE-42F1-8483-3D02BEE485C9@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 5:29 PM, Muhtar Osman wrote:

> Hello,
>
> I was wondering if there is a R function can be used for
> multidimensional integration.
> There used to be a package called "adapt", but it seems not  
> available anymore.

It's not on CRAN but you can find it in the archives.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 101
Date: Fri, 16 Apr 2010 09:45:20 +1200
From: Ray Brownrigg <Ray.Brownrigg@ecs.vuw.ac.nz>
To: r-help@r-project.org
Cc: V?ctor Homar Santaner <victor.homar@uib.es>
Subject: Re: [R] filled.contour ON TOP of a base map
Message-ID: <201004160945.20387.Ray.Brownrigg@ecs.vuw.ac.nz>
Content-Type: text/plain;  charset="iso-8859-1"

On Thu, 15 Apr 2010, V?ctor Homar Santaner wrote:
> Anyone?
>
The answer appears to be "no".

Going back to your original question though, you could just not fill the map.  I.e.
filled.contour(x,y,z,levels=c(2,4,6,8,10),plot.axes=map("worldHires",add=T))

Otherwise, you may have to do things the 'hard way': set up two regions, draw a map in the 
first, (here you can then use polygon to colour the ocean green, then overlay the map 
again), overlay your filled contour (perhaps again using polygon), then set up the legend 
in the other region.

Hope this helps,
Ray Brownrigg

On Wed, 14 Apr 2010, V?ctor Homar Santaner originally wrote:
> Dear R helpers,
>
> Any suggestion on how to make the 2D gaussian to show up ON TOP of the map,
> instead of below the continents?
>
> Example code:
>
> library(mapdata)
>
> x<-seq(-15,15,.2);y<-seq(30,55,.2)
>
> expone<-function(x,y){10*exp(-sqrt(x*x+(y-40)*(y-40))/2)}
> z<-outer(x,y,expone)
>
> filled.contour(x,y,z,levels=c(2,4,6,8,10),plot.axes=map("worldHires",add=T,
>col="lightgrey",fill=T))
>
>
> Also, any idea on how to fill the ocean with a background color (e.g.
> green)?
>
>
> Best regards and thank you,
>
> V?ctor.



------------------------------

Message: 102
Date: Thu, 15 Apr 2010 17:46:15 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: prem_R <mtechprem@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <CCC791DB-99A6-4532-A93D-1ED119DCB980@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

It's going to work better if you offer a non-ambiguous version of your  
data. Use dump or dput. If you use the dump route, then see the  
Posting Guide example. If you use dput, then it is as simple as  
dput(object).

Perhaps (if dfrm is the name of a dataframe):

dput(head(dfrm))


On Apr 15, 2010, at 5:27 PM, prem_R wrote:

>
> This is my sample data
>
> 2000/01/01

We cannot tell from the output whether that is a factor or a character  
vector.

> 2000/01/01
> 2000/02/01
> 2000/10/01
> 2000/19/01
> 2000/20/01
> 2000/21/01
> 2000/22/01
> 2000/23/01
> 2000/25/01
> 2000/26/01
> 2000/27/01
> 2000/28/01
> 2000/29/01
>
> Tried using levels function but got the following error .
> Error in levels(a$date) <- gsub("/", "-", levels(a$date)) :
>  attempt to set an attribute on NULL
>
> Thanks.
>
>
> -- 


David Winsemius, MD
West Hartford, CT



------------------------------

Message: 103
Date: Thu, 15 Apr 2010 17:59:10 -0400
From: "John Sorkin" <jsorkin@grecc.umaryland.edu>

Subject: Re: [R] Does "sink" stand for anything?
Message-ID: <4BC753EE020000CB000679CB@medicine.umaryland.edu>
Content-Type: text/plain; charset=US-ASCII

Sink is meant to mean send output to the location I specify. It has no hidden meaning that I am aware of.
John
------Original Message------

To: r-help@r-project.org
Subject: [R] Does "sink" stand for anything?
Sent: Apr 15, 2010 5:12 PM

Hello Everyone,

Learning about R and its wonderful array of functions. If it's not obvious, I usually try to find out what a function stands for. I think this helps me remember better.

One function that has me stumped is "sink." Can anyone tell me if this stands for something?

Thanks,

Paul





__________________________________________________



    [[alternative HTML version deleted]]




John Sorkin
Chief Biostatistics and Informatics
Univ. of Maryland School of Medicine
Division of Gerontology and Geriatric Medicine
JSorkin@grecc.umaryland.edu 
Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}



------------------------------

Message: 104
Date: Thu, 15 Apr 2010 18:07:47 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: David Winsemius <dwinsemius@comcast.net>
Cc: r-help@r-project.org, prem_R <mtechprem@gmail.com>
Subject: Re: [R] Replace / with - in date
Message-ID: <ED358B93-3994-4369-9231-A129E96516B0@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 5:46 PM, David Winsemius wrote:

> It's going to work better if you offer a non-ambiguous version of  
> your data. Use dump or dput. If you use the dump route, then see the  
> Posting Guide example. If you use dput, then it is as simple as  
> dput(object).
>
> Perhaps (if dfrm is the name of a dataframe):
>
> dput(head(dfrm))
>
>
> On Apr 15, 2010, at 5:27 PM, prem_R wrote:
>
>>
>> This is my sample data
>>
>> 2000/01/01
>
> We cannot tell from the output whether that is a factor or a  
> character vector.
>
>> 2000/01/01
>> 2000/02/01
>> 2000/10/01
>> 2000/19/01
>> 2000/20/01
>> 2000/21/01
>> 2000/22/01
>> 2000/23/01
>> 2000/25/01
>> 2000/26/01
>> 2000/27/01
>> 2000/28/01
>> 2000/29/01
>>
>> Tried using levels function but got the following error .
>> Error in levels(a$date) <- gsub("/", "-", levels(a$date)) :
>> attempt to set an attribute on NULL

So it probably was not a factor variable despite what you offered in  
your previous example. The gsub function should be able to do the  
conversion if it's a character vector, as in this example:

gsub("/","-",
      read.table(textConnection("2000/01/01
  2000/01/01
  2000/02/01
  2000/10/01
  2000/19/01
  2000/20/01
  2000/21/01
  2000/22/01
  2000/23/01
  2000/25/01
  2000/26/01
  2000/27/01
  2000/28/01
  2000/29/01"), header=FALSE, stringsAsFactors=FALSE)[,1] )

--- returns:
  [1] "2000-01-01" "2000-01-01" "2000-02-01" "2000-10-01" "2000-19-01" 
"2000-20-01"
  [7] "2000-21-01" "2000-22-01" "2000-23-01" "2000-25-01" "2000-26-01" 
"2000-27-01"
[13] "2000-28-01" "2000-29-01"

>>
>> Thanks.
>>
>>
>> -- 
>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 105
Date: Fri, 16 Apr 2010 10:47:10 +1200
From: David Scott <d.scott@auckland.ac.nz>
To: S?bastien Bihorel <pomchip@free.fr>
Cc: "r-help@r-project.org" <r-help@r-project.org>,
    "tobias.verbeke@openanalytics.eu" <tobias.verbeke@openanalytics.eu>
Subject: Re: [R] R package documentation
Message-ID: <4BC7976E.8070406@auckland.ac.nz>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

S?bastien Bihorel wrote:
> Thanks David,
> 
> After a bit of research, I believe that I've found the post you are 
> referring to:
> 
> http://tolstoy.newcastle.edu.au/R/e9/help/10/03/8779.html
> 
> I will look into the proposed solutions.
> 
> Sebastien
> 
>

Yes, that is the thread I was referring to.

David

_________________________________________________________________
David Scott    Department of Statistics
        The University of Auckland, PB 92019
        Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:    d.scott@auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics



------------------------------

Message: 106
Date: Thu, 15 Apr 2010 17:07:29 -0600
From: Greg Snow <Greg.Snow@imail.org>
To: "djackson@miners.utep.edu" <djackson@miners.utep.edu>,
    "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Question about R mode
Message-ID:
    <B37C0A15B8FB3C468B5BC7EBC7DA14CC633341E3A7@LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

The mode is a well defined concept for theoretical distributions, but much less well defined when applied to data.  Some attempts at getting the mode of data actually returns a quirk of rounding rather than anything informative about the data and the distribution that it represents.  This is especially true when the data is supposed to represent and underlying continuous distribution.  If the theorized distribution is discrete (Poisson, binomial, etc.) then the mode may be more meaningful (but can still be the result of a quirk of rounding).  For discrete distributions you can just use the table function to get all the counts and look for the largest (and look for other similar values to see if your single "mode" is really meaningful).  For continuous distributions you need to decide what you really want and what level of approximation you are willing to live with and what assumptions you are willing to make (one simple approach is just look at the
[[elided Yahoo spam]]
lear peak, then that gives you a modal range).


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of djackson@miners.utep.edu
> Sent: Wednesday, April 14, 2010 8:55 PM
> To: r-help@r-project.org
> Subject: [R] Question about R mode
> 
> 
> Hello all,
> 
> I am using R to perform certain calculations on huge amounts of data.
> In short I need a function that does the mode function, ie returns the
> most common element.  I looked at the mode function in R but it seems
> to return the type of the data element you give it.  Does such a method
> exist?  I have tried googling this to no avail as all the results lead
> me back to the mode function I do not want.
> 
> Thanks,
> 
> Don
> 
>     [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 107
Date: Thu, 15 Apr 2010 15:20:55 -0800 (PST)
From: prem_R <mtechprem@gmail.com>
To: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <1271373655690-1934428.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


>  x <- c("2000/01/01",
"2001/02/01","2000/03/01","2000/04/01","2000/05/01","2000/06/01","2000/07/01","2000/08/01","2000/09/01","2000/10/01")
>  xd <- as.data.frame(x)
>  levels(xd$x) <- gsub("/", "-", levels(xd$x)) 
>  fix(xd)

This works fine .but with one more variable say xsd in the data frame i'm
getting the following error


Error in levels(sa$date1) <- gsub("/", "-", levels(sa$date)) : 
  attempt to set an attribute on NULL

-- 
View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1934428.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 108
Date: Thu, 15 Apr 2010 17:22:21 -0600
From: Greg Snow <Greg.Snow@imail.org>
To: Uwe Dippel <udippel@uniten.edu.my>, Peter Ehlers
    <ehlers@ucalgary.ca>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Subject: Re: [R] Consistent behaviour of for-loop
Message-ID:
    <B37C0A15B8FB3C468B5BC7EBC7DA14CC633341E3B0@LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="us-ascii"

The first thing to do is look at the help page for the function: ?qqnorm and ?qqmath, the package where these functions are defined is at the top of the page, if that package is graphics then it is a base graphics function, if the package is grid, lattice, or ggplot2 then it is grid based graphics.  If you are using a function from another package than listed already, then you will need to do a bit more research.

Is your goal really to produce a whole set of normal qq plots from random data?  If so, you may be interested in the vis.test function in the TeachingDemos package (and associated functions).  One way to run this will mix together a qqplot of your data along with data generated from a normal distribution with the same mean and var so you can visually compare the plot of your data to plots of normal (and then lets you try to choose which is the real data).

If this was just an example, then ignore the above paragraph.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Uwe Dippel
> Sent: Thursday, April 15, 2010 5:01 AM
> To: Peter Ehlers
> Cc: r-help@r-project.org
> Subject: Re: [R] Consistent behaviour of for-loop
> 
> Peter Ehlers wrote:
> > You are mixing 'traditional' graphics (par(...)) and
> > 'lattice' graphics.
> > That won't work. In lattice, you use the 'layout' argument to
> > select the number of columns/rows. This is easiest if you set
> > up a conditioning variable:
> >
> >   cond <- gl(12, 20, labels = letters[1:12])
> >   x <- rnorm(12*20)
> >   qqmath(~x | cond, layout = c(4, 3))
> >
> > Note that layout = c(columns, rows), not c(rows, columns).
> >
> > Since you're new to R, let me also recommend very strongly
> > that you learn to use the str() function (not needed for
> > this problem, but undoubtedly indispensible in your further
> > adventures in R-land).
> >
[[elided Yahoo spam]]
> 
> (It is difficult to satisfy me:)
> How can one know/see, what is traditional graphics, and what is lattice
> graphics? Or is it try-and-fail-and-use-the-alternative?
> 
> Thanks,
> 
> Uwe
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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: Thu, 15 Apr 2010 17:46:45 -0600
From: Matthew Keller <mckellercran@gmail.com>
To: Duncan Murdoch <murdoch@stats.uwo.ca>
Cc: r help <r-help@r-project.org>
Subject: Re: [R] Any chance R will ever get beyond the 2^31-1 vector
    size    limit?
Message-ID:
    <p2t3f547caa1004151646m9c4f09e8u86d0d49701c73205@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

HI Duncan and R users,

Duncan, thank you for taking the time to respond. I've had several
other comments off the list, and I'd like to summarize what these have
to say, although I won't give sources since I assume there was a
reason why people chose not to respond to the whole list. The long and
short of it is that there is hope for people who want R to get beyond
the 2^31-1 vector size limit.

First off, I received a couple of responses from people who wanted to
commiserate and me to summarize what I learned. Here you go.

Second, the package bigmemory and ff can both help with memory issues.
I've had success using bigmemory before, and found it to be quite
intuitive.

Third, one knowledgeable responder doubted that changing the 2^31-1
limit would 'break' old datasets. He says, "This might be true for
isolated cases of objects stored in binary formats or in workspaces,
but I don't see that as anywhere near as important as the change you
(and we) would like to see."

Fourth, another knowledgeable responder felt it was likely that, given
the demand driven by the huge increases in dataset sizes, this
limitation would likely be overcome within the next few years.

Best,

Matt


On Fri, Apr 9, 2010 at 6:36 PM, Duncan Murdoch <murdoch@stats.uwo.ca> wrote:
> On 09/04/2010 7:38 PM, Matthew Keller wrote:
>>
>> Hi all,
>>
>> My institute will hopefully be working on cutting-edge genetic
>> sequencing data by the Fall of 2010. The datasets will be 10's of GB
>> large and growing. I'd like to use R to do primary analyses. This is
>> OK, because we can just throw $ at the problem and get lots of RAM
>> running on 64 bit R. However, we are still running up against the fact
>> that vectors in R cannot contain more than 2^31-1. I know there are
>> "ways around" this issue, and trust me, I think I've tried them all
>> (e.g., bringing in portions of the data at a time; using large-dataset
>> packages in R; using SQL databases, etc). But all these 'solutions'
>> are, at the end of the day, much much more cumbersome,
>> programming-wise, than just doing things in native R. Maybe that's
>> just the cost of doing what I'm doing. But my questions, which ?may
>> well be naive (I'm not a computer programmer), are:
>>
>> 1) Is there an *inherent* limit to vectors being < 2^31-1 long? I.e.,
>> in an alternative history of R's development, would it have been
>> feasible for R to not have had this limitation?
>
> The problem is that we use "int" as a vector index. ?On most platforms,
> that's a signed 32 bit integer, with max value 2^31-1.
>
>
>>
>> 2) Is there any possibility that this limit will be overcome in future
>> revisions of R?
>
>
> Of course, R is open source. ?You could rewrite all of the internal code
> tomorrow to use 64 bit indexing.
>
> Will someone else do it for you? ?Even that is possible. ?One problem are
> that this will make all of your data incompatible with older versions of R.
> ?And back to the original question: ?are you willing to pay for the
> development? ?Then go ahead, you can have it tomorrow (or later, if your
> budget is limited). ?Are you waiting for someone else to do it for free?
> ?Then you need to wait for someone who knows how to do it to want to do it.
>
>
>> I'm very very grateful to the people who have spent important parts of
>> their professional lives developing R. I don't think anyone back in,
>> say, 1995, could have foreseen that datasets would be >>2^32-1 in
>> size. For better or worse, however, in many fields of science, that is
>> routinely the case today. *If* it's possible to get around this limit,
>> then I'd like to know whether the R Development Team takes seriously
>> the needs of large data users, or if they feel that (perhaps not
>> mutually exclusively) developing such capacity is best left up to ad
>> hoc R packages and alternative analysis programs.
>
> There are many ways around the limit today. ?Put your data in a dataframe
> with many columns each of length 2^31-1 or less. ?Put your data in a
> database, and process it a block at a time. ?Etc.
>
> Duncan Murdoch
>
>>
>> Best,
>>
>> Matt
>>
>>
>>
>
>



-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com



------------------------------

Message: 110
Date: Thu, 15 Apr 2010 17:05:05 -0700 (PDT)
From: Thomas Lumley <tlumley@u.washington.edu>
To: Matthew Keller <mckellercran@gmail.com>
Cc: r help <r-help@r-project.org>
Subject: Re: [R] Any chance R will ever get beyond the 2^31-1 vector
    size limit?
Message-ID:
    <alpine.LRH.2.01.1004151705050.1700@hymn14.u.washington.edu>
Content-Type: text/plain; charset="iso-8859-15"; Format="flowed"



There is one thing that would definitely break. Quite a bit of compiled code relies on the fact that the R integer type and the type used to index arrays and the C int type are the same.  The C int type won't change, so if the type used to index arrays changes, the R integer type will be different from at least one of them.

Suppose you now write   .C("foo", as.double(x), as.integer(length(x))) to call a C function
    void foo(double* x, int* n)
If length(x) could be larger than 2^31, then this isn't going to work -- either as.integer() will fail, or it will succeed and produce a value that doesn't fit in an int.


    -thomas





On Thu, 15 Apr 2010, Matthew Keller wrote:

> HI Duncan and R users,
>
> Duncan, thank you for taking the time to respond. I've had several
> other comments off the list, and I'd like to summarize what these have
> to say, although I won't give sources since I assume there was a
> reason why people chose not to respond to the whole list. The long and
> short of it is that there is hope for people who want R to get beyond
> the 2^31-1 vector size limit.
>
> First off, I received a couple of responses from people who wanted to
> commiserate and me to summarize what I learned. Here you go.
>
> Second, the package bigmemory and ff can both help with memory issues.
> I've had success using bigmemory before, and found it to be quite
> intuitive.
>
> Third, one knowledgeable responder doubted that changing the 2^31-1
> limit would 'break' old datasets. He says, "This might be true for
> isolated cases of objects stored in binary formats or in workspaces,
> but I don't see that as anywhere near as important as the change you
> (and we) would like to see."
>
> Fourth, another knowledgeable responder felt it was likely that, given
> the demand driven by the huge increases in dataset sizes, this
> limitation would likely be overcome within the next few years.
>
> Best,
>
> Matt
>
>
> On Fri, Apr 9, 2010 at 6:36 PM, Duncan Murdoch <murdoch@stats.uwo.ca> wrote:
>> On 09/04/2010 7:38 PM, Matthew Keller wrote:
>>>
>>> Hi all,
>>>
>>> My institute will hopefully be working on cutting-edge genetic
>>> sequencing data by the Fall of 2010. The datasets will be 10's of GB
>>> large and growing. I'd like to use R to do primary analyses. This is
>>> OK, because we can just throw $ at the problem and get lots of RAM
>>> running on 64 bit R. However, we are still running up against the fact
>>> that vectors in R cannot contain more than 2^31-1. I know there are
>>> "ways around" this issue, and trust me, I think I've tried them all
>>> (e.g., bringing in portions of the data at a time; using large-dataset
>>> packages in R; using SQL databases, etc). But all these 'solutions'
>>> are, at the end of the day, much much more cumbersome,
>>> programming-wise, than just doing things in native R. Maybe that's
>>> just the cost of doing what I'm doing. But my questions, which ?may
>>> well be naive (I'm not a computer programmer), are:
>>>
>>> 1) Is there an *inherent* limit to vectors being < 2^31-1 long? I.e.,
>>> in an alternative history of R's development, would it have been
>>> feasible for R to not have had this limitation?
>>
>> The problem is that we use "int" as a vector index. ?On most platforms,
>> that's a signed 32 bit integer, with max value 2^31-1.
>>
>>
>>>
>>> 2) Is there any possibility that this limit will be overcome in future
>>> revisions of R?
>>
>>
>> Of course, R is open source. ?You could rewrite all of the internal code
>> tomorrow to use 64 bit indexing.
>>
>> Will someone else do it for you? ?Even that is possible. ?One problem are
>> that this will make all of your data incompatible with older versions of R.
>> ?And back to the original question: ?are you willing to pay for the
>> development? ?Then go ahead, you can have it tomorrow (or later, if your
>> budget is limited). ?Are you waiting for someone else to do it for free?
>> ?Then you need to wait for someone who knows how to do it to want to do it.
>>
>>
>>> I'm very very grateful to the people who have spent important parts of
>>> their professional lives developing R. I don't think anyone back in,
>>> say, 1995, could have foreseen that datasets would be >>2^32-1 in
>>> size. For better or worse, however, in many fields of science, that is
>>> routinely the case today. *If* it's possible to get around this limit,
>>> then I'd like to know whether the R Development Team takes seriously
>>> the needs of large data users, or if they feel that (perhaps not
>>> mutually exclusively) developing such capacity is best left up to ad
>>> hoc R packages and alternative analysis programs.
>>
>> There are many ways around the limit today. ?Put your data in a dataframe
>> with many columns each of length 2^31-1 or less. ?Put your data in a
>> database, and process it a block at a time. ?Etc.
>>
>> Duncan Murdoch
>>
>>>
>>> Best,
>>>
>>> Matt
>>>
>>>
>>>
>>
>>
>
>
>
> -- 
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Thomas Lumley            Assoc. Professor, Biostatistics
tlumley@u.washington.edu    University of Washington, Seattle

------------------------------

Message: 111
Date: Thu, 15 Apr 2010 23:26:40 +0200 (CEST)
From: Jens Oehlschl?gel     <jens.oehlschlaegel@truecluster.com>
To: r-help@r-project.org
Subject: Re: [R] how to work with big matrices and the ff-package?
Message-ID: <16113332.277610.1271366800053.JavaMail.fmail@mwmweb018>
Content-Type: text/plain; charset=UTF-8

Anne,



> After the above step I need to convert my ff_matrix to a data.frame to discretize the whole matrix and calculate the mutual information.

> The calculated result should be saved as an ffdf-object or something similar.
> disc <- as.ffdf(discretize(as.data.frame(as.ffdf(ffmat)), disc="equalwidth", nbins=5))



ffdf are ff's aquivalent to data.frames: they handle many rows (2^31-1) and a limited number of columns (with potentially different
column types). Like data.frames, they are not suitable for millions of columns. You probably want to store your data in one big ff matrix.



If you use ff objects because you don't have the RAM for standard R objects, converting ff to a data.frame is not an option because it will require too much RAM.

If 'discretize' expects a data.frame, you cannot call it on an ff matrix either. But if 'discretize' works on single columns, you can call discretize on chunks of columns that you coerce to data.frames.



something like

for (i in chunk(from=1, to=ncol(ffmat), by=10))

ffmat[,i] <- as.matrix(discretize(as.data.frame(ffmat[,i])))



If discretize returns integers, you might want to write the results rather to an integer ff matrix because this saves disk space and improves caching.



HTH

Jens Oehlschl?gel



------------------------------

Message: 112
Date: Thu, 15 Apr 2010 13:19:18 -0800 (PST)

To: r-help@r-project.org
Subject: [R] converting Ggobi csv input to xml for line plots in 3d
Message-ID: <1271366358977-1934326.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi, 

I was wondering if any Ggboi experts have encountered the following.
I have data in csv that I want to plot with lines in ggobi. Unfortunately,
there is some kind of information missing that xml seems to contain.  I.e. I
can plot scatterplots with dots using csv input, but not connect with lines.  

Any ideas on how to convert to xml, or modify the csv file to get the
information?

P.S. An example in csv can be a simple time series with 3 embedded delay
values for columns, for example.
thanks.
-- 
View this message in context: http://n4.nabble.com/converting-Ggobi-csv-input-to-xml-for-line-plots-in-3d-tp1934326p1934326.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 113
Date: Thu, 15 Apr 2010 15:23:03 -0800 (PST)
From: yehengxin <xye78@hotmail.com>
To: r-help@r-project.org
Subject: [R] Efficiency of C Compiler in "R CMD SHLIB"
Message-ID: <1271373783646-1934429.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Dear R experts:

I attempted to compile c source code  into DLL using "R CMD SHLIB" but I
found the DLL run in R is almost twice slower than the codes compiled in C++
6.0 when I chose "release" option and is as fast as the situation where I
chose "debug" option in C++ 6.0.  I wonder how to improve the efficiency of
[[elided Yahoo spam]]

Xin 
-- 
View this message in context: http://n4.nabble.com/Efficiency-of-C-Compiler-in-R-CMD-SHLIB-tp1934429p1934429.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 114
Date: Thu, 15 Apr 2010 17:47:16 -0600
From: Samuel Bravo <sbravo09@gmail.com>
To: r-help@r-project.org
Subject: [R] Regression using R
Message-ID:
    <x2m8623de311004151647g654f63a4we3a496ad8f969bbf@mail.gmail.com>
Content-Type: text/plain

Hello,

I'm working on a very large project in which we do many calculations which
include many types of regression such as, Liner, Quadratic, Cubic,
Exponential, Sinusoidal, and Logarithmic. Im well aware that its easy enough
to do Linear regression in R but what about the other types? I've been
searching on google for such functions but to no avail.

Thank you,

-- 
Samuel Bravo
Department of Computer Science
The University of Texas at El Paso
El Paso, TX 79968

    [[alternative HTML version deleted]]



------------------------------

Message: 115
Date: Thu, 15 Apr 2010 16:38:11 -0800 (PST)
From: Sharpie <chuck@sharpsteen.net>
To: r-help@r-project.org
Subject: Re: [R] Efficiency of C Compiler in "R CMD SHLIB"
Message-ID: <1271378291036-1934478.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii



yehengxin wrote:
> 
> Dear R experts:
> 
> I attempted to compile c source code  into DLL using "R CMD SHLIB" but I
> found the DLL run in R is almost twice slower than the codes compiled in
> C++ 6.0 when I chose "release" option and is as fast as the situation
> where I chose "debug" option in C++ 6.0.  I wonder how to improve the
[[elided Yahoo spam]]
> 
> Xin 
> 

What operating system are you using?

What is "C++ 6.0"?

What do you mean by "release" and "debug".  How do these settings alter the
invocation of the compiler?

The answers to these questions can help us provide insight on your first
question.


For your last question, on UNIX/Linux platforms gcc is invoked by R CMD
SHLIB with the flags specified in $R_HOME/etc/<system architecture>/Makeconf 
.  Important entries are:

  SHLIB_CFLAGS
  SHLIB_CXXFLAGS
  SHLIB_FFLAGS


Hope this helps.

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://n4.nabble.com/Efficiency-of-C-Compiler-in-R-CMD-SHLIB-tp1934429p1934478.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 116
Date: Thu, 15 Apr 2010 20:39:45 -0400
From: James Rome <jamesrome@gmail.com>
To: r-help@r-project.org
Subject: [R] factors as bwplot x axis
Message-ID: <4BC7B1D1.9070604@gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Dear List,

I am having problems getting my box and whisker plots to put boxes on
the right x-axis values.
x is the hour of the day from 0 to 23.
> unique(mdf$OnHour)
[1]  5  4  6  7 11 12  9  8 19 14 13 21 20 10 18 17 15 16 23 22  0  1  3  2
mdf$OnHFact = factor(mdf$OnHour, levels=seq(0,23),
labels=as.character(seq(0,23)), exclude=NULL, ordered=TRUE)

I know there are data points for OnHFact=="0", but they do not appear on
the plot. The other data seem to be at their correct locations.
        hrs = seq(0, 23, 1)                
        hrlabs = as.character(seq(0,23,1))                   
        g = bwplot((gdf$tt)~gdf$OnHFact | gdf$Runway, data=gdf,
ylab="Taxi time (min)",
            main=title, xlab="Hour of day", 
par.strip.text=list(cex=0.7), rot=90,  #xlim=c(0, 24),
            scales=list(x = list(rot=90, cex=.6, at=hrs, labels=hrlabs )),
            panel = function(x, ...) {
                panel.grid(h = -1, v = -1)                           
                               
                panel.bwplot(x, ...)                                   
                                                                       
                                                                       
                   
          } )
                                               
        print(g)

Is there a prohibition of having a factor with a level of 0? If so, how
do I get around this?

I was also surprised that if I replace gdf$OnHFact by gdf$OnHour
(integers) in the above bwplot call, the plot flips and I get horizontal
whiskers of OnHour values for different tts.

So I am confused, and hope you kind people can help. I attach the zipped
dput gdf file

Thanks,
Jim Rome

------------------------------

Message: 117
Date: Thu, 15 Apr 2010 16:49:10 -0800 (PST)
From: Sharpie <chuck@sharpsteen.net>
To: r-help@r-project.org
Subject: Re: [R] Does "sink" stand for anything?
Message-ID: <1271378950496-1934484.post@n4.nabble.com>
Content-Type: text/plain; charset=UTF-8



Paul Miller wrote:
> 
> Hello Everyone,
> ?
> Learning about R and its wonderful array of functions. If it's not
> obvious, I usually try to find out what a function stands for. I think
> this helps me remember better.
> ?
> One function that has me stumped is "sink." Can anyone tell me if this
> stands for something?
> ?
> Thanks,
> ?
> Paul
> 

Sink captures R output and directs it elsewhere- common places are a file or
device such as /dev/null

Personally it always connected with the concept of a "sink" in a
mathematical system as something that removes constituants from the system.

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://n4.nabble.com/Does-sink-stand-for-anything-tp1934321p1934484.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 118
Date: Thu, 15 Apr 2010 21:02:29 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: prem_R <mtechprem@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <1104CDA9-18DF-4FD2-8F6B-D9B5C2B7986F@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 7:20 PM, prem_R wrote:

>
>> x <- c("2000/01/01",
> "2001
> / 
> 02 
> / 
> 01 
> ","2000 
> / 
> 03 
> / 
> 01 
> ","2000 
> / 
> 04 
> / 
> 01 
> ","2000 
> / 
> 05 
> /01","2000/06/01","2000/07/01","2000/08/01","2000/09/01","2000/10/01")
>> xd <- as.data.frame(x)
>> levels(xd$x) <- gsub("/", "-", levels(xd$x))
>> fix(xd)
>
> This works fine .but with one more variable say xsd in the data  
> frame i'm
> getting the following error
>
>
> Error in levels(sa$date1) <- gsub("/", "-", levels(sa$date)) :
>  attempt to set an attribute on NULL
>

Cannot reproduce the error (and you are asked in the Posting Guide to  
include the code that creates the error rather than posting code that  
does not).

x <- c("2000/01/01",
"2001 
/ 
02 
/ 
01 
","2000 
/ 
03 
/ 
01 
","2000 
/ 
04 
/ 
01 
","2000 
/ 
05/01","2000/06/01","2000/07/01","2000/08/01","2000/09/01","2000/10/01")
xd <- data.frame(x=x, a=1)  # creates another column in "a".
levels(xd$x) <- gsub("/", "-", levels(xd$x))
> xd
             x a
1  2000-01-01 1
2  2001-02-01 1
3  2000-03-01 1
4  2000-04-01 1
5  2000-05-01 1
6  2000-06-01 1
7  2000-07-01 1
8  2000-08-01 1
9  2000-09-01 1
10 2000-10-01 1

> sessionInfo()
R version 2.10.1 RC (2009-12-09 r50695)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets   
methods   base

other attached packages:
[1] adapt_1.0-4     Hmisc_3.7-0     survival_2.35-7 mapdata_2.1-1    
maps_2.1-0

loaded via a namespace (and not attached):
[1] cluster_1.12.1 grid_2.10.1    lattice_0.18-3 tools_2.10.1



> -- 
> View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1934428.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 119
Date: Thu, 15 Apr 2010 21:09:34 -0400
From: David Winsemius <dwinsemius@comcast.net>
To: prem_R <mtechprem@gmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Replace / with - in date
Message-ID: <5CC73E4F-A3C3-4644-8A2A-2A5E225B1844@comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On Apr 15, 2010, at 7:20 PM, prem_R wrote:

>
>> x <- c("2000/01/01",
> "2001
> / 
> 02 
> / 
> 01 
> ","2000 
> / 
> 03 
> / 
> 01 
> ","2000 
> / 
> 04 
> / 
> 01 
> ","2000 
> / 
> 05 
> /01","2000/06/01","2000/07/01","2000/08/01","2000/09/01","2000/10/01")
>> xd <- as.data.frame(x)
>> levels(xd$x) <- gsub("/", "-", levels(xd$x))
>> fix(xd)
>
> This works fine .but with one more variable say xsd in the data  
> frame i'm
> getting the following error
>
>
> Error in levels(sa$date1) <- gsub("/", "-", levels(sa$date)) :
>  attempt to set an attribute on NULL

Are there two columns date1 and  date in "sa"? Have you made a typo?
>
> -- 
> View this message in context: http://n4.nabble.com/Replace-with-in-date-tp1911391p1934428.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



------------------------------

Message: 120
Date: Thu, 15 Apr 2010 21:34:43 -0400
From: "Daniel Malter" <daniel@umd.edu>
To: <sbravo09@gmail.com>, <r-help@r-project.org>
Subject: Re: [R] Regression using R
Message-ID: <000c01cadd04$fdd569b0$f9803d10$@edu>
Content-Type: text/plain;    charset="us-ascii"

I think this requires you to just pick up a manual / introductory book on
R/regression in R, of which there are many on the internet / in the
bookstores, respectively. Every manual I have seen has at least examples for
quadratics. And extensions to other functional forms are straightforward.

Daniel

-------------------------
cuncta stricte discussurus
-------------------------

-----Original Message-----
From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] On
Behalf Of Samuel Bravo
Sent: Thursday, April 15, 2010 7:47 PM
To: r-help@r-project.org
Subject: [R] Regression using R

Hello,

I'm working on a very large project in which we do many calculations which
include many types of regression such as, Liner, Quadratic, Cubic,
Exponential, Sinusoidal, and Logarithmic. Im well aware that its easy enough
to do Linear regression in R but what about the other types? I've been
searching on google for such functions but to no avail.

Thank you,

-- 
Samuel Bravo
Department of Computer Science
The University of Texas at El Paso
El Paso, TX 79968

    [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 121
Date: Fri, 16 Apr 2010 04:37:55 +0300 (EEST)
From: firat.ozdemir@deu.edu.tr
To: r-help@r-project.org
Subject: [R] error
Message-ID: <1551.75.16.60.20.1271381875.squirrel@webmail.deu.edu.tr>
Content-Type: text/plain;charset=iso-8859-9

hi,

i have a simulation code for some two sample tests and in the middle of
the simulation, the code gave

Error in if (t1[1] > 0 || t1[2] < 0) yhb = yhb + 1 :
  missing value where TRUE/FALSE needed

what does it mean and how can it be solved..

f?rat



------------------------------

Message: 122
Date: Thu, 15 Apr 2010 22:09:51 -0400
From: jim holtman <jholtman@gmail.com>
To: firat.ozdemir@deu.edu.tr
Cc: r-help@r-project.org
Subject: Re: [R] error
Message-ID:
    <j2j644e1f321004151909ze6f435e6y35915b78eea1cbce@mail.gmail.com>
Content-Type: text/plain

It probably means that t1 had NAs.  look at the content of t1 at the point
of the error.  You might want to test to see if there is an NA in t1 before
the test.

2010/4/15 <firat.ozdemir@deu.edu.tr>

> hi,
>
> i have a simulation code for some two sample tests and in the middle of
> the simulation, the code gave
>
> Error in if (t1[1] > 0 || t1[2] < 0) yhb = yhb + 1 :
>  missing value where TRUE/FALSE needed
>
> what does it mean and how can it be solved..
>
> fýrat
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<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?

    [[alternative HTML version deleted]]



------------------------------

Message: 123
Date: Fri, 16 Apr 2010 10:18:09 +0800
From: Uwe Dippel <udippel@uniten.edu.my>
To: Greg Snow <Greg.Snow@imail.org>
Cc: "r-help@r-project.org" <r-help@r-project.org>,    Peter Ehlers
    <ehlers@ucalgary.ca>
Subject: Re: [R] Consistent behaviour of for-loop [Solved]
Message-ID: <4BC7C8E1.6070807@uniten.edu.my>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Greg Snow wrote:
> The first thing to do is look at the help page for the function: ?qqnorm and ?qqmath, the package where these functions are defined is at the top of the page, if that package is graphics then it is a base graphics function, if the package is grid, lattice, or ggplot2 then it is grid based graphics. 

SOLVED,
and thanks for the answer.
> Is your goal really to produce a whole set of normal qq plots from random data?  If so, you may be interested in the vis.test function in the TeachingDemos package (and associated functions).  One way to run this will mix together a qqplot of your data along with data generated from a normal distribution with the same mean and var so you can visually compare the plot of your data to plots of normal (and then lets you try to choose which is the real data).
>   

SOLVED, again. This is what I had in mind: demonstrating a bunch of 
normal qq-plots, by visually placing them side by side.
I'll try the TeachingDemos next.

Uwe



------------------------------

Message: 124
Date: Fri, 16 Apr 2010 10:55:43 +0800
From: Uwe Dippel <udippel@uniten.edu.my>
To: "r-help@r-project.org" <r-help@r-project.org>,    Greg Snow
    <Greg.Snow@imail.org>
Subject: [R] TeachingDemos install bumps out with 'Out of memory!'
Message-ID: <4BC7D1AF.5080106@uniten.edu.my>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

The same thing that happened to my 'maptools'
(http://permalink.gmane.org/gmane.comp.lang.r.general/177404)
also hits me here: It eats all memory until the system dies.
Alas, in this case, no Ubuntu package.
Since I installed some tens of packages with the same method in the 
meantime, I guess something must be wrong with the install.packages; at 
least on Ubuntu9.10, amd64.

(And I am not out of memory, really:
Mem:   3347584k total,   812872k used,  2534712k free,    12648k buffers
Swap:  4305380k total,   618464k used,  3686916k free,   272476k cached)

Uwe



------------------------------

Message: 125
Date: Thu, 15 Apr 2010 22:58:31 -0400
From: Gabor Grothendieck <ggrothendieck@gmail.com>
To: Guy Green <guygreen@netvigator.com>
Cc: r-help@r-project.org
Subject: Re: [R] Problems getting symbols() to show table data
Message-ID:
    <y2v971536df1004151958l2458dd32z987897ea269e605b@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Try this:

library(gplots)
URL <- "http://n4.nabble.com/file/n1890724/test-data.txt"
DF <- read.table(URL)

balloonplot(colnames(DF)[col(DF)], rownames(DF)[row(DF)],
    abs(as.matrix(DF)),
    dotcolor = c("lightblue", "red")[(c(matrix_data) < 0) + 1],
    show.margins = FALSE, cum.margins = FALSE,
    xlab = "", ylab = "", label = TRUE, label.lines = FALSE,
    colsrt = 90, sorted = FALSE, rowmar = 3, colmar = 2.5)



On Thu, Apr 15, 2010 at 9:23 AM, Guy Green <guygreen@netvigator.com> wrote:
>
> Thanks, balloonplot() is great and gets me really close to what I am after.
>
> However it then brings me to a slightly different problem - I wonder if
> anyone can suggest where I am going wrong?
>
> Again with simplified data (
> http://n4.nabble.com/file/n1890724/test-data.txt test-data.txt ):
>
> ? ? ? ? ? Aug-03 ? Nov-03 ? Feb-04 ? May-04 ? Aug-04
> Row1 ? ? ? 1 ? ? ? ? -1.1 ? ? ? ? 1.2 ? ? ? ?1.3 ? ? ? ?-1.4
> Row2 ? ? ? 3 ? ? ? ? -3.1 ? ? ? ? 3.2 ? ? ? ?3.3 ? ? ? ?-3.4
> Row3 ? ? ? 5 ? ? ? ? -5.1 ? ? ? ? 5.2 ? ? ? -5.3 ? ? ? ? 5.4
>
> library(gplots)
> Read_data=read.table("C:/files/test-data.txt", head = T)
> number_rows = nrow(Read_data)
> number_cols = ncol(Read_data)
> matrix_data = as.matrix(Read_data)
> row_names = rep(rownames(matrix_data),number_cols)
> col_names = rep(colnames(matrix_data),number_rows)
> x11(width=120, height=80)
> balloonplot(col_names, row_names, abs(matrix_data),
> ? ? ? ?dotcolor = c("lightblue", "red")[(c(matrix_data) < 0) + 1],
> ? ? ? ?show.margins = FALSE, cum.margins = FALSE,
> ? ? ? ?xlab = "", ylab = "", label=T, label.lines= F, colsrt=90, sorted = F,
> ? ? ? ?rowmar=3, colmar=2.5,)
>
> This gives this graphic: ?http://n4.nabble.com/file/n1890724/R_upload.jpeg
> R_upload.jpeg .
>
> The data colours go in the "right" places within the grid - i.e. with the
> correct numbers. ?However the numbers themselves are mixed up within each
> row. ?Transposing the matrix_data within balloonplot() doesn't correct it.
>
> Can someone see something simple that I am missing here? ?Thanks,
>
> Guy
> --
> View this message in context: http://n4.nabble.com/Problems-getting-symbols-to-show-table-data-tp1839676p1890724.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 126
Date: Thu, 15 Apr 2010 23:05:32 -0400
From: Ravi Varadhan <rvaradhan@jhmi.edu>
To: David Winsemius <dwinsemius@comcast.net>
Cc: r-help@r-project.org, Muhtar Osman <mjosman@gmail.com>
Subject: Re: [R] multidimensional integration in R?
Message-ID: <72a0ac153e8c.4bc79bbc@johnshopkins.edu>
Content-Type: text/plain; CHARSET=US-ASCII

There are some exciting new options available now in R for multidimensional integration also known as cubature.  

There is the "cubature" package, which is an R-port by Bala Narasimhan of the C code by Steve Johnson on adaptive multidimensional integration.  This is very similar to "adapt" which was R-port of the Fortran code by Alan Genz.
see:  http://ab-initio.mit.edu/wiki/index.php/Cubature 

There is also an exciting new package called "R2Cuba" by Annie Bouvier, which is an R port of the Cuba library of codes by Tom Hahn.  This package has 4 different cubature algorithms.

Hope this helps,
Ravi.

____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvaradhan@jhmi.edu


----- Original Message -----
From: David Winsemius <dwinsemius@comcast.net>
Date: Thursday, April 15, 2010 5:38 pm
Subject: Re: [R] multidimensional integration in R?
To: Muhtar Osman <mjosman@gmail.com>
Cc: r-help@r-project.org


>  On Apr 15, 2010, at 5:29 PM, Muhtar Osman wrote:
>  
>  >Hello,
>  >
>  >I was wondering if there is a R function can be used for
>  >multidimensional integration.
>  >There used to be a package called "adapt", but it seems not 
> available anymore.
>  
>  It's not on CRAN but you can find it in the archives.
>  
>  David Winsemius, MD
>  West Hartford, CT
>  
>  ______________________________________________
>  R-help@r-project.org mailing list
>  
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 127
Date: Fri, 16 Apr 2010 15:43:44 +1200
From: Christoph Knapp <mkna005@aucklanduni.ac.nz>
To: r-help@r-project.org
Subject: [R] hugene10stv1cdf
Message-ID:
    <h2q279238771004152043z7e381efcrda24f21d48a1d7b7@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

Hi all,
I'm just tried to start analysing some micro-array chips. And R was
asking for this package. When I tried to install it it says that:

Using R version 2.10.1, biocinstall version 2.5.10.
Installing Bioconductor version 2.5 packages:
[1] "hugene10stv1cdf"
Please wait...

Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package ?hugene10stv1cdf? is not available

What do I wrong and where can I get this package from?

Thanks

Christoph



------------------------------

Message: 128
Date: Thu, 15 Apr 2010 22:51:04 -0500
From: Erin Hodgess <erinm.hodgess@gmail.com>
To: R help <r-help@stat.math.ethz.ch>
Subject: [R]  tsp for xts or zoo object
Message-ID:
    <l2n7acc7a991004152051r726394a7xb04f79443c0e826a@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Dear R People:

Is there an equivalent for "tsp" for xts or zoo objects, please?

thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess@gmail.com



------------------------------

Message: 129
Date: Fri, 16 Apr 2010 00:09:04 -0400
From: Gabor Grothendieck <ggrothendieck@gmail.com>
To: Erin Hodgess <erinm.hodgess@gmail.com>
Cc: R help <r-help@stat.math.ethz.ch>
Subject: Re: [R] tsp for xts or zoo object
Message-ID:
    <z2v971536df1004152109q1da72244ica80763f506a5b32@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

start, end, frequency and deltat functions have methods for both ts
and zoo objects.  Its not a good idea to tsp for ts objects since it
involves mucking with internals.

On Thu, Apr 15, 2010 at 11:51 PM, Erin Hodgess <erinm.hodgess@gmail.com> wrote:
> Dear R People:
>
> Is there an equivalent for "tsp" for xts or zoo objects, please?
>
> thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess@gmail.com
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 130
Date: Thu, 15 Apr 2010 21:23:19 -0700
From: Martin Morgan <mtmorgan@fhcrc.org>
To: Christoph Knapp <mkna005@aucklanduni.ac.nz>
Cc: r-help@r-project.org
Subject: Re: [R] hugene10stv1cdf
Message-ID: <4BC7E637.3070606@fhcrc.org>
Content-Type: text/plain; charset=windows-1252

On 04/15/2010 08:43 PM, Christoph Knapp wrote:
> Hi all,
> I'm just tried to start analysing some micro-array chips. And R was
> asking for this package. When I tried to install it it says that:
> 
> Using R version 2.10.1, biocinstall version 2.5.10.
> Installing Bioconductor version 2.5 packages:
> [1] "hugene10stv1cdf"
> Please wait...
> 
> Warning message:
> In getDependencies(pkgs, dependencies, available, lib) :
>   package ?hugene10stv1cdf? is not available
> 
> What do I wrong 

Ask questions about bioconductor packages on the Bioconductor mailing list.

  http://bioconductor.org/docs/mailList.html

From

  http://bioconductor.org/packages/release/AnnotationData.html

I suspect you want

  biocLite('hugene10stv1.r3cdf')

This thread

  https://stat.ethz.ch/pipermail/bioconductor/2010-April/032704.html

might also be relevant.

Martin



> and where can I get this package from?
> 
> Thanks
> 
> Christoph
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



------------------------------

Message: 131
Date: Thu, 15 Apr 2010 16:52:12 -0800 (PST)
From: yehengxin <xye78@hotmail.com>
To: r-help@r-project.org
Subject: Re: [R] Efficiency of C Compiler in "R CMD SHLIB"
Message-ID: <1271379132551-1934485.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


Thanks for your response.  I found the folder to modify the compiler for C
source codes.  C++ 6.0 is an old C programming environment (1994~1998) but
it is efficient.   When compiling C source codes in C programming
environment, one needs to choose between "debug" or "release" modes. 
"release" mode is much faster than "debug" mode.  But in R's "R CMD SHLIB",
I did not see such an option.   

I want to try alternative compilers to see if I can reach that level of
efficiency in R's DLL.  Later, I may try using "OPENMP" in my C codes to do
parallel computing.  So I need to figure out how to change compiler to
[[elided Yahoo spam]]
-- 
View this message in context: http://n4.nabble.com/Efficiency-of-C-Compiler-in-R-CMD-SHLIB-tp1934429p1934485.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 132
Date: Thu, 15 Apr 2010 16:53:35 -0800 (PST)
From: yehengxin <xye78@hotmail.com>
To: r-help@r-project.org
Subject: Re: [R] Efficiency of C Compiler in "R CMD SHLIB"
Message-ID: <1271379215645-1934486.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


I am using 32-bit Window XP. 
-- 
View this message in context: http://n4.nabble.com/Efficiency-of-C-Compiler-in-R-CMD-SHLIB-tp1934429p1934486.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 133
Date: Fri, 16 Apr 2010 07:23:28 +0100 (BST)
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
To: yehengxin <xye78@hotmail.com>
Cc: r-help@r-project.org
Subject: Re: [R] Efficiency of C Compiler in "R CMD SHLIB"
Message-ID:
    <alpine.LFD.2.00.1004160643120.17135@gannet.stats.ox.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Since the context is missing in this message, from others this is 
about 32-bit Windows.

On Thu, 15 Apr 2010, yehengxin wrote:

> Thanks for your response.  I found the folder to modify the compiler for C
> source codes.  C++ 6.0 is an old C programming environment (1994~1998) but
> it is efficient.   When compiling C source codes in C programming
> environment, one needs to choose between "debug" or "release" modes.

That's true for just one family of compilers in my experience.

> "release" mode is much faster than "debug" mode.  But in R's "R CMD SHLIB",
> I did not see such an option.

Then I suspect you did not look in the obvioud place (mentioned on 
the help page), for I see

% R CMD SHLIB --help
...
Windows only:
   -d, --debug        build a debug DLL

An optimized ('release') build is standard, and in any case gcc is 
capable of both optimizing and including debug information, unlike 
some other compilers.  With gcc debug code is normally the same speed, 
just a larger compiled file.

> I want to try alternative compilers to see if I can reach that level of
> efficiency in R's DLL.

This is *your* DLL, not one in R, surely?  Note that people have 
compiled R with Visual C++ 6.0 (to use the correct name) and it ran 
slower and less accurately than using gcc.  So finding VC++ to produce 
faster code is not usual, and this seems to be something special about 
your C code. The default level of optimization for gcc in R for 
Windows is -O3, and you could try raising it: also if you want to 
target only recent non-Atom chips set -tune= appropriately.

x86 is a very widely used architecture with a competitive field of 
commercial compilers.  On Linux (and AFAIK on Windows) gcc produces 
some of the best-performing code (see the comments in the 'R 
Administration and Installation Manual').  Most of the ways to produce 
faster code lose compliance with IEC60559 and accuracy (VC++ 6 never 
has those).  And the same code compiled with gcc runs on the same 
hardware only slightly slower on Windows than on Linux unless I/O is 
involved (where Windows is much slower).

> Later, I may try using "OPENMP" in my C codes to do parallel 
> computing.

gcc 4.2.1 supports OpenMP, and later versions support it better 
(OpenMP 3).

> So I need to figure out how to change compiler to
> generate DLL for R.  Could you give me some suggestions?  Thanks a lot!

A DLL is a DLL: you can compile it any way you like (although cdecl 
calling conventions work best, and compilers do differ in their 
conventions for function return values -- but those are not used in 
the .C interface).  There is a file README.packages in the R 
distribution with notes about using other compilers under Windows -- 
but the R developers have not used other than VC++ and Intel's ICC 
(not mentioned there) for several years.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



------------------------------

Message: 134
Date: Thu, 15 Apr 2010 22:24:59 -0800 (PST)
From: Dieter Menne <dieter.menne@menne-biomed.de>
To: r-help@r-project.org
Subject: Re: [R] Regression using R
Message-ID: <1271399099004-1951658.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii



Samuel Bravo wrote:
> 
> 
> I'm working on a very large project in which we do many calculations which
> include many types of regression such as, Liner, Quadratic, Cubic,
> Exponential, Sinusoidal, and Logarithmic. 
> 

Students are often looking at the wrong place. It's not intuitive that
quadratic, cubic can be found under "lm", because these are often termed
"non-linear" in basic university courses.  

Dieter

-- 
View this message in context: http://n4.nabble.com/Regression-using-R-tp1934475p1951658.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 135
Date: Fri, 16 Apr 2010 08:44:09 +0200
From: "arnaud Gaboury" <arnaud.gaboury@gmail.com>
To: "'Christian Raschke'" <crasch2@tigers.lsu.edu>,
    <r-help@r-project.org>
Subject: Re: [R] Replace / with - in date
Message-ID: <4bc8074d.0c58560a.7afe.5ef4@mx.google.com>
Content-Type: text/plain;    charset="us-ascii"

Why don't you try something like :

Xd$x=as.date(xd$x,format="%y/%m/%d").





> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Christian Raschke
> Sent: Thursday, April 15, 2010 8:28 PM
> To: r-help@r-project.org
> Subject: Re: [R] Replace / with - in date
> 
> Is there anything that speaks against just applying gsub to the factor
> levels if one would like to keep everything as factors (and not
> consider
> true Date classes or character vectors)? I.e:
> 
>  > x <- c("2000/01/01", "2001/02/01")
>  > xd <- as.data.frame(x)
>  > levels(xd$x) <- gsub("/", "-", levels(xd$x))
> 
> Christian
> 
> 
> On 04/15/2010 01:08 PM, David Winsemius wrote:
> >
> > On Apr 15, 2010, at 1:51 PM, prem_R wrote:
> >
> >>
> >> Hi,every one .I have searched the solutions in the forum  for
> >> replacing my
> >> date value which is in a data frame  ,01/01/2000 to 01-01-2000 using
> >> replace
> >> function but got the following warning message
> >> x<-"2000/01/01"
> >> xd<-as.data.frame(x)
> >> xd$x<-replace(xd$x,xd$x=="/","-")
> >
> > The replace function does not work with factors, it works with
> > (complete) vectors, not substrings. It's also a real hassle to do
> such
> > operations on factors, so just use character vectors and try gsub
> > instead:
> >
> > > x<-"2000/01/01"
> > > xd<-as.data.frame(x, stringsAsFactors=FALSE)
> > > xd$x2<-gsub("/","-", xd$x)
> > > xd
> >            x         x2
> > 1 2000/01/01 2000-01-01
> >
> >>
> >>
> >> Warning message:
> >> In `[<-.factor`(`*tmp*`, list, value = "-") :
> >>  invalid factor level, NAs generated
> >>
> >> Is there any other method of doing it? or am i missing something?.
> >> please
> >> let me know if you need any more information.
> >>
> >> Thanks.
> >>
> >> Prem
> >> --
> >> View this message in context:
> >> http://n4.nabble.com/Replace-with-in-date-tp1911391p1911391.html
> >> Sent from the R help mailing list archive at Nabble.com.
> >>
> >> ______________________________________________
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > David Winsemius, MD
> > West Hartford, CT
> >
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 
> --
> Christian Raschke
> Department of Economics
> and
> ISDS Research Lab (HSRG)
> Louisiana State University
> Patrick Taylor Hall, Rm 2128
> Baton Rouge, LA 70803
> crasch2@lsu.edu
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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: 136
Date: Fri, 16 Apr 2010 08:21:30 +0100
From: Barry Rowlingson <b.rowlingson@lancaster.ac.uk>
To: Sharpie <chuck@sharpsteen.net>
Cc: r-help@r-project.org
Subject: Re: [R] Does "sink" stand for anything?
Message-ID:
    <v2xd8ad40b51004160021he31422abh159585ea7d4eb356@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Apr 16, 2010 at 1:49 AM, Sharpie <chuck@sharpsteen.net> wrote:

> Sink captures R output and directs it elsewhere- common places are a file or
> device such as /dev/null
>
> Personally it always connected with the concept of a "sink" in a
> mathematical system as something that removes constituants from the system.

Also, note that 'sink' has nothing to do with floating point numbers...

-- 
blog: http://geospaced.blogspot.com/
web: http://www.maths.lancs.ac.uk/~rowlings
web: http://www.rowlingson.com/
twitter: http://twitter.com/geospacedman
pics: http://www.flickr.com/photos/spacedman



------------------------------

Message: 137
Date: Fri, 16 Apr 2010 00:15:58 -0800 (PST)
From: Kay Cichini <Kay.Cichini@uibk.ac.at>
To: r-help@r-project.org
Subject: Re: [R] glmer with non integer weights
Message-ID: <1271405758382-1965623.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


thanks thierry,

i considered this transformations already, but variance is not stabilized
and/or normality is neither achieved.
i guess i'll have to look out for non-parametrics?

best regards,
kay
-- 
View this message in context: http://n4.nabble.com/glmer-with-non-integer-weights-tp1837179p1965623.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 138
Date: Fri, 16 Apr 2010 10:16:30 +0200
From: "arnaud Gaboury" <arnaud.gaboury@gmail.com>
To: <r-help@r-project.org>
Subject: [R] data frame manipulation
Message-ID: <4bc81ced.0437560a.077e.ffff938f@mx.google.com>
Content-Type: text/plain;    charset="us-ascii"

Dear group,

Here is my data.frame :


df <-
structure(list(DESCRIPTION = c("PRM HGH GD ALU", "PRM HGH GD ALU", 
"PRIMARY NICKEL", "PRIMARY NICKEL", "PRIMARY NICKEL", "PRIMARY NICKEL", 
"STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", 
"STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", 
"SPCL HIGH GRAD", "SPCL HIGH GRAD", "SPCL HIGH GRAD", "SPCL HIGH GRAD", 
"SPCL HIGH GRAD", "SPCL HIGH GRAD", "SPCL HIGH GRAD", "SPCL HIGH GRAD", 
"SPCL HIGH GRAD", "SPCL HIGH GRAD"), CREATED.DATE = structure(c(14708, 
14708, 14672, 14673, 14678, 14678, 14700, 14700, 14700, 14700, 
14700, 14700, 14700, 14705, 14707, 14707, 14707, 14708, 14708, 
14708, 14708, 14708, 14622, 14634), class = "Date"), QUANITY = c(-1, 
1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 
-1, 1, 1, 1, -1), CLOSING.PRICE = c("2,415.9000", "2,415.9000", 
"25,755.7100", "25,755.7100", "25,760.8600", "25,760.8600", "2,355.9600", 
"2,355.9600", "2,355.9600", "2,355.9600", "2,355.9600", "2,355.9600", 
"2,355.9600", "2,357.1200", "2,420.7300", "2,420.7300", "2,420.7300", 
"2,421.0500", "2,421.0500", "2,421.0500", "2,421.0500", "2,421.0500", 
"2,388.4300", "2,388.4300")), .Names = c("DESCRIPTION", "CREATED.DATE", 
"QUANITY", "CLOSING.PRICE"), row.names = 26:49, class = "data.frame")

I am looking at summarize it in something like this :

> op
     DESCRIPTION POSITION       DATE
1 PRIMARY NICKEL        0 2010-03-10
2 PRM HGH GD ALU        0 2010-04-09
3 SPCL HIGH GRAD        2 2010-04-09
4 STANDARD LEAD         0 2010-04-06



To obtain "op", I wrote this following line :

>   op=ddply(df, c("DESCRIPTION"), summarise, POSITION=
sum(QUANITY),DATE=max(CREATED.DATE)).

Until there, fine. But I need to have one more column, "CLOSING.PRICE". If I
write this line :


>   op1=ddply(c, c("DESCRIPTION","CLOSING.PRICE"), summarise, POSITION=
sum(QUANITY),DATE=max(CREATED.DATE))

Here is what I get:


> op1
     DESCRIPTION CLOSING.PRICE POSITION       DATE
1 PRIMARY NICKEL   25,755.7100        0 2010-03-05
2 PRIMARY NICKEL   25,760.8600        0 2010-03-10
3 PRM HGH GD ALU    2,415.9000        0 2010-04-09
4 SPCL HIGH GRAD    2,388.4300        0 2010-01-25
5 SPCL HIGH GRAD    2,420.7300        1 2010-04-08
6 SPCL HIGH GRAD    2,421.0500        1 2010-04-09
7 STANDARD LEAD     2,355.9600       -1 2010-04-01
8 STANDARD LEAD     2,357.1200        1 2010-04-06

Not exactly what I want. Can anyone help?
TY



------------------------------

Message: 139
Date: Fri, 16 Apr 2010 00:17:43 -0800 (PST)
From: Kay Cichini <Kay.Cichini@uibk.ac.at>
To: r-help@r-project.org
Subject: Re: [R] glmer with non integer weights
Message-ID: <1271405863426-1965827.post@n4.nabble.com>
Content-Type: text/plain; charset=us-ascii


[[elided Yahoo spam]]

yours,
kay
-- 
View this message in context: http://n4.nabble.com/glmer-with-non-integer-weights-tp1837179p1965827.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 140
Date: Fri, 16 Apr 2010 00:38:05 -0800 (PST)
From: Vava <valere.martin@vogelwarte.ch>
To: r-help@r-project.org
Subject: Re: [R] Error in library(gplots) : there is no package called
    'gplots'
Message-ID: <1271407085938-1968197.post@n4.nabble.com>
Content-Type: text/plain; charset=UTF-8


Thanks for your suggestion Tal. Unfortunately, still no luck with me ...
still get the usual error message:

" Error in library(gplots) : there is no package called 'gplots' ", whatever
I try to install.

This is a mystery to me with respect to why /how. I am really stuck with
that problem.

Best, 

Val?re
-- 
View this message in context: http://n4.nabble.com/Error-in-library-gplots-there-is-no-package-called-gplots-tp1690367p1968197.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 141
Date: Fri, 16 Apr 2010 09:46:58 +0100
From: james <james@ipec.co.uk>
To: Vava <valere.martin@vogelwarte.ch>
Cc: R Help List <r-help@r-project.org>
Subject: Re: [R] Error in library(gplots) : there is no package    called
    'gplots'
Message-ID: <4BC82402.4070706@ipec.co.uk>
Content-Type: text/plain; charset=UTF-8; format=flowed

Hi Vava,
What version of R are you using? I'm not sure but I think that R will 
refuse to install a package in this way if the version of gplots is 
incompatiable with the version of R you're using. You can check the 
depends of packages on CRAN.

Regards,
James

Vava wrote:
> Thanks for your suggestion Tal. Unfortunately, still no luck with me ...
> still get the usual error message:
>
> " Error in library(gplots) : there is no package called 'gplots' ", whatever
> I try to install.
>
> This is a mystery to me with respect to why /how. I am really stuck with
> that problem.
>
> Best, 
>
> Val?re
>



------------------------------

Message: 142
Date: Fri, 16 Apr 2010 11:26:14 +0200
From: soeren.vogel@eawag.ch
To: r-help@r-project.org
Subject: [R] Return a variable name
Message-ID: <EA61CAEA-62F5-4179-814E-CD1037228A7A@eawag.ch>
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes

Hello,

how can I return the name of a variable, say "a$b", from a function?

fun <- function(x){
   return(substitute(x));
}
a  <- data.frame(b=1:10);
fun(a$b)

... returns a$b, but this is a type language, thus I can't use it as a  
character string, can I? How?

Thanks for help,

S?ren



------------------------------

Message: 143
Date: Fri, 16 Apr 2010 11:27:27 +0200 (CEST)
From: "n.vialma@libero.it" <n.vialma@libero.it>
To: <r-help@r-project.org>
Subject: [R] merge
Message-ID:
    <12514939.237851271410047551.JavaMail.defaultUser@defaultHost>
Content-Type: text/plain; charset="utf-8"

I have a problem with the merge function:
I need to merge the data.frames that you will find as arrachmente...I try all 
the possible combinations....but none seems to work properly....
Does anyone knows how to do it??
thanks

------------------------------

Message: 144
Date: Fri, 16 Apr 2010 02:40:30 -0700 (PDT)

To: r-help@stat.math.ethz.ch
Subject: [R] error at R CMD check
Message-ID: <965903.67509.qm@web62002.mail.re1.yahoo.com>
Content-Type: text/plain; charset=utf-8

Hi,
I generated an R package but at running R CMD check, I got the following error message for the first data file:

*** installing help indices
>>> Building/Updating help pages for package 'jamda'
     Formats: text html latex example 
  f1                           text    html    latex   example
  f2                            text    html    latex   example
f3                                 text    html    latex   example
  f4                            text    html    latex   example
  f5                            text    html    latex   example
  f6                      text    html    latex   example
too many pairs of braces in file 'data1.Rd' at /usr/lib64/R/share/per
l/R/Rdconv.pm line 295, <$rdfile> line 7076.
ERROR: building help failed for package ?my_package?

Should the data sets be in a specific format? Mine contains data in float seperated by tab with column names and row names. No description in DESCRIPTIOn file yet.

Thanks 

Carol







------------------------------

Message: 145
Date: Fri, 16 Apr 2010 15:24:39 +0530
From: arindam fadikar <arindam.fadikar@gmail.com>
To: r-help@r-project.org
Subject: [R] problem with the version of R
Message-ID:
    <k2g1a639c191004160254o714434aftc5877dc84a29e484@mail.gmail.com>
Content-Type: text/plain

Dear users,

I am using R in UBUNTU , but the version is 9.1. How can I upgrade it to R
10.1?

-- 
Arindam Fadikar
M.Stat
Indian Statistical Institute.
New Delhi, India

    [[alternative HTML version deleted]]



------------------------------

_______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

End of R-help Digest, Vol 86, Issue 16
**************************************


__________________________________________________



	[[alternative HTML version deleted]]

