Skip to content

[plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

7 messages · Sunny Srivastava, Peter Ehlers, jim holtman +1 more

#
On 2010-12-06 01:58, Sunny Srivastava wrote:
Try it without the .(), i.e. ddply(df, as.name(), ....)

Peter Ehlers
[ snip ]
#
Here is another approach to try:
Classes ?data.table? and 'data.frame':  6 obs. of  5 variables:
 $ g10: int  1 1 1 10 10 10
 $ l1 : num  0.41 0.607 0.64 -1.478 -1.482 ...
 $ d1 : num  0.918 0.959 0.773 0.474 0.591 ...
 $ l13: num  0.08037 -0.29174 -0.00191 0.29589 0.61538 ...
 $ d13: num  -1.408 -1.275 -1.412 0.709 0.276 ...
g10        min       max
[1,]   1 0.77292857 0.9592568
[2,]  10 0.04486293 0.5905809


On Mon, Dec 6, 2010 at 4:58 AM, Sunny Srivastava
<research.baba at gmail.com> wrote:

  
    
#
On Mon, Dec 6, 2010 at 3:58 AM, Sunny Srivastava
<research.baba at gmail.com> wrote:
Why do you expect case 1 to work?

Hadley
#
It's easiest to see what's going on if you use eval.quoted directly:

eval.quoted(.(cyl), mtcars)
eval.quoted(.("cyl"), mtcars)
eval.quoted(.(as.name("cyl")), mtcars)

But you shouldn't need to do any syntactic hackery because the default
method automatically parses the string for you:

eval.quoted(as.quoted("cyl"), mtcars)

Hadley

On Mon, Dec 6, 2010 at 6:22 PM, Sunny Srivastava
<research.baba at gmail.com> wrote: