R语言 夸托文档中代码块内容的换行符

iqxoj9l9  于 10个月前  发布在  其他
关注(0)|答案(1)|浏览(137)

有没有办法在夸托的代码块中插入换行符?
当使用xelatex渲染时,内容有时会越过线并隐藏起来。
代码块:

{r, result, results='asis'}
#create dataframe with results
result <- data.frame(Model=c("Logistic Reg.: Unscaled features",
                             "Logistic Reg.: Unscaled features",
                             "Logistic Reg.: Scaled features",
                             "Logistic Reg.: Scaled features",
                             "ANN",
                             "ANN",
                             "ANN & adjusted hyperparameters",
                             "ANN & adjusted hyperparameters"),
                      Data=c("in sample","out of sample","in sample","out of                                  sample","in sample","out of sample","in sample","out                              of sample"),
                     Accuracy= c(accuracy_log_train_unscaled,accuracy_log_test_unscaled,accuracy_log_train,accuracy_log_test,accuracy_ann_in,accuracy_ann_out,accuracy_ann_in_adj, accuracy_ann_out_adj)
                     )
            
newdata <- result[order(-result$Accuracy),]
setDT(newdata)

字符串
线Accuracy只是忽略了边边距。
输出:

krcsximq

krcsximq1#

尝试块选项:tidy: styler,例如或this

---
title: "Untitled"
format: pdf
---

```{r}
result <- data.frame(Model=c("Logistic Reg.: Unscaled featuressssssssssssssssssssssssssssssssssssssss",
                             "Logistic Reg.: Unscaled features",
                             "Logistic Reg.: Scaled features",
                             "Logistic Reg.: Scaled features",
                             "ANN",
                             "ANN",
                             "ANN & adjusted hyperparameters",
                             "ANN & adjusted hyperparameters"),
                      Data=c("in sample","out of sample","in sample","out of                                  sample","in sample","out of sample","in sample","out                              of sample"))
result <- data.frame(Model=c("Logistic Reg.: Unscaled featuressssssssssssssssssssssssssssssssssssssss",
                             "Logistic Reg.: Unscaled features",
                             "Logistic Reg.: Scaled features",
                             "Logistic Reg.: Scaled features",
                             "ANN",
                             "ANN",
                             "ANN & adjusted hyperparameters",
                             "ANN & adjusted hyperparameters"),
                      Data=c("in sample","out of sample","in sample","out of                                  sample","in sample","out of sample","in sample","out                              of sample"))
字符串

**结果**:

![](https://i.stack.imgur.com/Gl8RQ.png)
的数据

相关问题