I have a filename Im using to do stuff with; it is a variable representing the path Im interested in. At the end of the script I would like to do some sed cleanup on it but I dont know how to pass the variable to it. Here's what I have:
filename = file.choose()
mydata = read.xls(file.choose())
newdata <- subset(mydata[1:3])
system("sed -i '' 's/\"//g'" filename)
but I get the error as follows-
Error: unexpected symbol in "system("sed -i '' 's/\"//g'" filename"
Im sure its do do with some kind of "" lunacy but can't figure it out
Try using paste:
system(paste("sed -i '' 's/\"//g'",filename))
Also, you might want to use
paste0 instead of
paste (or add the
sep="" argument) when you add the extension to
filename, right now it adds a space between the filename and extension.