Hi, I have a matrix whose columns are named as "in" and "out". Then I coerce it to be a data.frame. However the system seems to forbid me from using the name "in", but I am not aware of it until I call it by the dollar sign $. Is there something R should remind me but it does not? Is there any remedy to work on it?> head(dat1$in)Error: unexpected 'in' in "head(dat1$in"> View(dat1) > head(dat1["in"])in 1 3.28 2 9.6 3 7.24 4 4.45 5 2.33 6 2.83> head(dat1["out"])out 1 0 2 0 3 0.04 4 0.03 5 0.04 6 0.01> head(dat1$out)[1] 0 0 0.04 0.03 0.04 0.01 [[alternative HTML version deleted]]
Pascal Oettli
2013-Jul-11 03:03 UTC
[R] Reserve word "in" could not be used it as a "dimname"?
Hello, "in" is a reserved word. ?Reserved Hope this clarifies, Pascal 2013/7/11 jpm miao <miaojpm@gmail.com>> Hi, > > I have a matrix whose columns are named as "in" and "out". Then I coerce > it to be a data.frame. However the system seems to forbid me from using the > name "in", but I am not aware of it until I call it by the dollar sign $. > Is there something R should remind me but it does not? > Is there any remedy to work on it? > > > head(dat1$in) > Error: unexpected 'in' in "head(dat1$in" > > View(dat1) > > head(dat1["in"]) > in > 1 3.28 > 2 9.6 > 3 7.24 > 4 4.45 > 5 2.33 > 6 2.83 > > head(dat1["out"]) > out > 1 0 > 2 0 > 3 0.04 > 4 0.03 > 5 0.04 > 6 0.01 > > head(dat1$out) > [1] 0 0 0.04 0.03 0.04 0.01 > > [[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. >[[alternative HTML version deleted]]