10 R functions that replace your Excel
Yevheniia Drozdova, Texty.org.ua
To execute a row use:
Control + Enter (Windows)�Command + Enter (Mac)
If row starts with # R ignores it
This is the path to the folder where you saved your file. This path will be different for each of you — it depends on your operating system, your computer name, and other settings.
It will give you a clue how
to set a path for you files
You can name variables however you like, but it’s good practice to use descriptive ones
name of your file
(it would be different)
Data Playground
%>% �Shift+CTR+M (Windows)
�Shift+Command+M
(Mac)
2
1
admin1 is a column name. It should be presented in your data
& AND operator 一 both conditions must be true
| OR operator 一 at least one must be true
Functions are small tools that do specific jobs for you. R already has many built-in ones — for example, month.name[10] returns the 10th month, or month() helps you extract the month from a date
Important: the values in the admin1 column of your data and the admin1 column in election_data must be written the same way
Clean your environment from extra files. It doesn’t impact real files on your computer.
Final notes:
# Always use pipe (%>%) for readable code
# Combine functions for complex analyses
# Document your code with comments for future use
# ChatGPT or other LLM can help you with R code
# Add ggplot2 library for data visualization
gives you a quick scatterplot — no other tools needed