繁体   English   中英

如何读取R中生成的数据框中的指定列?

[英]How can I read the specified column in the generated data frame in R?

这是我的代码:

x<-c(1300,541,441,35,278,167,276,159,126,60.8,160,5000,718,9740,135,3480,264.6,379,170,251.3,155.84,187.01,850)
y<-log10(x)
# load fitdistrplus package for using fitdist function
library(fitdistrplus)
# fit logistic distribution using MLE method
x.logis <- fitdist(y, "logis", method="mle")
b1 <- bootdist(x.logis, bootmethod="param", niter=20)
b1# Here are 20 b1.

如何读取b1中的参数值(位置)? 非常感谢你 !

使用str函数检查数据的结构。 实际上, b1是一个列表 ,此列表的第一个对象包含常规数据帧。

# extract the data frame for the first object of the list
data <- b1$estim
data$location
data$scale
# Also you can use the double bracket operator
b1[[1]][, "location"]

在代码的最后部分,您会注意到,双方括号用于子集列表对象,而普通方括号用于子集对象元素。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM