- 1
-
function_nameis the name of the function we are using. - 2
- Within the parentheses of the function, there are set arguments that we assign values to.
R has many built-in functions that allow you to perform a variety of tasks
Functions usually take the form:
mean()mean() is a function that generates the calculated mean of a set of numbersxxseq() functionseq() is a function that generates a sequence of numbers.from, to, and byfrom is assigned the value of 1, which is the starting point of the sequence.
to is assigned the value of 10, which is the ending point of the sequence.
by is assigned the value of 2, which specifies the increment between numbers in the sequence.
[1] 1 3 5 7 9
seq() without the argument names
We get the same result:
<-:function_name is assigned to an object called function_output
function_outputseq() functionseq() function to an object called odds:odds will now contain the sequence (1,3,5,7,9)? or ?? to access the help file for that function:? will take you to the help file for the seq() function, which will show you the arguments and how to use it.
?? will search for any functions read_sas from your installed packages and show you a list of functions that match that search term. This is helpful when you don’t remember the package a function is in.
Tab after typing the function name and parentheses
Functions