Write R data to a LaTeX file as individual lines. Similar functions, such as latex in Hmisc, write data to a LaTeX table, but there may be instances where you don't want data in a table, hence this function. Columns will printed in the order specified. The function adds a newline between each item printed.

write_latex(df, file_name, ..., append = FALSE)

write_latex_lines(df, file_name, ..., append = FALSE)



The dataframe, data.table, tibble, etc, containing the data to write to LaTeX.


File name of the tex file to write to. Overwrites any existing files with the same name. If file_name does not end with ".tex" it will be appended to the file name.


One or more unquoted, comma separated, variable names to write to LaTeX. If blank, all variables will be written to LaTeX.


If TRUE, appends data to existing file of the same name. If FALSE, overwrites any existing file of the same name.


This function does not add any LaTeX syntax or markup to the data being printed. To add markup prior to printing, use the latex_markup function.


#write_latex(iris, file_name = "iris.tex", Species, Petal.Width)

# }