Displaying 1 result from an estimated 1 matches for "tomcru".
Did you mean:
tomcat
2013 Mar 13
2
Extract letters from a column
Dear list:
I would like to extract three letters from first and second elements
in one column and make a new column.
For example below,
> tempdf = read.table("clipboard", header=T, sep='\t')
> tempdf
name var1 var2 abb
1 Tom Cruiser 1 6 TomCru
2 Bread Pett 2 5 BrePet
3 Arnold Schwiezer 3 7 ArnSch
> (p1 = substr(tempdf$name, 1, 3))
[1] "Tom" "Bre" "Arn"
I was able to extract three letters from first name, however, I don't
know how to extract three letters from last name (i.e., 'C...