You can perform various operations on data frames in R using built-in functions and packages. Here are some examples:
- Summary statistics: You can calculate summary statistics for numeric columns using the summary() function. For example, summary(df$age) will give you the minimum, 1st quartile, median, mean, 3rd quartile, and maximum values of the "age" column.
- Aggregation: You can aggregate data based on specific variables using functions like aggregate() or the dplyr package. For example, aggregate(age ~ city, data = df, mean) will calculate the average age for each city.
- Sorting: You can sort a data frame based on specific columns using the order() function. For example, df_sorted <- df[order(df$age), ] will sort the data frame by the "age" column in ascending order.
- Merging: You can merge two data frames based on a common column using the merge() function. For example, merged_df <- merge(df1, df2, by = "id") will merge df1 and df2 based on the "id" column.
These are just a few examples, and there are many more operations you can perform on data frames in R.