高中统计老师在这里,很抱歉这个简单的问题(或许不那么简单).
我正在运行R来创建一个茎叶图.我正在尝试将stem()的茎叶输出转换为LaTeX.这是我到目前为止所得到的:
y<- c(50, 26, 31, 57, 19, 24, 22, 23, 38, 13, 50, 13, 34, 23, 30, 49, 13, 15, 51)
stem(y)
Run Code Online (Sandbox Code Playgroud)
我试图使用xtables(因为它适用于我的简单双向表),因此:
print(xtable(stem(y)), type="latex", latex.environments=c("center"), tabular.environment = "tabular", NA.string = "")
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Error in UseMethod("xtable") : no applicable method for 'xtable' applied to an object of class "NULL"
Run Code Online (Sandbox Code Playgroud)
我尝试了各种选项,但得到了类似的结果.根据我的想法,stem()的输出不是数据框或矩阵,因此xtables不喜欢它.我尝试使用as.data.frame()和as.matrix()将其更改为数据框/矩阵,但没有成功.任何帮助,将不胜感激.我运行了一些谷歌搜索没有有用的结果,并查看了stackoverflow网站.任何帮助,将不胜感激.