R Programming Exercises, Practice Questions and Solutions
R Programming Language is an open-source language mostly used for machine learning, statistics, data visualization, etc. It is an interpreted language that supports both object-oriented and procedural programming. You might have seen various R tutorials explaining the concepts and the theoretical part with some examples, but that is not enough to get a hold of this language. You need more practice to make yourself perfect as practice will make you perfect.

This R Programming Exercise will help you practice and learn R Language using a set of questions from basic to advance, containing a well-explained and detailed solution to each question.
R Programming Language – Vector Exercises
- How to create an empty vector in R ?
- Create empty vector and append values
- Find Sum, Mean and Product of a Vector in R
- Find product of vector elements in R
- Count number of vector values in range with R
- Count the specific value in a given vector in R
- Access the last value of a given vector in R
- Find the elements of a vector that are not in another vector in R
- Find the Nth highest value of a vector in R
- How to find Nth smallest value in vector in R ?
- Extract every Nth element of a vector in R
R Programming Language – List Exercises
- Count Number of List Elements in R
- Create a list with random values in R
- How to add Key Value Pair to List in R ?
- Access Index Names of List Using lapply Function in R
- Convert matrix to list in R
- Convert list to dataframe with specific column names in R
- Convert list to array in R
R Programming Language – String Exercises
- Convert Character String to Variable Name in R
- Count Number of Characters in String in R
- Count Number of Occurrences of Certain Character in String in R
- Extract Numbers from Character String Vector in R
- Count Number of Words in String using R
- How to calculate the number of occurrences of a character in each row of R DataFrame ?
R Programming Language – Matrix Exercises
- How to create an empty matrix in R ?
- Fill an empty matrix in R
- Elementwise Matrix Multiplication in R
- Multiply Matrix by Vector in R
- Find the power of a matrix in R
- Raise a matrix to a fractional power in R
- Get element at the specific position from matrix in R
- Find row and column index of maximum and minimum value in a matrix in R
- Select rows of a matrix in R that meet a condition
- Multiply a matrix by its transpose while ignoring missing values in R
R Programming Language – DataFrame Exercises
- How to create a DataFrame from given vectors in R ?
- Create empty DataFrame with only column names in R
- Insert multiple rows in R DataFrame
- How to add column to dataframe in R ?
- Extract first N rows from dataframe in R
- How to select row with maximum value in each group in R Language?
- Remove rows with NA in one column of R DataFrame
- How to remove empty rows from R dataframe?
- Find columns and rows with NA in R DataFrame
- Sort DataFrame by column name in R
- How To Merge Two DataFrames in R ?
- Append one dataframe to the end of another dataframe in R
- How to find common rows and columns between two dataframe in R?
>>> More Programs on DataFrame
R Programming Language – Factor Exercises
- How to count values per level in a factor in R
- Find the levels of factor of a given vector in R
- How to change the order of levels of a factor in R?
- How to convert factor levels to list in R ?
- Concatenate two given factor in a single factor in R
- Get All Factor Levels of DataFrame Column in R
R Programming Language – Date and Time Exercises
- How to Add and Subtract Days to and from Date in R ?
- How to subtract time in R ?
- How to Extract time from timestamp in R ?
- How to calculate number of days between two dates in R ?
- How to calculate Years between Dates in R ?
- How to convert a factor into date format?
>>> More Programs on Date and Time
R Programming Language – File Handling Exercises
- How to check if a file already exists in R ?
- R – Check if a Directory Exists and Create if It does not
- Add New Line to Text File in R
- How To Import Data from a File in R Programming
- How to export dataframe to RDATA file in R ?
>>> More Programs on File Handling
R Programming Language – CSV Exercises
- Reading the CSV file into Dataframes in R
- Export CSV File without Row Names in R
- How to write to CSV in R without index ?
- Append row to CSV using R
- How to calculate mean of a CSV file in R?
R Programming Language – Excel Exercises
- How to import an Excel File into R ?
- How to export a DataFrame to Excel File in R ?
- Convert an Excel column into a list of vectors in R
- How to convert Excel column to vector in R ?
- How to convert excel content into DataFrame in R ?
- Delete rows with empty cells from Excel using R
R Programming Language – Data Visualization Exercises
- Adding Colors to Charts in R Programming
- How to show legend in heatmap in R?
- Display All X-Axis Labels of Barplot in R
- How to Create a Stacked Dot Plot in R ?
- Change Spacing of Axis Tick Marks in Base R Plot
- Add legends without border and with white background in R
- Plot Shaded Area between vertical lines in R
- How to add Mean and Median to Histogram in R ?
- Create Scatter plot from CSV in R


