I have a .xml file that I read with readLines() in R. I would like to know if there is some function that allow me to delete from line 15 to line 18.
I would need of a general command, because I have to repeat the function in loop on the same .xml file, but for the following lines.
readLines
creates a character vector where each element is a line from the original file. If you want to remove lines 15 through 18, just remove those elements from the vector.
my_new_file = current_file[-(15:18)]
You can then use writeLines
to replace the old file with the edited version.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.