Skip to content
Prev 199932 / 398502 Next

Comparison of vectors in a matrix

On Nov 11, 2009, at 1:02 PM, esterhazy wrote:

            
Those are all subsumed under the R "whitespace" separators that scan  
and the read.* functions use by default.
I copied and pasted into a textConnection:

 > lines <- readLines(textConnection("username	friends	friendof
+ 26376	paradisacorbasi  zannechaos  filmstarusa  jelliclecat  status   
jennilee_rose  obiwaynekenobi  shaycaron  jillthepill  26376  witchy1   
jumbach  oscarwinner  slai  jenniebennie  tirwen  estall  bront   
zarchasmpgmr  pink_kimono  reidzilla  miz_anneliese  ambelies   
jrianne  henry3730  thufer_hawat  mom2bunky  venaeli  grbenda  ikkin56	 
paradisacorbasi  filmstarusa  jelliclecat jennilee_rose shaycaron  
jillthepill 26376 witchy1 jumbach oscarwinner tirwen estall bront  
zarchasmpgmr pink_kimono reidzilla miz_anneliese ambelies jrianne  
henry3730 ahahaha_ha thufer_hawat mom2bunky venaeli grbenda  
donna_stewart gjanyn
+ aaandy	matttt monotony porcelian abrokenstarr seraphimsigrist  
ballena cbaqir _cassyandra darkspree erishkigal pinkdevildances  
lightning_geek a_life_verbatim frozen_wishes lijago tindernight  
crashing_angel sabrina_g giggly_teapot smarties_2087 theinimitable_l  
african_sunset sirenlunaris eagan_bryhtm robomonkeyninja maid_ov_metal  
aubloomiel countdownish queennola pearl007 princess_macaw wolfie_sara  
gypsy_jack may_cash morningchorus vanityflair lyingpeacefully  
squashedfrogs d_e_r_v_i_s_h the_koira lakshmichithra muffinbits  
amaya_aneko jenikaandzhaodi blood_gypsy aura_oneill icemodeled  
wannabesnorlax2	matttt frida monotony porcelian abrokenstarr  
seraphimsigrist ballena cbaqir _cassyandra shepardshadows darkspree  
erishkigal pinkdevildances lightning_geek a_life_verbatim  
frozen_wishes lijago tindernight crashing_angel sabrina_g  
giggly_teapot laudanum_tea smarties_2087 theinimitable_l  
african_sunset sirenlunaris eagan_bryhtm robomonkeyninja aaskie  
maid_ov_metal aubloomiel countdownish queennola pearl007  
princess_macaw wolfie_sara gypsy_jack may_cash morningchorus  
vanityflair lyingpeacefully squashedfrogs d_e_r_v_i_s_h the_koira  
lakshmichithra muffinbits amaya_aneko jenikaandzhaodi blood_gypsy  
aura_oneill icemodeled sixtycents wannabesnorlax2"))

#realLines will bring in everything up to an EOL.

# and then used scan() on the individual lines:

 > col1 <- scan(textConnection(lines[1]), what="character")
Read 3 items
 > col1
[1] "username" "friends"  "friendof"

 > col2 <- scan(textConnection(lines[2]), what="character")
Read 58 items


 > col3 <- scan(textConnection(lines[3]), what="character")
Read 102 items

I have not figured out what you and Tony are doing with these  
collections of character vectors, but this should help with you doing  
the basic data entry.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT