簡體   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