Can I access R data objects' attributes without fully loading objects from file?

前端 未结 2 1397
小蘑菇
小蘑菇 2020-12-22 02:52

Here\'s the situation. My R code is supposed to check whether existing RData files in application\'s cache are up-to-date. I do th

2条回答
  •  粉色の甜心
    2020-12-22 03:34

    You can't "really" do it, but you could modify the code in my cgwtools::lsdata function.

    function (fnam = ".Rdata") 
    {
        x <- load(fnam, envir = environment())
        return(x)
    }
    

    This loads, thus taking time and briefly taking memory, and then the local environment disappears. So, add an argument for the items you want to check attributes for, add a line inside the function which does attributes(your_items) ->y ; return (list(x=x,y=y))

提交回复
热议问题