Assuming you actually have a data frame or matrix, and not a csv file, ifelse() is the general solution to your problem.
Sarah On May 14, 2012, at 8:45 AM, Yellow <s1010...@student.hsleiden.nl> wrote: > 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. ______________________________________________ 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.