Introduction and Syllabus
1 Welcome to Programming Fundamentals Using R and RStudio
The purpose of this class is to introduce students to the principles of programming using R and RStudio. R and RStudio are powerful and versatile data analysis packages that are freely available. The R community is extensive and is constantly developing new tools that rival and, in many cases, surpass commercial statistical software and graphing packages. This class is designed for students new to programming. While the class focus is on R programming in RStudio, the programming skills taught (e.g., for loops, if-else statements, functions) are designed so that students can transfer their skills to other programming languages like C, JavaScript, or Python.
The class is a self-paced and asynchronous online class. The amount of material in the class is about the same as a 4 credit, one semester class and students are expected to complete the class within six months. There are no regularly scheduled office hours but you can email the instructor anytime to ask questions or set up a Zoom meeting. All contacts will receive a response within one business day.
1.1 Instructor
Charlie Belinsky
belinsky@msu.edu
517-355-0126
About me…
I started my career as a Software Engineer for Motorola in Arizona where I developed software for military radios. From there I became a high school teacher in Port Huron, MI where I taught Computer Science, Web Design, and Physical Science. After that, I worked as an Instructional Designer for the College of Education at MSU where my main project was developing the hybrid graduate program. I currently work at the QFC where my primary job is developing and teaching online classes, including this one. In my free time you will often find me with a backpack deep in a forest or, as my picture testifies to, hanging out in the West Rim of Zion National Park.
1.2 Technical Support
You can contact me, Charlie, regarding technical issues.
2 Class Requirements
Students should be familiar with basic statistical concepts (e.g., mean, standard deviation, standard error). All material for this course is online – no textbooks or any other purchases are required.
2.1 Tech requirements
Hardware: Any Windows (10 or 11), Mac, or Linux machine from the past ten years that has updates installed can handle all hardware and software requirements of this class.
Browser: You can use any browser (Firefox, Microsoft’s Edge, Chrome, Safari) updated within the last couple of years.
Videoconferencing: We use Zoom for our videoconference meetings. The meeting link will be emailed to you prior to the meeting. It is recommended that you download and test your camera and microphone on Zoom before attending an instructor meeting. The easiest way to do this is to go to the Zoom test page. Note: Zoom’s test page will download Zoom for you.
To test your hardware in Zoom, open Zoom a click your personal icon and choose Settings (Figure 1) and the settings window will open Figure 1. Go to the Audio and Video & effects tabs to test your microphone, speakers, and webcam. If you are using a Mac, the view is different but the buttons are the same.

