argument

argument

Arguments are the elements of an R function (e.g., in the function ```factor()```, you enter in the variable name, the levels, and the labels -- these things that go in the parentheses are the arguments).


    • Related Articles

    • var()

      The var() function computes the variance of a variable. Example: # Calculate the variance of Thumb var(Fingers$Thumb) # Alt: use 'data =' argument instead of '$' (produces same output) var(~Thumb, data = Fingers) Example output:
    • sd()

      The sd() function computes the standard deviation of a variable. Example: # Calculate the standard deviation of Thumb sd(Fingers$Thumb) # Alt: use 'data =' argument instead of '$' (produces same output) sd(~Thumb, data = Fingers) Example output:
    • mean()

      The mean() function computes the mean of a variable. Example: # Calculate the mean of Thumb mean(Fingers$Thumb) # Alt: use 'data =' argument instead of '$' (produces same output) mean(~Thumb, data = Fingers) Example output:
    • arrange()

      The arrange() function will arrange a data frame by a specific variable, in ascending order. You can use the desc() argument with the arrange() function to arrange the data frame in descending order. NOTE: The arrange() function is similar to the ...
    • sort()

      The sort() function will sort a vector (or a single column in a data frame) by a specific variable, in ascending order. You can use the decreasing = TRUE argument with the sort() function to sort the data frame in descending order (be careful not to ...