How do I export a tibble: 2,660 x 15?

I have a tibble: 2,660 x 15 created through:

semi_join(SLR, Customer_ID,by="id")

How do I name the tibble and then export it the way I need to?

Note: When I tried to 'merge' files in RStudio, they ended up all blended, but I was able to label it "M1" and then export using the below. Since it didn't merge the data properly, I am trying semi_join instead.

M1 <- merge(Customer_ID, SLR,by=c('id'),all.x=T)
write.table(M1,file="ExportedFileAPSIV.csv”, sep = ",")

Thanks in advance for the guidance.

If the semi_join() gives you what you want, then

M1 <- semi_join(SLR, Customer_ID,by="id")
write.table(M1,file="ExportedFileAPSIV.csv”, sep = ",")

should produce a comma delimited text file.
I'm unsure I have answered your question because getting the desired data with merge() or semi_join() or some other function is totally separate from exporting the data to a csv format.

Thank you - this did do the trick. I must have missed something in the command that it didn't work. The problem I'm having now is that the new .csv file merged, but, it has mixed up the column titles. Instead of "id" being the identifier, now it has been replaced by the column type immediately to the right. It looks like maybe I just need to insert a blank column to the right of the column by which I want to merge the data sets. Any other thoughts while I try that?

its tough working blind on your issue, but my guess is that when you used write.table it printed rownames 1,2,3, 4 etc as a first column. you can turn that off

write.table(M1,file="ExportedFileAPSIV.csv", sep = ",", row.names = FALSE)

note that in the above I changed the quote marks to be of the standard type " you can see by the way the syntax colour overflowed in the previously shared snippets there was a mismatch. R would probably fail badly seeing that in the code.

1 Like

I just have to say that I am so grateful for how quickly folks are jumping in to help me get this resolved. This worked! These two data sets combined are roughly 70,000 lines and with these bits and pieces you're helping me get things cleaned more quickly than I expected (it's my first time). Thank you. I've had to figure out all of these other pieces of the puzzle leading up to this so, this is great (I had no idea there were these forums like this).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.