Hi,

According to help(sub), the ^ should match the zero-length string at the
beginning of a string:

sub('^','var',1:3) # "1" "2" "3"
sub('$','var',1:3) # "1var" "2var" "3var"

# This generates what I expected from the first case:
sub('^.','var',11:13)  # "var1" "var2" "var3"

Dave
-- 
 Dr. David Forrest
 [EMAIL PROTECTED]                                    (804)684-7900w
 [EMAIL PROTECTED]                             (804)642-0662h
                                   http://maplepark.com/~drf5n/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to