Assignment #10: Building Your Own R Package
The plot_summary() function is used to automatically generate visualizations for a dataset. It begins by loading the ggplot2 package, which is used for creating graphs. The function then separates the dataset into numeric and categorical variables using sapply() with is.numeric and is.factor . This allows the function to treat each type of data appropriately. For numeric variables, a loop is used to create histograms that display the distribution of values. For categorical variables, another loop creates bar charts to show the frequency of each category. Each plot is printed using print(p) , which ensures that the graphs appear immediately in the RStudio Plots pane without needing additional commands. The interactive_chart() function creates an interactive scatter plot between two selected variables. It loads both ggplot2 and plotly , where ggplot2 is used to build the initial plot and plotly adds interactivity. The function takes a dataset and two column names as inputs,...