[R] How to Turn OFF Vectors Recycling Rule in Paste()

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Aug 27 07:09:37 CEST 2015


No can do. You need to modify the input vectors so you get what you want.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On August 26, 2015 3:43:11 PM PDT, Preeti ranjan Pradhan <preetiranjan.2008 at gmail.com> wrote:
>Hello Team,
>
>Platform:Windows 7 32-bit
>R Version:3.2.2
>
>I have two vectors as follows
>
>> S = c("aa", "bb", "cc", "dd", "ee")
>> X= c("aa", "bb", "cc", "dd")
>
>When I trying a paste function
>
>> z=paste(S,X)
>> z
>
>I am getting result as
>
>[1] "aa aa" "bb bb" "cc cc" "dd dd" "ee aa"
>
>I don't need the last element of S vector should get concatenated with
>first element of X vector rather than it should take a space or null
>value
>for concatenation. If I specify explicit space value in X vector like
>
>> X= c("aa", "bb", "cc", "dd", " ")
>
>Then I am getting result as
>> z=paste(S,X)
>> z
>[1] "aa aa" "bb bb" "cc cc" "dd dd" "ee  "
>
>Could you please suggest me how to turn off the Vector recycle in paste
>function?
>
>Thanks and Regards
>Preetiranjan Pradhan
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.



More information about the R-help mailing list