[R] Concatenation?

Eric Berger er|cjberger @end|ng |rom gm@||@com
Wed Feb 17 22:17:40 CET 2021


desired <- paste(site,depth,sep="")

On Wed, Feb 17, 2021 at 11:10 PM Parkhurst, David <parkhurs using indiana.edu>
wrote:

> If I have a vector of site abbreviations and a vector of depths in those
> water bodies, is there a simple way in R to combine them to make a third
> vector?
> Examples:
>
> site    depth           desired
> MU      0               MU0
> MU      1               MU1
> MU      2               MU2
> MC      0               MC0
> MC      1               MC1
> MC      2               MC2
>
> The dataset has many more lines than this.  I can see how to do this with
> lots of if statements, but does R have magic that can make it happen
> easily?  I guess this would be called concatenation.
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list