Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206278

Is it possible to take information from the title of a file?

$
0
0

I have this big script with some plot titles that I would just change like the date and time depending on the data I'm working with read.csv. I am already using paste("title",variable,"title") on the title so I just need to change the variable on the beggining of the script, but I've been thinking if there is a way to use the title of the csv file to define these variables while reading.

What I mean, if I'm not very clear, is something like:

I have this data from January 15 2020 saved as "data20200115.txt" Instead of changing the variable "date" that I defined to write every plot title of the script with

main=paste("Date:",date)

I want to take the "20200115" from the title of the .txt and put it in the variable "date". Is this possible?

Thank you for reading.


Viewing all articles
Browse latest Browse all 206278

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>