Hi,
This is a question about R.
I try to assign a vector to a data.frame with name 'in' and got error:
Error: unexpected 'in' in "refseq$in"
I just want to know why I get this error? Thank you.
refseq <- data.frame(a=letters[1:3]) refseq$in <- 1:3
Hi,
This is a question about R.
I try to assign a vector to a data.frame with name 'in' and got error:
Error: unexpected 'in' in "refseq$in"
I just want to know why I get this error? Thank you.
refseq <- data.frame(a=letters[1:3]) refseq$in <- 1:3
"in" is a reserved word in R. It is used in the syntax for loops. You should choose a different name for that column. If you really really have to use "in" as the column name for some reason, you can do so using backticks:
refseq$`in` <- 1:3
but I don't recommend this, since you will be stuck using backticks any time you want to refer to that column by its name.
In the future, if you have a generic R question that doesn't have to do with Bioconductor, you should ask it on Stack Overflow. You're likely to get a good answer much more quickly over there.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
I got it. The explanation is at https://stat.ethz.ch/R-manual/R-devel/library/base/html/Reserved.html.