Using column/field names with parentheses in R

r

Solution

`read.csv()` will convert the special characters to '.' so the column 'P(A|B)' will be `whatever$P.A.B.`.

However, as @Floo0 pointed out, if you can have column names like 'P(A|B)' which are accessed by `whatever$"P(A|B)"` or `whatever[, "P(A|B)"]`.

Problem

I am using R version 3.0.2 on Windows 7. I load a CSV table into R and some of the column names have parentheses such as P(A) or P(A|B). If I try ``` whatever<- read.csv("C:/dir/name.csv", header=TRUE); hist(whatever$P(A|B)); ``` I get the error message ``` Error: unexpected symbol in "hist(whatever$P(A|B" ``` Is it possible, in R, to use column names with parentheses or must I change the column names to alphanumeric?

Original source