2.2 Accessing the class
This class will eventually require a GitHub ID to access and hand in assignments. This is optional for now. If you want, go to http://github.com and click Sign up, you can use a free GitHub account or a professional account.
3 Class Structure
The course has 28 lessons divided into two units: Basic Programming and Data Programming
Basic Programming: basic programming structures and operations like variables, inputs, outputs, mathematical operations, if-else structures, for loops, and conditional operations.
1-1 RStudio Projects Setup: Set up a Project in RStudio and learn the basics of the RStudio programming environment.
1-2 Variables: Discussion of the different types of variables, variable naming conventions, assigning values to variables, changing values.
1-3 Mathematical Operations: Mathematical operations on numeric variables, power operations, algebraic formulas in R
1-4 Vectors and Data Frames: Learn about CSV files and two common data types in R
1-5 Functions Introduction: Reading function descriptions and using arguments
1-6 Run and Source: The two ways in R to execute a script and some convenient coding feature in RStudio
1-7 Outputs: Output information to the console, mixed string, and numeric outputs.
1-8 Conditional Operators: Creating decision points in your script using if() statements and the six conditional operators.
1-9 If-Else Statements: Checking multiple conditions on a variable, creating error conditions.
1-10 For loops: Cycle through data using for loops and performing conditional operations on each value
1-11 For loops and State Variables: Remembering values as you cycle through for loops
1-12 Multiple Conditions: Checking complex conditions on a variable using logical operators & and
1-13 Functions: Creating your own function, adding and using arguments and return values
1-14 Function 2: Default arguments, multiple returns, error checking
1-15 Nested Loops and Matrices: for loops within for loops and multidimensional vectors
Data Programming: data programming structures and operations like file inputs, vectors, subset operations, plotting, and data types.
2-1 GGPlot Introduction: Structures within GGPlot, creating basic plots from data in a data frame
2-2 Data frame Modifications: Add, remove, and reorder column in a data frame, and manipulating string values
2-3 Data types and Data Frames: Conversion between data types, NA values, common issues with data frames
2-4 Which Statements: Conditionally subset numeric data, plot subsetted data
2-5 Which and Regular Expressions: Conditionally subset string data, finding patterns in string values
2-6 Datetime Objects: Formatted date and datetime values, converting from strings to datetime value
2-7 Matrices: Create two-dimensional data, performing statistics on 2D data
2-8 Binding and Sampling: Combining data and creating randomly sampled values
2-9 Stacking and Mapping: Plotting multiple columns in a data frame at once, mapping data to color and size
2-10 Statistical Tests: t-tests, ANOVAs, linear regressions and storing and reading information from the tests
2-11 Objects and Attributes: deeper dive into the data types in R and their attributes
2-12 Lists: Reading, navigating, subsetting, and creating List objects in R
2-13 Breakpoints: a method for debugging your code
3.1 Lesson Application
All lessons have an Application section at the end that will ask you to apply what you learned in the lesson in your own script. The Application is the only product that gets evaluated. There are no tests and there is no final exam.
The class is self-paced, however you should not go more than 2 weeks without handing in an application unless you inform the instructor that there will be a delay. You will have a chance to redo all applications.
3.2 Lesson feedback
Each application has these three questions regarding the lesson:
What was your level of comfort with the lesson/application?
What areas of the lesson/application confused or still confuses you?
What are some things you would like to know more about that is related to, but not covered in, this lesson?
These questions are vital for feedback in this class and far more useful to me than end-of-class surveys as they give me real-time information. Please take a few minutes to answer these questions. Feedback from these questions has become my main way of improving the class. In return, I promise to address concerns and questions from your responses.
3.3 Extensions and Traps
Many of the lessons contain optional content called Extension and Traps. Extensions contain material that goes beyond the lesson’s objectives and Traps capture some of the common issues students have with the lesson’s objectives. There are links to Extensions and Traps within the Content area of the lesson. Clicking on the appropriate link takes you directly to the Extension or Trap. Extension: Testing the extension link
4 Student-Instructor Meetings
With the exception of an initial meeting (after lesson 2), student-instructor meetings will be done on an as-needed basis and meetings can always be requested by the student. Meetings are preferably over Zoom so that screens can be shared.
5 Lesson features (technical)
This sections goes over some of the technological features built into the lessons.
5.2 Resizing Pictures
Most images in the course can be resized so that the picture is out of your way when you don’t need to view it.
Clicking on the image toggles it between the minimized and maximized states.
Clicking and dragging on the image allows you to resize the image to any size. (Figure 3).
.jpg)
5.3 Figures and references
When you click on a figure reference (e.g., Figure 3), the caption on the figure will highlight for 2 seconds.
If the figure is not on the screen, then the page will scroll to the figure and highlight it. For instance, clicking on Figure 1 will take you to the Zoom figure near the top of this page. You can return to this position by long-clicking and selecting Return to the Previous Position
5.4 Printing lessons and saving lessons to PDF
You can print any lesson or save it as a PDF by clicking on the Printer icon at the top of every lesson (and this syllabus). This will bring up a print dialog (Figure 4) and you can print the lesson to a printer. On most machines, you can also choose a PDF device as a printer – this will save the lesson as a PDF document. Trap: Bloatware
If you are saving the lesson to PDF or printing in color then I recommend you check Print background in the print options. This will help codeblocks and highlights stand out. If you are printing the lesson in grayscale then I recommend you uncheck Print background.
Note: Using your browser’s print feature instead on the Print link will print out the whole webpage instead of just the lesson.
5.5 Codeblocks
Clicking on the clipboard in the upper-right corner of the codeblock (Figure 5) will copy the code to the clipboard. You can then paste the code into RStudio (or any other text editor)
# the next two lines should be at the top of all your scripts
rm(list=ls());
options(show.error.locations = TRUE);
# create three variables: d, t, and v
# give d and t values and use them to calculate v
= 100;
d = 20;
t = d/t; v
5.6 Special note about images in the lessons for this class
RStudio is a rapidly evolving program, and it would be too much work to maintain all the lesson images in order to reflect the visual likeness of the newest version of RStudio. Some of the images in this class still reflect the 2019 version of RStudio (when R was still at version 3.5). There are also minor changes that I have made to the code that I did not believe warrants putting in new images. For instance, my RStudio Project name might change between images and some of the RStudio buttons and tabs will look slightly different (think of it as a check on how observant you are!). I have tried to make sure these differences change nothing functionally. Inevitably, something will fall through the cracks – so please, contact the instructor if there is something causing a problem!
6 Personal statement from Charlie
The biggest thing that is lost when you move a class from a face-to-face environment to an online environment is the daily interaction between the instructor and the students. These interactions provide invaluable informal feedback for the instructor and, I would argue, are the main tool that an instructor uses to make improvements to their class. It is impossible to replicate this in an online class but I ask that you help me out and make an effort to communicate to me the little things. This could mean technical nags like content not appearing properly or pages loading too slowly, lesson content that is unclear, grammar and spelling issues, or scripts that does not work or work in a way that you do not understand.
Thank you for reading and taking this into consideration. In the end, it is the interactions between an instructor and the students that make a class great.
7 AI Statement
If you are using AI to simply give you the answers to applications in this class, then you are using AI wrong. AI has been trained on what’s on the internet, and while many answers online are technically correct, they often don’t transfer well to new situations. AI frequently produces solutions that are overly complicated or that only work in narrow cases.
No class can fully capture the “real world.” This means the goal here is not just to get the correct answer, but to recognize patterns and understand how programming techniques apply in different situations.
One of the most valuable skills you can develop as a programmer is learning how to break down big problems. In the end, every programming task in any language can be expressed with four components: variables, if–else statements, loops, and functions. These components are not simple to master, but once you learn to see problems through this lens, you can use AI much more effectively. Instead of asking AI for a finished solution, use it to help you break down problems and to understand how these components work within a solution.
8 Disclaimers and Loose Ends
Now on to the stuff I have to put in a syllabus…
8.1 Student Responsibilities
Students are expected to regularly check the home page for the class and their email for new information regarding the class.
Students are expected to ask questions if they are having problems with the course material or application.
Students are expected to maintain their progress in order to complete the course work on time.
Students are expected to contact either the instructor or MSU regarding technical issues that are interfering with the class.
Students are expected to follow the MSU’s academic integrity policy.
Please notify the instructor regarding issues with the class website and lessons.
8.2 Academic Integrity (summarized)
Written or other work which a student submits in a course, shall be the product of his/her own efforts. Plagiarism, cheating, and all other forms of academic dishonesty are prohibited. Students are expected to adhere to the ethical and professional standards associated with their programs and academic courses. All applicable portions of Michigan State’s Policy on Academic Integrity apply to non-credit courses.
8.3 Instructor Responsibilities
Instructor will be available for assistance for requested virtual office hours (through Zoom).
Instructor will respond to emails from students within 1 business day. Potential for delayed responses (e.g., instructor is on vacation) will be posted on the home page of the course.
Changes to the course will be posted on the home page for the class.
8.4 Attendance
You are expected to log in to the class at least once a week. Logging in allows you to stay updated and see new announcements.
8.5 Participation
Please note that not all course lessons are the same length and the later ones tend to involve more work. Our goals with regard to participation/progress are to (a) keep you engaged in the course, (b) enhance the overall learning environment by promoting student-teacher communication, and (c) avoid a last minute time crunch for everyone involved. We will not be sympathetic or make allowances for your failure on course tasks or deadlines that result from not seeing announcements because you had not accessed the course for an extended period, and had not told us you would be away from the internet.
8.6 ADA Statement
MSU provides students with disabilities reasonable accommodations to participate in educational programs, activities, or services. Students with disabilities requiring accommodations to participate in class activities or meet course requirements should contact the instructor as early as possible.
For students needing accommodations for disabilities, please contact your instructor and The Resource Center for Persons with Disabilities at Michigan State University at 517-353-9642.
9 Trap: Bloatware
Adobe Acrobat, like most free software you download, attempts to bundle itself with software you most likely do not need nor want (i.e., bloatware). Make sure you take some time to read the optional offers whenever you download software. This author would argue that the main reason computers “slow” down over time is because of extra software that users unwittingly install.

10 Extension: Testing the extension link
Hi, and welcome to the test Extension. If you clicked on the Extension link to get here then you can return to your previous location by long-clicking on this page and choosing Go to Previous Location.
If you just scrolled down to this point then, congratulations, you have reached the end of the document.