On Fri, Apr 3, 2009 at 4:43 AM, baptiste auguie ba...@exeter.ac.uk wrote:
Dear all,
I'm puzzled by the following example inspired by a recent question on
R-help,
cc - textConnection(user_id website time
20 google 0930
21 yahoo 0935
20
baptiste auguie-2 wrote:
ddply(d, .(website), transform, count = table(user_id)) # why two new
columns?
Try this to see why:
as.data.frame(table(d$user_id))
This works more like you expect:
ddply(d, .(website), transform, count = unclass(table(user_id)))
- Tom
--
View this
On Fri, Apr 3, 2009 at 8:43 AM, baptiste auguie ba...@exeter.ac.uk wrote:
That makes sense, so I can do something like,
count - function(x){
as.integer(unclass(table(x)))
}
count(d$user_id)
ddply(d, .(user_id), transform, count = count(user_id))
user_id website time count
1
That makes sense, so I can do something like,
count - function(x){
as.integer(unclass(table(x)))
}
count(d$user_id)
ddply(d, .(user_id), transform, count = count(user_id))
user_id website time count
1 20 google 930 2
2 20 facebook 1000 2
3 21yahoo
of course!
Thanks,
baptiste
On 3 Apr 2009, at 14:48, hadley wickham wrote:
On Fri, Apr 3, 2009 at 8:43 AM, baptiste auguie ba...@exeter.ac.uk
wrote:
That makes sense, so I can do something like,
count - function(x){
as.integer(unclass(table(x)))
}
count(d$user_id)
ddply(d,
5 matches
Mail list logo