问题
I was trying to write a file using R and in order to distinguish each file, i tried to add a different suffix each time in a function.
For example......
counts <- function(counts_file)
{
..............................
..............................
name <- substr(counts_file,1,5)
file <- paste(name,".cpm.csv")
write.csv(countpermillion, file)
}
But when i run the function counts("JKNC1.bam.tsv")
, the output file created is like thisJKNE3 .cpm.csv
i.e there is a gap between the JKNEE3 and .cpm.csv
. What am i doing wrong here?
Thanks Upendra
回答1:
The default separator is a space. paste(name,".cpm.csv",sep="")
should do what you want here. Alternately, you could use
paste0(name,".cpm.csv")
The documentation for this can be found by typing ?paste
at the console.
来源:https://stackoverflow.com/questions/19171366/why-there-is-a-gap-in-the-file-name-created-using-paste