Error in Read::Write

Hi community - i've been struggling with this all morning - why do i keep getting this error - i'm simply trying to write a CSV file to my outfolder location

Error in readr::write_csv(meanUnits, file = paste0(outfolder, "/meansLOD_sub.csv")) :
unused argument (file = paste0(outfolder, "/meansLOD_sub.csv"))

Here is my code :frowning:

readr::write_csv(meanUnits, file = paste0(outfolder, "/meansLOD_sub.csv"))

Hello,

I had a look at this. The problem would seem to be that file as an argument doesn't actually exist and you want to have path.

The second point and this might be slightly more involved. The way in which you specified the output might not work as I am not sure exactly what sort of object outfolder is. If it is an actual folder in your system and you are working within an R project I would recommend doing the following:

library(here)
readr::write_csv(meanUnits, path = here::here("outfolder","meansLOD_sub.csv"))

This will take your working directory and see if outfolder is there then build the path to save your .csv at the right location. The here package was designed to solve a lot of the pathing problems.

See here as well for more detail: https://github.com/jennybc/here_here

1 Like

This topic was automatically closed 21 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.