• Register
1 vote
887 views

Problem :

I am very new to R programming. Currently I am learning R programming.

I have below two tables I have asembled them via cbind().

My first Table table_alpha is as below:

  x1                 col1_x1       col2_x1      
A "1999 12 01 00:00" "        0.4" "          0"
B "1999 12 02 00:00" "       -0.5" "          0"
C "1999 12 03 00:00" "       -0.2" "          0"
D "1999 12 04 00:00" "         -1" "        0.1"
E "1999 12 05 00:00" "       -0.9" "          0"
F "1999 12 06 00:00" "        3.7" "        4.1"

My second Table table_num is as below

     x2                 col1_x2       col2_x2      
[1,] "1999 12 01 00:00" "        0.4" "          0"
[2,] "1999 12 03 00:00" "       -0.2" "          0"
[3,] "1999 12 04 00:00" "         -1" "        0.1"
[4,] "1999 12 05 00:00" "       -0.9" "          0"
[5,] "1999 12 06 00:00" "        3.7" "        4.1"
[6,] "1999 12 07 00:00" "          7" "        5.8"

Please find below my merge command:

exporttab <- merge(x=table_alpha,y= table_num,by.x= table_alpha[,1],by.y= table_num[,1], fill=-9999)

Please find below the error:

“Error in fix.by(by.x, x) : 'by' must specify uniquely valid columns”.
8 5 2
3,230 points

1 Answer

1 vote

Solution :

I had also faced the same error with my below code:
m1 <- merge(x=itcompanies, y=itrounds2, by.x=itcompanies$permalink, by.y=itrounds2$company_permalink, all.y=TRUE)
The same error as below:
# Error in fix.by(by.x, x) : 'by' must specify uniquely valid columns
But now I have the solution which really worked for me is the right outer join
m1 <- merge(x=itcompanies, y=itrounds2, by.x=c("permalink"), by.y=c("company_permalink"), all.y=TRUE)

Hope it will work for you too.

8 4
5,680 points
Si se solucionó, no se me habría ocurrido, gracias

Related questions

0 votes
1 answer 452 views
452 views
Problem : I am trying to merge data in R but facing following error error in fix.by(by.x, x) : 'by' must specify one or more columns as numbers, names or logical
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
2 answers 117 views
117 views
Problem : I am stuck because of following weired error error in sort.list(y) : 'x' must be atomic for 'sort.list' have you called 'sort' on a list?
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
2 answers 239 views
239 views
Problem : I am trying to do data manipulation using R. I am trying to import the file which is having headings and also numbers in the multiple columns. I am trying to divide my values in the one column by the other column and then trying to determine the highest values. But ... below error &ldquo;Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : 'x' must be atomic&rdquo;.
asked Feb 17 mphil 2.3k points