r - Adding " \\ \hline " after every component of a vector -


consider following:

v <- letters[1:4] v [1] "a" "b" "c" "d" 

i following output using v:

"a \\ \hline b \\ \hline c \\ \hline d \\ \hline" 

or version quotation marks removed. closest i've gotten

paste0(v, collapse = " \\ \\hline ") [1] "a \\ \\hline b \\ \\hline c \\ \\hline d" 

and ctrl + f find , replace in rstudio using \\hline -> \hline, simple enough, see if there's way create string without step.

this problem comes when want create tabular environment using character vector in .rnw file using latex code.

if printing, can use cat

cat(v, sep = " \\\\ \\hline ") 

Comments

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

java - Vaadin 7 Pass Data Between Views -