Related Articles
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 ...
object (in R)
R objects are ways of saving information in R. R objects can be individual values (e.g., MyNumber <- 3) or a vector (e.g., MyVector <- c(1:10)) or even a data frame (e.g., MyCopyOfFingers <- Fingers).
sum()
The sum() function computes the sum of a series of values. Example 1: # Sum by indicating a series of values sum(1, 2, 100) Example output: Example 2: # Sum by using a saved vector expenses <- c(33, 74, 12, 248, 520) sum(expenses) Example output: ...
tail()
The tail() function is used to get the last rows of a vector or data frame. By default, it will print out the last 6 rows of the object, but you can also specify the number of rows you would like to print out. The tail() function is similar to the ...
head()
The head() function is used to get the first rows of a vector or data frame. By default, it will print out the first 6 rows of the object, but you can also specify the number of rows you would like to print out. The head() function is similar to ...