In: Statistics and Probability
You can draw R base graphs as described at this link: R base graphs. Here, we’ll use the ggpubr R package for an easy ggplot2-based data visualization
# Install if(!require(devtools)) install.packages("devtools") devtools::install_github("kassambara/ggpubr")ether the median (mm) of the sample is greater than to the theoretical value(m0m0)
Import your data into R
Prepare your data as specified here: Best practices for preparing your data set for R
Save your data in an external .txt tab or .csv files
Import your data into R as follow:
# If .txt tab file, use this my_data <- read.delim(file.choose()) # Or, if .csv file, use this my_data <- read.csv(file.choose())
set.seed(1234) my_data <- data.frame( name = paste0(rep("M_", 10), 1:10), weight = round(rnorm(10, 20, 2), 1) )
Check your data
# Print the first 10 rows of the data head(my_data, 10)
name weight 1 M_1 17.6 2 M_2 20.6 3 M_3 22.2 4 M_4 15.3 5 M_5 20.9 6 M_6 21.0 7 M_7 18.9 8 M_8 18.9 9 M_9 18.9 10 M_10 18.2.
Min. 1st Qu. Median Mean 3rd Qu. Max. 15.30 18.38 18.90 19.25 20.82 22.20
Visualize your data using box plots
library(ggpubr) ggboxplot(my_data$weight, ylab = "Weight (g)", xlab = FALSE, ggtheme = theme_minimal