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

R. Michael Weylandt michael.weylandt at gmail.com
Wed Apr 18 03:25:18 CEST 2012


Ok, so you simply need to use the methods David or I provided -- it
looks like you don't even have to change the variable names...

Is there something that isn't clear now?

Also, reproducible examples are much better if you use dput() so they
are actually reproducible....

Michael

On Tue, Apr 17, 2012 at 5:17 PM, phillip03 <phillipbrigham at hotmail.com> wrote:
> This is the first and last part of my data frame. There is 3465 (not 7000)
> observations so the "1 or 0" column has to be 3465 rows long aswell
>
>     year country1 country2 contig comlang        pop1        gdp1
> pop2         gdp2 rta    dist      avgflow
> 1    1992      AUS      AUT      0       0  17.4950008  321708.281
> 7.7825189   194684.078   0 15608.4 1.075999e+02
> 2    1992      AUS      BEL      0       0  17.4950008  321708.281
> 10.0450001   231762.094   0 16319.2 4.767162e+02
> 3    1992      AUS      CAN      0       1  17.4950008  321708.281
> 28.5195980   570291.188   0 15391.1 7.456945e+02
> 4    1992      AUS      CHE      0       0  17.4950008  321708.281
> 6.8750000   249471.422   0 16170.1 4.625214e+02
> 5    1992      AUS      DEU      0       0  17.4950008  321708.281
> 80.6240005  2062141.500   0 15935.1 2.047573e+03
> .
> .
> .
> .
> .
> .
> 3461 2006      NZL      SWE      0       0   4.1253757  103873.211
> 9.0457277   384927.281   0 17389.6 1.371846e+02
> 3462 2006      NZL      USA      0       1   4.1253757  103873.211
> 298.9880981 13201819.000   0 12765.8 3.273475e+03
> 3463 2006      PRT      SWE      0       0  10.5896521  192571.922
> 9.0457277   384927.281   1  2821.6 6.624816e+02
> 3464 2006      PRT      USA      0       0  10.5896521  192571.922
> 298.9880981 13201819.000   0  7004.5 2.381285e+03
> 3465 2006      SWE      USA      0       0   9.0457277  384927.281
> 298.9880981 13201819.000   0  7440.5 9.777735e+03
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-add-specific-column-to-data-set-tp4565341p4566008.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