[R] Creating new variables. How do you get them into a data frame?
Sarah Goslee
sarah.goslee at gmail.com
Mon Feb 28 13:05:28 CET 2011
Hi Nick,
You want:
cbind(mydataframe, newvar)
and possibly also a quick read of one of the intro to R documents available
online.
Sarah
On Mon, Feb 28, 2011 at 6:55 AM, Nick Riches <nick.riches at gmail.com> wrote:
> Hi
>
> I'm an R newbie. I can't seem to add new variables to data frames. Here are
> the stages
>
> (1) I import the data using read.csv.
> (2) I fix it using fix(data)
> (3) I create a new variable using
> spos<-tagPOS(stim,language="en",model=NULL,tagdict=NULL).
>
> (tagPOS is a function in the OpenNLP toolkit, which tags a string for part
> of speech. "stim" is a variable in the current data frame)
>
> What happens is that the new variable, "spos" is saved as an object, but not
> added to the data frame.
>
> Could anyone help me with this?
>
> Thanks
>
> Nick Riches
>
--
Sarah Goslee
http://www.functionaldiversity.org
More information about the R-help
mailing list