Hi, I need to run a script under the variable (that comes from a csv file) that is assigned to another variable. This is very a simplified version of what I want to do: data<-read.csv('name.csv') names(data)<-("VA","VB","VC") v<-VA mn(v) Thank you in advance, Judith ____________________________________________________________________________________ Got a little couch potato? Check out fun summer activities for kids.
I think you want: v <- data$VA On 7/2/07, Judith Flores <juryef@yahoo.com> wrote:> > Hi, > > I need to run a script under the variable (that > comes from a csv file) that is assigned to another > variable. This is very a simplified version of what I > want to do: > > data<-read.csv('name.csv') > names(data)<-("VA","VB","VC") > > v<-VA > > mn(v) > > > Thank you in advance, > > Judith > > > > > > > > ____________________________________________________________________________________ > Got a little couch potato? > Check out fun summer activities for kids. > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? [[alternative HTML version deleted]]
On 02-Jul-07 23:01:07, Judith Flores wrote:> Hi, > I need to run a script under the variable (that > comes from a csv file) that is assigned to another > variable. This is very a simplified version of what I > want to do: > > data<-read.csv('name.csv') > names(data)<-("VA","VB","VC") > > v<-VA > > mn(v) > > Thank you in advance, > Judithread.csv() makes 'data' into a dataframe. This is essentially a list with named components. So VA is not yet available as a variable in your program. The data for the variable you want to call "VA" is stored as the component 'data$VA' of 'data'. The names "VA", "VB", "VC" are the names you have given to the *components* of 'data'; you have not created separate variables with these names. So you can assign the data for VA directly to 'v' with: v<-data$VA or (if you think you will need it later) create a variable VA using VA<-data$VA and, if you want a variable called 'v' as well, then: v<-VA Hoping this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 03-Jul-07 Time: 00:32:40 ------------------------------ XFMail ------------------------------