Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sneha Bishnoi
t; -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Sneha Bishnoi > Sent: Thursday, March 27, 2014 11:06 AM > To: Sarah Goslee > Cc: r-help > Subject: Re: [R] Subsetting a dataframe by dynamic column name > > Hi Sara

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread David Carlson
e Cc: r-help Subject: Re: [R] Subsetting a dataframe by dynamic column name Hi Sarah, Thanks! Do agree its over complicated. However looking at the solutions I think I did not state my problem completely. V provides choices for only certain set of columns in Finaldata. So v2 may not represent al

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sneha Bishnoi
Hi Sarah, Thanks! Do agree its over complicated. However looking at the solutions I think I did not state my problem completely. V provides choices for only certain set of columns in Finaldata. So v2 may not represent all columns of Finaldata. I want to retain columns not provided as a choice for

Re: [R] Subsetting a dataframe by dynamic column name

2014-03-27 Thread Sarah Goslee
There are many ways. You're making it overly complicated Here, in an actual reproducible example (as you were requested to submit): V <- data.frame(v1=c(1,0,0), v2=c("Shape", "Length", "Rate"), stringsAsFactors=FALSE) Finaldata <- data.frame(Shape = runif(5), Length = runif(5), Rate = runif(5))