Reputation: 5819
df <- mtcars
View(df)
The code above results in the image below (what I expect) and also prints df <- mtcars
and View(df)
to my console.
If I then highlight df
in my console and press F2 I get the image below. And nothing is output to my console.
F2 is supposed to be equivalent to View()
and it usually is. Right now I can highlight mtcars
, press F2, and I get the spreadsheet view. df
is showing as a data.frame in my global environment, yet F2 thinks it is a function.
Why won't F2 work when I highlight this particular df
that I just defined as df <- mtcars
?
Upvotes: 1
Views: 144
Reputation: 5201
There is also a built-in function called df
from the stats
package. Pressing f2
is primarily for showing the source code of a function, and will only do the equivalent of View
if the variable is not a function.
If you really use this a lot you may need to use a different name for your variables.
Upvotes: 3