I am not sure if this is new to R.
Year <- c(2001:2010)
salary <- c(rep(21000,10))
X <- data.frame(Year, salary)
X$Year
X$Y
X$s
if you see there are no columns named Y or s in this data frame. But R is returning columns based on the first letter of the column name.
This has turned out to be a problem for me in my scripts.
[[
as it isx[[i, exact = TRUE]]
– akrun Jan 22 at 10:42data.table
and use[
you can avoid that problem:X <- as.data.table(X) X[Year, ]
– JonnyCrunch Jan 22 at 10:55