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.ric...@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

______________________________________________
R-help@r-project.org 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.

Reply via email to