r - how to delete the end of "}" and append three rows contents -
a.txt contents:
{\aaa {\bbb\ccc} {\aaa \bbb \ccc } }
i can load text in r using readlines (or scan). want know how delete end of "}" , append 3 rows contents:
\ddd \eee \fff
then save new file. thank you.
i'm assuming want add new lines main block. if that's case,
lines<-scan(what=character(), text="{\\aaa {\\bbb\\ccc} {\\aaa \\bbb \\ccc } } ") morelines<-append(lines, c("\\ddd","\\eee","\\fff"), after=length(lines)-1) writelines(morelines, "out.txt")
should work.
Comments
Post a Comment