This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merging Data Frames With Long Names

Hi,

I tried merging two data frames (One_17#20, Two_18#30) using the R merge function this way:

x <- merge(One_17#20, Two_18#30)

I got the following error:

Error in merge(One_17) : object 'One_17' not found.

I thought this might be due to the long names with underscore/# character. Does anyone know the way around this problem?

Thanks

r merge

This is not a bioinformatics question.

2 answers

That # is a comment character, the system only sees merge(One_17 and I'm surprised it didnt give the error missing ), that might have been next if there was a variable named One_17

You can't use # in variable names in many programming languages.

As karl.stamm mentioned, don't use # in variable names (in general, don't use symbols other than "_", which I'm sure is also a special character in some language I've never used). If you must, though, then

x <- merge(`One_17#20`, `Two_18#30`)

will do what you want.

Thanks for your comments!

You might have used it, the underscore x_4 was an assignment operator in R until 1.8.0 and also in S-Plus.

That predates my usage of R by at least 7 years (and I've never used S-Plus) :)

Log in to answer this question.