I am writing an R script and want to define a variable to be used in plot annotations as part of the file name. I thought I would use the strsplit() function. Here is my code and the output:
infile = "ACC_1346.table.txt"
x = strsplit(infile, ".")
class(infile)
[1] "character"
class(x)
[1] "list"
str(x)
List of 1
$ : chr [1:18] "" "" "" "" ...
x[[1]]
[1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
I expected the final output to be:
[1] "ACC_1346" "table" "txt"
What is going on here?