Get type of all variables

后端 未结 6 771
我寻月下人不归
我寻月下人不归 2020-12-12 12:37

In R, I\'d like to retrieve a list of global variables at the end of my script and iterate over them. Here is my code

#declare a few sample variables
a<-1         


        
6条回答
  •  忘掉有多难
    2020-12-12 13:25

    > mtcars %>% 
    +     summarise_all(typeof) %>% 
    +     gather
        key  value
    1   mpg double
    2   cyl double
    3  disp double
    4    hp double
    5  drat double
    6    wt double
    7  qsec double
    8    vs double
    9    am double
    10 gear double
    11 carb double
    

    I try class and typeof functions, but all fails.

提交回复
热议问题