Very confusing R feature - completion of list item names

后端 未结 2 1963
挽巷
挽巷 2021-01-15 04:03

I found a very suprising and unpleasant feature of R - it completes list item names!!! See the following code:

a <- list(cov_spring = \"spring\")
a$cov &l         


        
2条回答
  •  灰色年华
    2021-01-15 04:57

    You can use [ or [[ instead.

    a["cov"] will return a list with a NULL element. a[["cov"]] will return the NULL element directly.

提交回复
热议问题