Does R automatically remove '.' from data.frame column names? -
does d1$patient....age = d1$patient....age ?
i'm guessing these simple concept causes behaviour. reliable behaviour predictable? ie: if name data.frame column a...b can references $a ?
the example provided in source doesn't explain i'm seeing in r.
from http://biostat.mc.vanderbilt.edu/wiki/pub/main/svetlanaedenrfiles/regexprtalk.pdf
d1 = data.frame(id...of....patient = c(1, 2), patient....age = c(3, 4)) d1$patient....age #[1] 3 4 d1$patient #[1] 3 4 d1$age #null d1$id...of....patient #[1] 1 2 d1$id #[1] 1 2 d1$id...of #[1] 1 2 names(id) #null names(d1) #[1] "id...of....patient" "patient....age"
r's $
operator accepts unambiguous prefix of column name referring column. has nothing .
s.
for example, try:
d1$id...of....patient # [1] 1 2 d1$id...of....pati # [1] 1 2 d1$id...o # [1] 1 2
this true whether or not there dots in column name: mtcars$disp
, mtcars$dis
, , mtcars$di
return disp
column of mtcars
dataset. (however, mtcars$d
returns null
, both disp
, drat
columns start d
).
Comments
Post a Comment