4/29/2023 0 Comments R aggregate rename x![]() In this section we are going to use a time series object of class xts as an example, although you could use a data frame instead to apply the function. Using aggregate in R is very simple and it is worth to mention that you can apply any function you want, even a custom function. In the following sections we will show examples and use cases about aggregating data, like aggregating the mean, the count or the quantiles, among other examples. Recall to type help(aggregate) or ?aggregate for additional information. ) # Additional arguments to be passed to FUN Ts.eps = getOption("ts.eps"), # Tolerance to determine if 'nfrequency' is a submultiple of the frequency of x Ndeltat = 1, # Fraction between successive observations ![]() ![]() Nfrequency = 1, # Observations per unit of time (submultiple of x)įUN = sum, # Function to be applied for summary statistics Na.action = na.omit) # How to deal with NA values Subset, # Observations to be used (optional) Simplify = TRUE, # Whether to simplify results as much as possible or notĭrop = TRUE) # Whether to drop unused combinations of grouping values or not.ĭata, # List or data frame where the variables are stored , # Additional arguments to be passed to FUN The arguments and its description for each method are summarized in the following block: # Data frameīy, # List of variables (grouping elements)įUN, # Function to be applied for summary statistics There are three possible input types: a data frame, a formula and a time series object. The syntax of the R aggregate function will depend on the input data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |