Hello everyone,

I have two questions:

1)

I want to create a subset of a data frame column-wise and simultaneously
extract the row names into a "proper" variable. I tried this, but received
an error:

> myleft<-mydata[c(id=row.names(mydata),"workshop","gender","q1","q2")]
Error in `[.data.frame`(mydata, c(id = row.names(mydata), "workshop",  :
  undefined columns selected
Is the following the best way to go about this:

>
myleft<-data.frame(id=row.names(mydata),mydata)[c("id","workshop","gender","q1","q2")]
> myleft

2)

Is it possible to merge data using merge() with a by variable that is the
row names? I tried this:

> both<-merge(myleft,myright,by=row.names(myleft))
Error in fix.by(by.x, x) : 'by' must specify valid column(s)
> both
Suggestions?


Thanks!

Dan

	[[alternative HTML version deleted]]

