I want to present R data.frame output as LaTeX table. Data structure is data.frame. Doing print(DF.tex), the output looks fine in STOUT, in contrast to the the file. Expected output: UTF-8 format    Code 1DF <- head(iris)library(xtable) # https://stackoverflow.com/a/9274146/54964filename.tex <- paste(/home/masi/text.tex)DF.tex <- xtable(DF)save(DF.tex, file = filename.tex)Output in the path location: some hexadecimal cryptic    Code 2f <- file(filename.tex, 'w') # https://stackoverflow.com/a/19837122/54964cat(file = f, DF.tex, append = TRUE)Output: 0 byte file   Code 3I am using many functions in my script, so just in case, using print()save(file = filename.tex, print(DF.tex))Output: cryptic hexadecimal file    R: 3.4.0 (backports)OS: Debian 8.7Related: Test 2 extented in the theard How to save R stargazer(data.frame) output in .tex document? with the stargazer package
How to save R xtable(data.frame) output in .tex document?
debian;latex;r
Trying out the example code 1, the file produced, 'filename.tex' is actually a gzip file of the R object containing the tex data - to save the text output of the object, non-compressed, use:print(DF.tex, file = /home/masi/filename.tex, compress = FALSE)For me, testing using latex2html filename.tex gives a nicely formatted table.