[R] How to add specific column to data.set?

R. Michael Weylandt michael.weylandt at gmail.com
Thu Apr 19 07:11:02 CEST 2012


No.... like I said, lapply gets columnwise results (if you stopped
there, it would tell you whether each country is in the EU separately)
and the Reduce() combines them. Re-read my explanation and play around
with it on your own data set.

To convert 1 -> True and 2 -> False, you could use Boolean coercion
with something like 2 - x

Michael

On Wed, Apr 18, 2012 at 1:49 PM, phillip03 <phillipbrigham at hotmail.com> wrote:
> So the lapply function checks every country pair row for row (in my country1
> and country2 column) and send back a true if both countries are EU?
>
> How do I get a 1 instead of true and 2 instead of false?
>
> You have been a BIG help.
>
> I have a WHOLE assignment to get done, so maybe I'll post some more
> questions :)
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-add-specific-column-to-data-set-tp4565341p4568491.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list