Hello,

You can offer your help to develop a built-in function designed to
internally check the use of reserved words.

Or, citing the help page:
"Reserved words outside quotes are always parsed to be references to the
objects linked to in the ‘Description’, and hence they are not allowed as
syntactic names (see make.names). They are allowed as non-syntactic names,
e.g. inside backtick quotes."

You should prefer the use of "[" rather than "$".

Regards,
Pascal



2013/7/11 jpm miao <miao...@gmail.com>

> Just wonder why R does not remind me so when I use it as a dimname...
>
>
> 2013/7/11 Pascal Oettli <kri...@ymail.com>
>
>> Hello,
>>
>> "in" is a reserved word.
>>
>> ?Reserved
>>
>> Hope this clarifies,
>> Pascal
>>
>>
>>
>> 2013/7/11 jpm miao <miao...@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]]

______________________________________________
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