How to find help for a function
Run ?function_name
OR
Run help(function_name)
Note the absence of parenthesis ()
after function_name
above.
So running:
?beep
Gives the following in the help panel:
It has two arguments, sound
and expr
, both of which have default values, so they do not need to be provided by us.
But if we wanted to tell beep()
to play a different sound, we would have to provide a value for the sound
argument from one of the many possible sounds as seen in the help file.
The Examples in help files can be very useful for trying out functions and understanding how they work.
Now try:
beep(10)
beepr::beep("facebook")
beep("fanfare")
# or any of the other sounds from the help file
Do you have to read the entire help file? No
As you begin to learn R, skim through help files and pay attention to the description, arguments (if you don’t know what to use), and most importantly, the examples.