I notice that sometimes R uses approximate match when I manipulate a column.
Example
age=18:19
height=c(76.1,77)
village=data.frame(age=age,height=he
You can use [
> village["ag"]
Fehler in `[.data.frame`(village, "ag") : undefined columns selected
> village["age"]
age
1 18
2 19
The function [[
allows both approaches (argument exact
):
> village[["ag"]]
NULL
> village[["age"]]
[1] 18 19
> village[["ag", exact = FALSE]]
[1] 18 19
The phenomenon is called partial matching (see ?pmatch
):
> pmatch("ag", names(village))
[1] 1