write r file to csv — “object not found”











up vote
0
down vote

favorite












Hello I need to make my R file into a CSV file. I have searched stackoverflow for different methods to accomplish this, but nothing is working. Each time, it says:



Error in is.data.frame(x) : object 'refine_clean' not found


My file is definitely named refine_clean.R. I have linked a screenshot here:
R Studio CSV Error Message










share|improve this question






















  • The dataframe you want to write does not exist! Most likely, something upstream of write.table() and write.csv() failed. Scan the entire script's output carefully and look for error messages.
    – 12b345b6b78
    Nov 10 at 17:59












  • Thank you. There was a problem reading the original csv file but it eventually worked. That was the only error. imgur.com/a/rg1ZP9z
    – EB Gold
    Nov 10 at 18:07










  • refine_clean.R is the name of your R scrip file, not the name of the file you want to export/write. It looks like you actually want to write (I mean save) d5, right?
    – ANG
    Nov 10 at 18:15

















up vote
0
down vote

favorite












Hello I need to make my R file into a CSV file. I have searched stackoverflow for different methods to accomplish this, but nothing is working. Each time, it says:



Error in is.data.frame(x) : object 'refine_clean' not found


My file is definitely named refine_clean.R. I have linked a screenshot here:
R Studio CSV Error Message










share|improve this question






















  • The dataframe you want to write does not exist! Most likely, something upstream of write.table() and write.csv() failed. Scan the entire script's output carefully and look for error messages.
    – 12b345b6b78
    Nov 10 at 17:59












  • Thank you. There was a problem reading the original csv file but it eventually worked. That was the only error. imgur.com/a/rg1ZP9z
    – EB Gold
    Nov 10 at 18:07










  • refine_clean.R is the name of your R scrip file, not the name of the file you want to export/write. It looks like you actually want to write (I mean save) d5, right?
    – ANG
    Nov 10 at 18:15















up vote
0
down vote

favorite









up vote
0
down vote

favorite











Hello I need to make my R file into a CSV file. I have searched stackoverflow for different methods to accomplish this, but nothing is working. Each time, it says:



Error in is.data.frame(x) : object 'refine_clean' not found


My file is definitely named refine_clean.R. I have linked a screenshot here:
R Studio CSV Error Message










share|improve this question













Hello I need to make my R file into a CSV file. I have searched stackoverflow for different methods to accomplish this, but nothing is working. Each time, it says:



Error in is.data.frame(x) : object 'refine_clean' not found


My file is definitely named refine_clean.R. I have linked a screenshot here:
R Studio CSV Error Message







r export-to-csv






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 17:57









EB Gold

74




74












  • The dataframe you want to write does not exist! Most likely, something upstream of write.table() and write.csv() failed. Scan the entire script's output carefully and look for error messages.
    – 12b345b6b78
    Nov 10 at 17:59












  • Thank you. There was a problem reading the original csv file but it eventually worked. That was the only error. imgur.com/a/rg1ZP9z
    – EB Gold
    Nov 10 at 18:07










  • refine_clean.R is the name of your R scrip file, not the name of the file you want to export/write. It looks like you actually want to write (I mean save) d5, right?
    – ANG
    Nov 10 at 18:15




















  • The dataframe you want to write does not exist! Most likely, something upstream of write.table() and write.csv() failed. Scan the entire script's output carefully and look for error messages.
    – 12b345b6b78
    Nov 10 at 17:59












  • Thank you. There was a problem reading the original csv file but it eventually worked. That was the only error. imgur.com/a/rg1ZP9z
    – EB Gold
    Nov 10 at 18:07










  • refine_clean.R is the name of your R scrip file, not the name of the file you want to export/write. It looks like you actually want to write (I mean save) d5, right?
    – ANG
    Nov 10 at 18:15


















The dataframe you want to write does not exist! Most likely, something upstream of write.table() and write.csv() failed. Scan the entire script's output carefully and look for error messages.
– 12b345b6b78
Nov 10 at 17:59






The dataframe you want to write does not exist! Most likely, something upstream of write.table() and write.csv() failed. Scan the entire script's output carefully and look for error messages.
– 12b345b6b78
Nov 10 at 17:59














Thank you. There was a problem reading the original csv file but it eventually worked. That was the only error. imgur.com/a/rg1ZP9z
– EB Gold
Nov 10 at 18:07




Thank you. There was a problem reading the original csv file but it eventually worked. That was the only error. imgur.com/a/rg1ZP9z
– EB Gold
Nov 10 at 18:07












refine_clean.R is the name of your R scrip file, not the name of the file you want to export/write. It looks like you actually want to write (I mean save) d5, right?
– ANG
Nov 10 at 18:15






refine_clean.R is the name of your R scrip file, not the name of the file you want to export/write. It looks like you actually want to write (I mean save) d5, right?
– ANG
Nov 10 at 18:15














2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










Your file is named refine_clean but you have no data.frame or object named refine_clean, which is what write_table and write.csv are looking for.



based on the screen shot, it is not clear what you want to produce. If it is the last object you created (d5), you may want something like this



write.csv(d5, "refine_clean.csv")





share|improve this answer





















  • ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
    – EB Gold
    Nov 10 at 18:18










  • I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
    – EB Gold
    Nov 10 at 18:20






  • 1




    The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
    – ANG
    Nov 10 at 18:21










  • What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
    – Peter_Evan
    Nov 10 at 18:25




















