Understanding Your Data Through Statistical Measures 📊
Welcome to Week 2! This week, we explore descriptive statistics and measures of central tendency - essential tools for summarizing and understanding data in agricultural research. Learn to calculate mean, median, mode, variance, and standard deviation using R!
Click the "Launch Week 2" button above to start your R environment. This will take 2-5 minutes to load with all necessary packages for descriptive statistics.
Once Binder loads, you'll see the Jupyter Notebook interface. In the left panel, you'll see:
assignment/ - Assignment 2 on descriptive statisticsclass_activity/ - Week 2 lab tutorialClick on the class_activity folder to access this week's content.
Inside the class_activity folder, double-click on Week2_Descriptive_Statistics.ipynb to open the interactive lab notebook.
This week we'll use the built-in iris dataset - no external files needed! The notebook will guide you through:
summary() and head() functionsUse these interactive tools to understand statistical concepts better before working with R code:
💡 Tip: Use these tools to visualize concepts before applying them in your R notebook!
summary(data) # Comprehensive summarymean(data$column) # Calculate meanmedian(data$column) # Calculate medianvar(data$column) # Calculate variancesd(data$column) # Calculate standard deviationquantile(data$column) # Calculate quantiles
head(data) # First 6 rowsstr(data) # Data structurenrow(data) # Number of rowsncol(data) # Number of columns
Mode <- function(x) { ux <- unique(x) ux[which.max(tabulate(match(x, ux)))]}
From the main directory, click on the assignment folder to access Assignment 2.
Double-click on Assignment2.ipynb to open your assignment on descriptive statistics.
Calculate central tendency measures for LA data
Analyze variability across different subgroups
Interpret Q1 and Q3 values for datasets
Compare statistics and draw inferences
The assignment uses the LA dataset to compare statistics between:
Look for hints in comments to guide your coding!
⚠️ Important: Binder environments are temporary! Always save your work locally.
When you're done working, save your progress:
To resume your work:
.ipynb fileFor Assignment 2, submit TWO files to UC Davis Canvas:
Your completed assignment with all outputs and analysis
Your notebook code as backup
Due Date: Check Canvas for assignment deadline
By the end of this week, you will be able to:
Mohammadreza Narimani
📧 mnarimani@ucdavis.edu
🏫 Department of Biological and Agricultural Engineering, UC Davis
?function_name for help?function_name in any code cellclass_activity/ folderClick the Binder badge below to launch Week 2!
Happy analyzing! 📊🌾