A. Object Subsetting, Import and Export
- Task 1: Sort the rows of the
irisdata frame by its first column and sort its columns alphabetically by column names.
- Task 2: Subset the first 12 rows, export the result to a text file and view it in a spreadsheet program like Excel or Google Sheets.
- Task 3: Change some column titles in your spreadsheet program, save the result to a tab delimited text file and import it back into R. Note, for this task you only want to include the
read.tablecommand in the homework result (here R script).
Before you start it can be helpful to evaluate the structure of the
iris data set with the following commands:
B. Scatter Plots
- Task 1: Generate a scatter plot for the first two columns of the
irisdata frame and color the dots by the
- Task 2: Use the
xlim/ylimarguments to set limits on the x- and y-axes so that all data points are restricted to the bottom left quadrant of the plot.
Again before you start, evaluate the structure of iris data set. The following commands are useful:
C. Bar Plots
- Task 1: Calculate the mean values for the
Speciescomponents of the first four columns in the
irisdata frame. Organize the results in a matrix where the row names are the unique values from the
iris Speciescolumn and the column names are the names of the first four
- Task 2: Generate two bar plots for the matrix generated in the previous step: one with stacked bars and one with horizontally arranged bars.
D-H. Analysis Worflow
The instructions for these homework assignments are here.
Assemble the results from homework assignments A-H in a single R script (
HW3.R) and upload it to your private GitHub repository under
This homework is due on Thu, April 20th at 6:00 PM.