up vote
0
down vote













you cant convert all your file as an csv, you need to select the object, like d5
write.csv(d5,file = "name_of_the_file")






share|improve this answer





















  • Please, could you explain how your answer is different from Peter_Evan's one?
    – ANG
    Nov 10 at 18:22











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241853%2fwrite-r-file-to-csv-object-not-found%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Your file is named refine_clean but you have no data.frame or object named refine_clean, which is what write_table and write.csv are looking for.



based on the screen shot, it is not clear what you want to produce. If it is the last object you created (d5), you may want something like this



write.csv(d5, "refine_clean.csv")





share|improve this answer





















  • ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
    – EB Gold
    Nov 10 at 18:18










  • I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
    – EB Gold
    Nov 10 at 18:20






  • 1




    The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
    – ANG
    Nov 10 at 18:21










  • What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
    – Peter_Evan
    Nov 10 at 18:25

















up vote
1
down vote



accepted










Your file is named refine_clean but you have no data.frame or object named refine_clean, which is what write_table and write.csv are looking for.



based on the screen shot, it is not clear what you want to produce. If it is the last object you created (d5), you may want something like this



write.csv(d5, "refine_clean.csv")





share|improve this answer





















  • ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
    – EB Gold
    Nov 10 at 18:18










  • I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
    – EB Gold
    Nov 10 at 18:20






  • 1




    The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
    – ANG
    Nov 10 at 18:21










  • What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
    – Peter_Evan
    Nov 10 at 18:25















up vote
1
down vote



accepted







up vote
1
down vote



accepted






Your file is named refine_clean but you have no data.frame or object named refine_clean, which is what write_table and write.csv are looking for.



based on the screen shot, it is not clear what you want to produce. If it is the last object you created (d5), you may want something like this



write.csv(d5, "refine_clean.csv")





share|improve this answer












Your file is named refine_clean but you have no data.frame or object named refine_clean, which is what write_table and write.csv are looking for.



based on the screen shot, it is not clear what you want to produce. If it is the last object you created (d5), you may want something like this



write.csv(d5, "refine_clean.csv")






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 10 at 18:13









Peter_Evan

2138




2138












  • ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
    – EB Gold
    Nov 10 at 18:18










  • I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
    – EB Gold
    Nov 10 at 18:20






  • 1




    The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
    – ANG
    Nov 10 at 18:21










  • What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
    – Peter_Evan
    Nov 10 at 18:25




















  • ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
    – EB Gold
    Nov 10 at 18:18










  • I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
    – EB Gold
    Nov 10 at 18:20






  • 1




    The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
    – ANG
    Nov 10 at 18:21










  • What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
    – Peter_Evan
    Nov 10 at 18:25


















ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
– EB Gold
Nov 10 at 18:18




ah i see what you mean. Yes, it is the last object, d5. I used your code -- thanks! -- it no longer causes an error but I also don't see a csv file created anywhere... is there another step? imgur.com/s2aKZZZ
– EB Gold
Nov 10 at 18:18












I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
– EB Gold
Nov 10 at 18:20




I also tried with this refine_clean <- write.table(d5) write.csv(refine_clean, file = "refine_clean.csv")
– EB Gold
Nov 10 at 18:20




1




1




The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
– ANG
Nov 10 at 18:21




The file is saved in your working directory by default. If you want to save it in a particular folder use write.csv(d5, "C:/Users/blablaPathToFolder/refine_clean.csv")
– ANG
Nov 10 at 18:21












What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
– Peter_Evan
Nov 10 at 18:25






What @ANG said. Additionally, you can just scan your local machine for the file, such as typing "refine_clean.csv" in your File Explorer on a windows machine.
– Peter_Evan
Nov 10 at 18:25














up vote
0
down vote













you cant convert all your file as an csv, you need to select the object, like d5
write.csv(d5,file = "name_of_the_file")






share|improve this answer





















  • Please, could you explain how your answer is different from Peter_Evan's one?
    – ANG
    Nov 10 at 18:22















up vote
0
down vote













you cant convert all your file as an csv, you need to select the object, like d5
write.csv(d5,file = "name_of_the_file")






share|improve this answer





















  • Please, could you explain how your answer is different from Peter_Evan's one?
    – ANG
    Nov 10 at 18:22













up vote
0
down vote










up vote
0
down vote









you cant convert all your file as an csv, you need to select the object, like d5
write.csv(d5,file = "name_of_the_file")






share|improve this answer












you cant convert all your file as an csv, you need to select the object, like d5
write.csv(d5,file = "name_of_the_file")







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 10 at 18:17









Luis Miguel Baqueiro

1




1












  • Please, could you explain how your answer is different from Peter_Evan's one?
    – ANG
    Nov 10 at 18:22


















  • Please, could you explain how your answer is different from Peter_Evan's one?
    – ANG
    Nov 10 at 18:22
















Please, could you explain how your answer is different from Peter_Evan's one?
– ANG
Nov 10 at 18:22




Please, could you explain how your answer is different from Peter_Evan's one?
– ANG
Nov 10 at 18:22


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241853%2fwrite-r-file-to-csv-object-not-found%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

さくらももこ

13 indicted, 8 arrested in Calif. drug cartel investigation