Despite a long search on the archives, I couldn't find how to do this.
Thanks in advance for what is likely a simple issue.
I have a data set where the first column is name (i.e., 'Joe Smith',
'Jane Doe', etc). The following columns are data associated with that
person. I have many people with
This isn't pretty, but should work:
x - 10 # number of occurrences
y - split(all.data,f=all.data$names)
z - y[unlist(lapply(y,nrow))x]
newdata - vector()
for( k in z ) {
newdata - rbind(newdata,k)
}
Basically I split your data frame into groups by name (into a list), then
selected elements in
try this:
set.seed(123)
all.data - data.frame(name = sample(c(Joe, Elen, Jane, Mike),
8, TRUE),
x = rnorm(8), y = runif(8))
##
tab.nams - table(all.data$name)
nams - names(tab.nams[tab.nams = 2])
all.data[all.data$name %in% nams, ]
I hope it helps.
Best,
Dimitris
Dimitris
On Tue, 2007-03-13 at 10:38 -0400, Mike Jasper wrote:
Despite a long search on the archives, I couldn't find how to do this.
Thanks in advance for what is likely a simple issue.
I have a data set where the first column is name (i.e., 'Joe Smith',
'Jane Doe', etc). The following columns are
Mike Jasper wrote:
Despite a long search on the archives, I couldn't find how to do this.
Thanks in advance for what is likely a simple issue.
I have a data set where the first column is name (i.e., 'Joe Smith',
'Jane Doe', etc). The following columns are data associated with that
person. I
On Tue, 2007-03-13 at 10:32 -0500, Marc Schwartz wrote:
On Tue, 2007-03-13 at 10:38 -0400, Mike Jasper wrote:
Despite a long search on the archives, I couldn't find how to do this.
Thanks in advance for what is likely a simple issue.
I have a data set where the first column is name
Thanks to all of you who got me the answer. The key I was missing was
%in%. Had never seen it before.
best.
On 3/13/07, Dimitris Rizopoulos [EMAIL PROTECTED] wrote:
try this:
set.seed(123)
all.data - data.frame(name = sample(c(Joe, Elen, Jane, Mike),
8, TRUE),
x = rnorm(8), y =