Dear R-users,

currently I am working with the R version 2.4.1.
I realized it has a feature,  which might be wonderful (as so many things in
R), but in this case might be a bit dangerous as well. It seems that columns
of a data frame can be called just by indicating the first letter of the
name of the column.

For example:
first_item <- seq(1,10)
second_item <- seq(11,20)
dat <- data.frame(first_item, second_item)
names(dat)
# [1] "first_item"  "second_item"
dat$f
# [1]  1  2  3  4  5  6  7  8  9 10
dat$s
#  [1] 11 12 13 14 15 16 17 18 19 20

The good thing is, that if there is more than one column starting with the
same letter(s), more than one letter has to be given to call the column.
However, I would appreciate if I could choose an option in my workspace,
whether this type of shortcut is allowed or not.

Is there such an option?

Thanks for any potential hints.

Best wishes,

P. Olsson

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to