stat(r.matrix)[[2]] # out-of-sample summary statistics sum.stat(r.matrix)[[3]] # entire sample summary statistics adjustdata <- function(data) { data<-cbind(rownames(data),data) } a<-adjustdata(sum.stat(r.matrix)[[3]]) write.table(a,"TABLE1.csv",row.names=F,col.names=T,...
table1_add_stats_plot 但是table1包没有给定函数用于导出html文件,除非手动在Rstudio中导出,或者使用htmltools包的save_html函数来导出;但是导出的html格式的表格会缺失一些样式,比较尴尬。。。 因此我后来试了下arsenal包,该包功能非常齐全(开发者真给力!),上述文章作者也给出了Powerfull评价,从修改表格形式以及导出...
margin.table()、prop.table()和addmargins()函数可以自然地推广到高于二维的情况。另外,ftable()函数可以以一种紧凑而吸引人的方式输出多维列联表。 # 三维列联表 mytable <- xtabs(~Treatment+Sex+Improved,data=Arthritis) mytable ftable(mytable) # 边际频数 margin.table(mytable,1) margin.table(mytabl...
```{r tab2, echo=FALSE} # 载入程辑包 library(kableExtra) ## table for descriptive statistics kable( tab_01, col.names = c("Mean", "SD", "Median", "Minimum", "Maximum"), digits = 2, caption = "\\label{tab2}Summary Statistics", booktabs = T ) ``` 👇以下是图文教程📑本文...
min(wt) max(wt) #排序,默认由小到大 wtinc <- sort(wt) wtinc[1:10] #设置“decreasing = T”,变成从大到小排列 wtdec <- sort(wt,decreasing = T) wtdec[1:10] summary(wt) table(vs) 多元数据#2是按列,1是按行 apply(mtcars,MARGIN = 2,mean) apply(mtcars,MARGIN = 2,var) #协...
Customizing a Summary Statistics Table in R We can also customize the table a bit by changing labels, adding some more summary statistics, and customizing some other things. In the example below,we are adding some more summary statistics, renaming the variables, making the labels bold...
stat.desc{pastecs}:Descriptive statistics on a data frame or time series。Compute a table giving various descriptive statistics about the series in a data frame or in a single/multiple time series Useage:stat.desc(x, basic=TRUE, desc=TRUE, norm=FALSE, p=0.95) x:a data frame or a time ...
Summary Statistics by Group A simple way of generating summary statistics by grouping variable is available in thepsych package. library(psych) describe.by(mydata, group,...) The doBy package provides much of the functionality of SAS PROC SUMMARY. It defines the desired table using a model for...
利用table()生成二维列联表: >table(mtcars$cyl,mtcars$am) 0 1 4 3 8 6 4 3 8 12 2 利用xtabs()生成列联表: > xtabs(~cyl,data=mtcars) cyl4 6 8 11 7 14 > xtabs(~cyl+am,data=mtcars) am cyl 01 4 3 8 6 4 3 8 12 2 ...
get_summary_stats(): Compute summary statistics for one or multiple numeric variables. Can handle grouped data. freq_table(): Compute frequency table of categorical variables. get_mode(): Compute the mode of a vector, that is the most frequent values. ...