The script below throws an error (see below) if knitted (both normal and notebook files) but only if the file is synced in OneDrive. If I put the file in the desktop, no error is given.
My default RStudio encoding is UTF-8.
My locale is > >"LC_COLLATE=Italian_Italy.1252;LC_CTYPE=Italian_Italy.1252;LC_MONETARY=Italian_Italy.1252;L>C_NUMERIC=C;LC_TIME=Italian_Italy.1252"
library(arsenal)
mycontrols <- tableby.control(test=TRUE, total=F,
numeric.test="kwt", cat.test="fe",
numeric.stats=c("N","range", "medianq1q3",
"meansd", "Nmiss"),
cat.stats=c("countpct"),
stats.labels=list(N='Count', median='Median', q1q3='Q1,Q3',mean='Mean', meansd="Mean (SD)"),
digits=1)
tab.test <- tableby( carb ~ .,
data= mtcars,
control=mycontrols)
summary(tab.test, text = T)
Traceback:
BlockquoteError in gsub(""", "\"", string, fixed = TRUE) : input string 2 is invalid UTF-8
13.gsub(""", "\"", string, fixed = TRUE)
12.paste0(""", gsub(""", "\"", string, fixed = TRUE), """)
11.shQuote(args[shell_chars])
10.quoted(args)
9.paste(quoted(args), collapse = " ")
8.paste(quoted(pandoc()), paste(quoted(args), collapse = " "))
7.rmarkdown::pandoc_convert(input = rmarkdown::pandoc_path_arg(mdfile), to = "html", output = >rmarkdown::pandoc_path_arg(htmlfile))
6.print.knit_asis(knitr::asis_output(x))
5.print(knitr::asis_output(x))
4.print.knitr_kable(knitr::kable(df[[i]], caption = NULL, align = attr(df[[i]], "align"), format = format, >row.names = FALSE, escape = escape, ...))
3.print(knitr::kable(df[[i]], caption = NULL, align = attr(df[[i]], "align"), format = format, row.names = >FALSE, escape = escape, ...))
2.print.summary.arsenal_table(x)
1.(function (x, ...) UseMethod("print"))(x)