BCB744 Intro R Self-Assessment
Here is a self-assessment worksheet for the Introduction to R portion of the BCB744 course, based on the provided sources. This worksheet is designed to help you gauge your understanding of the material covered in each lecture and provides resources for further practice.
- Complete the practice exercises to test your skills.
- You do not need to submit anything for the practice exercises – those are for your own benefit.
- Submit your answers to each task’s questions no later than 8:30 on the day after the corresponding lectures (e.g. Monday’s lecture material is covered by Task A, and must be submitted on Tuesday morning no later than 8:30).
- You MUST submit your answers to the questions for each task.
- Review the relevant course material if you find you are struggling with a section. Ask for help before it is too late! It is best to admit in class if you are falling behind so that others might benefit as well. Chances are, you’re not alone.
To reiterate: You don’t need to submit the practice exercises, but you MUST submit the questions for each task.
- Deadline: Submit your work by 8:30 AM on the day after the tasks were issued.
- Submission Format: Submit on iKamva as an R document, HTML, or a PDF, as instructed in the lectures.
-
Email Subject Line: In case you have to email your work (e.g. no iKamva access), use the following subject line:
- 📌 BCB744 Task [The Number]: [Your Surname]
-
File Naming Convention:
- 📄 BCB744_Task_[The Number]_[Your_Surname].pdf (or whatever the instructions call for re the file format), where [The Number is the task number, e.g. BCB744_Task_A_Smit.html]
Failure to adhere to these requirements may result in a grade penalty. Ensure that your slides are clear, well-structured, and visually professional.
- Immediately after we have gone over the task answers in the class (e.g. on Tuesday morning for Task A):
- Add the marks you gave yourself for each question (according to the model answers we discussed) to the MS Excel spreadsheed, which you can download from the top of each Task’s question page (e.g. here).
- To calculate your Final Score, rate your performance according to the rubric and enter those marks next to the “Content” and “Code Formatting & Presentation” entries on the spreadsheet. Once those marks have been supplied, the final mark will automagically be calculated.
- Rename the Excel file correctly (Name and Surname, and take note of the underscores):
- e.g. 📄 BCB744_Task_[The Number]_[Your_Name].xlsx
- Submit it on iKamva where it will be kept on record.
- Each day I’ll randomly select five of the submitted tasks to check how honest you were in your self-assessment. If you are found to be dishonest, you will be penalised by losing marks from the presentations. If you are honest, you will be rewarded with bonus marks.
Rubric (All Tasks)
Task A Questions
1. R and RStudio
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Installation of R and RStudio
- Understanding the RStudio IDE
- Navigating the RStudio interface
- Basic R syntax
Practice Exercises
- Open RStudio. Create a new R script.
- Execute basic arithmetic operations (e.g.,
2 + 2, 5 * 3
) in the console. - Explore the different panes in the RStudio interface (Source, Console, Environment, History, Files, Plots, Packages, Help).
2. Working With Data and Code
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Importing data into R.
- Understanding different types of data files.
- Understanding data structures (vectors, lists, data frames).
- Basic coding practices.
3. Data Classes and Structures in R
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Understanding data classes in R.
- Working with vectors, matrices, and data frames.
- Using indexing and subsetting.
Practice Exercises
- Create a vector of numbers and a vector of characters and assign them to the variables
numbs
andletts
, respectively. - Place these two variables (
numbs
andletts
) into a data frame callednumbsletts
. - Create a matrix with the following data:
- Assign the row names
c("row1", "row2", "row3")
and column namesc("col1", "col2", "col3", "col4")
to the matrix. - Extract the number in the second row and in the third column.
- Create a new matrix with the same data but with the rows and columns transposed.
- Find five datasets that you like the look and content of. They may be some of the datasets built into R (and the various packages you downloaded), or they may be ones you found somewhere else. For each:
- describe the data types (statistical view) of the variables contained within,
- using the functions shown in the Chapter, describe their R data classes of each variable, and
- using the functions shown in the Chapter, describe their data structures.
4. R Workflows
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Creating reproducible workflows
- Using R scripts
- Commenting code
- Using packages
Practice Exercises
- Create a vector of numbers and a vector of characters and assign them to the variables
numbs
andletts
, respectively. - Place these two variables (
numbs
andletts
) into a data frame callednumbsletts
. - Import the built-in dataset
ChickWeight
usingdata(ChickWeight)
and view it. - Use
head()
andtail()
to view the first and last rows. - Use
str()
to see the structure of the data frame. - Create an R script that imports the
ChickWeight
dataset and assigns it to the objectkfc
. - Add comments to your script explaining what each line of code does.
Use ?datasets :: ChickWeight
to find help for the dataset ChickWeight. The course website has links to download additional datasets.
Task B Questions
5. Graphics With ggplot2
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Creating basic plots with ggplot2.
- Understanding the grammar of graphics.
- Using layers, aesthetics, and geoms.
Practice Exercises
- Create a scatter plot using ggplot2 with the
ChickWeight
dataset, plottingweight
againstTime
. - Create separate figures for each
Diet
group (i.e. you will have four plots, one for each diet group). - Add appropriate titles and axes labels to the plots.
- Experiment with different geoms like
geom_line()
orgeom_point()
.
6. Faceting Figures
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Using
facet_wrap()
andfacet_grid()
to create subplots. - Displaying data across multiple dimensions.
Practice Exercises
- Create a scatter plot with ggplot2 using the
ChickWeight
dataset and usefacet_wrap()
to create subplots for eachDiet
. - Experiment with different
facet_wrap()
andfacet_grid()
arguments.
7. Brewing Colours
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Customising colours in plots.
- Using colour palettes effectively.
Practice Exercises
- Recreate the plots from previous exercises and experiment with different colour scales (e.g., using
scale_color_brewer()
,scale_fill_viridis_c()
). - Choose colours that are appropriate and informative for the data you are displaying.
Task C Questions
8. Mapping With ggplot2
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Creating basic maps using ggplot2.
- Using spatial data.
Practice Exercises
- Staying with the figure you created above, change various aspcects of the theme, line types and thickness, colour fills and other colours, etc. Create some variations for the map and save them as separate figures.
- Think about which aethetic choices make the most pleasing maps.
9. Mapping With Style
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Customising map aesthetics.
- Adding themes to maps.
10. Mapping With Natural Earth and the sf Package
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Using the sf package for spatial data.
- Working with Natural Earth data.
Practice Exercises
- Use the rnaturalearth package to download a Natural Earth map of a country of your choice, then plot it using the sf package.
- Explore other spatial datasets available with the rnaturalearth package.
Bonus Task Questions
Task D Questions
12, 13 & 14. Tidy Data
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Principles of tidy data.
- Using tidyr for data reshaping.
- Using dplyr for data wrangling.
Practice Exercises
- Import a messy dataset and practice reshaping using
tidyr::pivot_longer()
andtidyr::pivot_wider()
. - Use dplyr to clean and manipulate data in the tidy format.
Lecture 15. Recap
Understanding Level: Beginner / Intermediate / Advanced
Key Concepts
- Review of all key concepts.
- Practical application of learned skills.
Practice Exercises
Using a dataset of your choice, perform a full analysis, including data cleaning, manipulation, and visualisation using all the skills learned from previous modules.
How to Use This Worksheet
- Be Honest: Accurately assess your understanding of each topic to identify areas you need to review.
- Practice Regularly: Consistent practice is key to mastering R.
- Seek Help: Don’t hesitate to ask questions on the GitHub Issues page for help.
- Collaborate: Work with your peers and discuss the concepts [8, 19].
- Use the Resources: Make full use of the provided links and materials for further study.
- Review: If you are struggling, review the course material provided by the instructor.
Reuse
Citation
@online{smit,_a._j.2025,
author = {Smit, A. J.,},
title = {BCB744 {Intro} {R} {Self-Assessment}},
date = {2025-02-01},
url = {http://tangledbank.netlify.app/assessments/BCB744_Intro_R_Self-Assessment.html},
langid = {en}
}