这是一个最小的工作示例。
---
date : 2018-May-26
output:
pdf_document
title: "Testing Rmarkdown"
---
```{r,comment = NA}
Gender <- gl(2,1000,labels = c("Men","Women"))
SmokerM <- sample(c("Y","N"),1000,replace = T , prob = c(.3,.7))
SmokerW <- sample(c("Y","N"),1000,replace = T , prob = c(.5,.5))
Smoker <- c(SmokerM,SmokerW)
mydata <- data.frame(Gender,Smoker)
table(mydata$Gender,mydata$Smoker)
```
This is a text in the body of the document.What font is this ? What is
font for the output of table ? How can we change these 2 fonts ? What
other categories of …Run Code Online (Sandbox Code Playgroud) 在本页面:
它说:
要生成自定义的reference.docx,首先获取默认的reference.docx的副本:
pandoc -o custom-reference.docx --print-default-data-file reference.docx
Run Code Online (Sandbox Code Playgroud)
我的问题是:当我运行上述命令时,它会将输出吐到屏幕上。
我确实意识到我可以做到:
pandoc -o custom-reference.docx --print-default-data-file reference.docx > myfile
Run Code Online (Sandbox Code Playgroud)
我的问题是:尽管使用了 -o 标志,为什么第一个代码片段会将输出抛出到屏幕上?我究竟做错了什么 ?
此外,名为 myfile 的文件中仅包含短语“Hello world”。
这就是这个文件的全部内容吗?
我正在尝试使用 R 网状包将绘图转换为静态图像。我正在使用 save_image/kaleido。
初始设置:
install.packages("reticulate")
reticulate::install_miniconda()
reticulate::conda_install('r-reticulate-test', 'python-kaleido')
reticulate::conda_install('r-reticulate-test', 'plotly', channel = 'plotly')
reticulate::use_miniconda('r-reticulate-test')
Run Code Online (Sandbox Code Playgroud)
这是我的(有缺陷的)尝试:
> library(plotly)
> p <- plot_ly(x = 1:10)
> save_image(p,"test.png")
No trace type specified:
Based on info supplied, a 'histogram' trace seems appropriate.
Read more about this trace type -> https://plotly.com/r/reference/#histogram
Error in py_run_string_impl(code, local, convert) :
NameError: name 'sys' is not defined
>
Run Code Online (Sandbox Code Playgroud)
我的查询是:如何修复名称“sys”未定义的错误?
有趣的是,如果我这样做:
> reticulate::repl_python()
Python 3.10.6 (/root/.local/share/r-miniconda/envs/r-reticulate-test/bin/python)
Reticulate 1.26.9000 REPL -- A Python interpreter in R. …Run Code Online (Sandbox Code Playgroud)