1  1. About the midterm (Prof. Rosenthal’s class)

1.1 Update - Nov 4, 2025

  • Practice Questions - TOPIC: User Defined Functions - QUESTION 68c
    I mistakenly included this question. Do not worry if you cannot do this one. We will cover this kind of question after the midterm.

  • Practice Questions - TOPIC: User Defined Functions - QUESTION 71b
    The answer for this question was missing. I updated the text of the question with a hint and provided an answer.

1.2 Info about the midterm

As I announced in class, the midterm will be on Wednesday Nov 5, 2025. There was some confusion in class about the URL for the website. The website you should be using is:
https://y-rosenthal.github.io/rnotesLatest/

  • The test is on paper - you are NOT allowed to bring in a computer.

  • You are NOT allowed to bring in a calculator (the math will be easy). If you cannot do the math - ask me and I will be your calculator.

  • You may bring in one piece of double sided 8.5”x11” paper with notes.

  • The midterm will include two types of questions:

    1. Questions where I give you the code and you must write what R will produce

    2. Questions where I ask you to write R code

    Note that most of the practice questions are in the format where you have to write code - i.e. style (b). Howver, you are expected to understand how to READ every line of code in the answers. If you do then it should be straightforward to answer questions in style (a) where you are shown R code and must write what R would produce. MAKE SURE THAT YOU UNDERSTAND HOW TO READ R CODE AND WRITE WHAT R WOULD PRODUCE.


The midterm will cover all material that we got up to by Wed Oct 29 (including what we covered on Oct 29).

1.3 Chapters on the midterm:

  1. Installing and using R
  2. variables, integer division and remainder operators
  3. Order of Operations in R
  4. Using some built-in functions
  5. Intro to R vectors
  6. The recycling rule and more …
  7. More function stuff - rep, sort, seq, colon operator
  8. User defined functions
  9. debugger (also known as the “browser”)
  10. modes of data: “numeric”,“logical”,“character”,etc.
  11. NA is.na() na.rm argument
  12. Indexing with positive numbers
  13. Indexing with NEGATIVE numbers
  14. Logical vectors, relational (AKA logical) operators, ifelse
  15. Indexing with logicals, e.g. someVector [ c(TRUE, FALSE, TRUE) ]
  16. Automatic (or “implicit”) conversions - numeric to logical - logical to numeric
    1. EXCLAMATION POINT (i.e the “not” operator) (b) is.na( LOGICAL_VECTOR )
  17. “character” values (also known as “strings”), cat(), nchar(), paste(), paste0()
  18. Using cat to help debug your code.
  19. Parallel vectors
  20. %in%
  21. “LOCAL VARIABLES” vs “GLOBAL VARIABLES”
  22. logical operators ! (not) & (and) | (or)
  23. scientific notation ~(abbridged version)~
  24. implicit and explicit conversions
  25. intro to “lists” - i.e. collections of any R objects

1.4 Extra practice questions

You are responsible for all of the material from the chapters listed above. There are many practice problems embedded directly in the chapters above. In addition, the following practice questions cover much of that material but might not cover every single concept.

You should consider it homework to go through all of these review questions before the exam. There are answers posted with the questions. Please review the answers too. If you still don’t understand the code for an answer, you can send me a WhatsApp (I gave out my number in class) and be sure to include both the text of the question and the text of the answer.

  • Practice Questions - TOPIC: Vectors1

    • ALL QUESTIONS
  • Practice Questions - TOPIC: Vectors2

    • ALL QUESTIONS except for questions 12,13 (we did not cover “named lists” yet)
  • Practice Questions - TOPIC: Assorted Topics

    • QUESTIONS 73, 75, 76, 77, 78, 79, 81
  • Practice Questions - TOPIC: User Defined Functions

    • QUESTIONS 67, 68a,b,d, 71a,b

    • Answer for 71b was fixed. See the current page for more info.

  • Practice Questions - TOPICS: Parallel Vectors, &, |, scientific notation, etc.

    • QUESTIONS 1,2,4,5,6,19,22,25,26,27,28,29,31,33,34,35,36,37,38
    • OTHER QUESTIONS: 23,24 Note that for these you need to know the “collapse” argument to paste/paste0 - read about that in the notes or in the online documentation for ?paste or ?paste0
  • Practice Questions - TOPICS: cat, loops (reading code)

    • QUESTIONS: 1, 2, 3, 4
  • Practice Questions - TOPICS: Parallel Vectors, &, |, scientific notation, etc.

    • ALL QUESTIONS
  • Practice Questions - TOPIC: Intro to Lists

    • ALL QUESTIONS

© 2025 Y. Rosenthal. All rights reserved.