[R] Create an identifier variable

R. Michael Weylandt michael.weylandt at gmail.com
Tue Nov 29 23:52:03 CET 2011


Forgot the blog....

http://sas-and-r.blogspot.com/

M

On Tue, Nov 29, 2011 at 5:51 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
> Also, this blog has implementations of many common subroutines in both
> SAS and R so you can learn "translations" between the two.
>
> Hope it helps,
>
> Michael
>
> On Tue, Nov 29, 2011 at 5:35 PM, R. Michael Weylandt
> <michael.weylandt at gmail.com> wrote:
>> Try something like this:
>>
>> Suppose your data object is called df:
>>
>> cbind(paste("sd", 1:NROW(df), sep = ""), df)
>>
>> If you are just moving from SAS check out the website (and books
>> associated with) http://r4stats.com -- it's got some tutorials on
>> moving from other platforms to R.
>>
>> Michael
>>
>> On Tue, Nov 29, 2011 at 2:48 PM, hyunjeehale <hyunjee.hale at gmail.com> wrote:
>>> I am needing to create a new identifier variable for a data set which has no
>>> ID variable in the original file. I am basically wanting to take the count
>>> of each row and add "sd" in front of it - so it would look like so
>>>
>>> sd1
>>> sd2
>>> sd3
>>> sd4
>>> sd5 etc.......
>>>
>>> I have no idea how to do this. I am a SAS user trying to learn R. This
>>> question may have been answered previously, but I could be searching for it
>>> incorrectly. Thank you for any assistance you can provide.
>>>
>>> HyunJee
>>>
>>> --
>>> View this message in context: http://r.789695.n4.nabble.com/Create-an-identifier-variable-tp4120548p4120548.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