Sunday, April 7, 2013

R - abbreviate strings automatically


  • abbreviate strings automatically
  • option minlength sets the number of characters
  • abbreviate in a way that they remain unique
data(armd.wide,package="nlmeU")
names(armd.wide)
 [1] "subject"  "lesion"   "line0"    "visual0"  "visual4"  "visual12"
 [7] "visual24" "visual52" "treat.f"  "miss.pat"
abbreviate(names(armd.wide))
 subject   lesion    line0  visual0  visual4 visual12 visual24 visual52 
  "sbjc"   "lesn"   "lin0"   "vsl0"   "vsl4"   "vs12"   "vs24"   "vs52" 
 treat.f miss.pat 
  "trt."   "mss."

No comments :

Post a Comment