• Register
1 vote
2.2k 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

Please log in or register to answer this question.

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 1
5,680 points
Si se solucionó, no se me habría ocurrido, gracias

Related questions

0 votes
1 answer 1.2K views
1.2K 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
1 answer 22 views
22 views
Problem: Hi, any idea that what should I do to fix it .. How to merge two columns in r?
asked Apr 3 Ifra 37.2k points
0 votes
1 answer 29 views
29 views
Problem: Urgent problem, any help: Error: the following untracked working tree files would be overwritten by merge:
asked Mar 13 Wafa Abu Yousef 6.1k points
0 votes
1 answer 15 views
15 views
Problem: did anyone face this situation ! help : Error: the following untracked working tree files would be overwritten by merge.
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
2 answers 3.5K views
3.5K views
Problem : On the branch I had some files in the .gitignore On the different branch those files are not. I am trying to merge the different branch into my branch, and I don't bother if those files are no longer overlooked or not. Unfortunately I get below ... by merge&rdquo; How should I modify the pull command to overwrite those files, without needing to find, move or delete those files by myself?
asked Jan 6, 2020 alecxe 7.5k points
1 vote
2 answers 2.6K views
2.6K views
Problem : On the branch which I had some of my files in .gitignore On the different branch those files are not present. So I want to merge the different branch into my branch and I really do not care about those files if they are no longer ignored or not. But ... by merge How can I modify the pull command to overwrite the files, without me needing to find, move or delete the files by myself?
asked Dec 27, 2019 alecxe 7.5k points
1 vote
1 answer 1.6K views
1.6K views
Problem : Currently I am learning Pandas. I want to do inner join DataFrame1 to DataFrame2. But I am facing below error. &ldquo;Len(left_on) must equal the number of levels in the index of "right"&rdquo; Please find below my join statement for your reference. merged = DataFrame1.join(DataFrame2, on=['Code','Date']) Please let me know why am I facing above error?
asked Mar 31, 2020 morrisBson 3.2k points
0 votes
1 answer 20 views
20 views
Problem: HELP! I need help understanding this error > Git the following untracked working tree files would be overwritten by merge
asked Apr 30 ummeshani 10.8k points
0 votes
1 answer 18 views
18 views
Problem: Why I get this > Git the following untracked working tree files would be overwritten by checkout
asked Apr 28 ummeshani 10.8k points
0 votes
2 answers 199 views
199 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