I tried `$`(mtcars,cyl,drop=FALSE)
, but this threw an error. I know that in practice you would use [
or [[
instead, but I'm curious, can drop=FALSE
be passed to $
?
Asked
Active
Viewed 48 times
-1

J. Mini
- 1,868
- 1
- 9
- 38
-
@MrFlick Might as well post that as an answer. If it's plain and simply impossible, then so be it. I probably should've checked the `formals` of `$`... – J. Mini Mar 13 '21 at 19:03
1 Answers
2
The $
function doesn't have a drop=
parameter. While they are used for similar things, the $
function is distinct from the [
function which does have a drop=
parameter.
I'm assuming that you are only interested in the case for using $
with data.frames, but there's actually no special data.frame method for $
, it just treats the data.frame like a list. And drop=
wouldn't make as much sense in the case of a generic list.

MrFlick
- 195,160
- 17
- 277
- 295