> Something along the lines of > > dat2 <- ifelse( dat1==1 , "yes", "no")
Another option is in this case dat2 <- c("no", "yes")[dat1+1] Regards Petr > > should do it. > > John Kane > Kingston ON Canada > > > > -----Original Message----- > > From: s1010...@student.hsleiden.nl > > Sent: Mon, 14 May 2012 05:45:38 -0700 (PDT) > > To: r-help@r-project.org > > Subject: [R] Add column from other columns data. > > > > Hi everyone, > > > > I am having some problems with making a new colomn wit data in it. > > I have this one column named: Fulfilled > > > > Fulfilled > > 1 > > 1 > > 0 > > 1 > > 1 > > 1 > > 1 > > 0 > > 0 > > 1 > > > > And now I would like to add another colum to my .csv file ("Finished") > > > > In this "Finished" column I would like to have "Yes" or "No". > > Where in colomn "Fullfilled" is a 1, "Finished" should have a "Yes". > > Like this: > > > > Fullfilled Finished > > 1 Yes > > 1 Yes > > 0 No > > etc > > > > Now I know how to grab the data out of a column, and also know how to > > save > > data inside a .csv file. > > That is no problem. > > But how do I get the right Yes or No on the right place in the other > > column? > > > > # Get al values: 1 > > Fullfilled_1 = Fullfilled[Fullfilled = 1] > > > > I was thinkng about subset. > > But I don' t realy know if that would be realy it.... > > > > Maybe somebody here can push me a little in the right direction? > > > > > > -- > > View this message in context: > > http://r.789695.n4.nabble.com/Add-column-from-other-columns-data-tp4629921.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > 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. > > ____________________________________________________________ > Publish your photos in seconds for FREE > TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4 > > ______________________________________________ > 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. ______________________________________________ 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.