2

I am writing a script in R to perform automated analysis of some files we receive as output from a lab instrument.

The final output of my script is a wide .csv file with multiple headers, and to better suit the end user, the headers are properly formatted as they would expect.

For example, one of the parameter is the following: 'dm/ds_max'.

Everything works fine when this parameter is written as variable in the table header or when I have to use this parameter as variable in ggplot (for example to automatically generate a plot title with dm/ds_max), but becomes problematic when I am trying to use the name of the variable in the paste() command to save the graph.

As you can imagine, the / in the paste() is interpreted as directory delimiter and the files are then saved in the wrong folder.

For example, when the variable name is colour, the plot are properly saved in the proper folder as img/colour.jpg. When the variable name is dm/ds_max, the file is saved as img/dm/ds_max.jpg, putting it in a non-existing folder.

Is there a way -beside changing the name of the variable- to bypass this conflict between writing tables in a nice human readable format and making automated plots with the same variable?

Thank you

Mollan
  • 135
  • 1
  • 8
  • I think your question transcends R and depends on the underlying filesystem: https://stackoverflow.com/questions/9847288/is-it-possible-to-use-in-a-filename – Ramiro Magno Apr 16 '20 at 17:13

0 Answers0