[英]Manage objects in the global environment in R
您可以在RStudio的“環境”選項卡中使用類似以下內容來近似信息:
data(iris)
data(mtcars)
x <- 1:3
y <- "yes"
ls_vec <- ls()
ls_list <- vector('list', length(ls_vec))
for (i in seq_along(ls_vec)) {
ls_list[[i]] <-
data.frame(
Name = deparse(ls_vec[i]),
Type = class(get(ls_vec[i])),
Length = length(get(ls_vec[i])),
Size = format(object.size(get(ls_vec[i])))
)
}
Reduce(rbind, ls_list)
# Name Type Length Size
# 1 "i" integer 1 56 bytes
# 2 "iris" data.frame 5 7256 bytes
# 3 "ls_list" list 7 5064 bytes
# 4 "ls_vec" character 7 504 bytes
# 5 "mtcars" data.frame 11 7208 bytes
# 6 "x" integer 3 64 bytes
# 7 "y" character 1 112 bytes
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.