# R Programming Language (Analysis Software for Statistics & Data Science)

R is a **programming language and software** that is becoming increasingly popular in the disciplines of statistics and data science.

R is a dialect of the S programming language and was developed by Ross Ihaka and Robert Gentleman in the year 1995. A stable beta version was released in the year 2000.

The R software is **completely free** and gets **developed collaboratively** by its community (open source software) – every R user can publish new add-on packages.

The open source ideology of R programming reflects a huge contrast compared to most traditional programming environments (e.g. SAS, SPSS, Stata etc.), where the software development is in the hands of a payed development team.

## All R Tutorials on statisticsglobe.com

In the following, you can find a **list of R tutorials** on statisticsglobe.com. In the tutorials, I’m explaining statistical concepts and provide reproducible example codes in R.

### abline Function in R (6 Examples)

### Access Index Names of List Using lapply Function in R (Example)

### Add & Subtract Days to & from Date in R (2 Examples)

### Add & Subtract Months & Years to/from Date Object in R (2 Examples)

### Add Axes to Plot Using axis Function in R (4 Examples)

### Add Bold & Italic Text to ggplot2 Plot in R (4 Examples)

### Add Color Between Two Points of Kernel Density Plot in R (Example)

### Add Common Legend to Combined ggplot2 Plots in R (Example)

### Add Confidence Band to ggplot2 Plot in R (Example)

### Add Count & Percentage Labels on Top of Histogram Bars in R (2 Examples)

### Add Count Labels on Top of ggplot2 Barchart in R (Example)

### Add Greek Symbols to ggplot2 Plot in R (2 Examples)

### Add Header to Data Frame in R (Example)

### Add Image to Plot in R (Example) | Draw Picture on Top of Graph Using ggplot2 & patchwork Packages

### Add Index ID to Data Frame in R (3 Examples)

### Add Individual Text to Each Facet of ggplot2 Plot in R (Example)

### Add Inset on Top of Previous Plot Using inset_element Function in R (Example)

### Add Key Value Pair to List in R (2 Examples)

### Add Label to Straight Line in ggplot2 Plot in R (2 Examples)

### Add Labels at Ends of Lines in ggplot2 Line Plot in R (Example)

### Add Leading Zeros in R (Example)

### Add Legend to Plot in Base R (8 Examples)

### Add Legend without Border & White Background to Plot in R (Example)

### Add Marginal Plot to ggplot2 Scatterplot Using ggExtra Package in R (5 Examples)

### Add Mean & Median to Histogram in R (4 Examples)

### Add Multiple New Columns to data.table in R (Example)

### Add New Column to Data Frame in R

### Add New Line to Text File in R (Example)

### Add New Row at Specific Index Position to Data Frame in R (Example)

### Add New Row to Data Frame in R (2 Examples)

### Add New Variable to Data Frame Based On Other Columns in R (2 Examples)

### Add Panel Border to ggplot2 Plot in R (Example)

### Add Prefix to Column Names in R (Example)

### Add Regression Line to ggplot2 Plot in R (Example) | Draw Linear Slope to Scatterplot

### Add Row to Empty Data Frame in R (Example)

### Add Subscript and Superscript to Plot in R (3 Examples)

### Add Table to ggplot2 Plot in R (Example)

### Add Text to ggplot2 Plot in R (3 Examples)

### Add Text to Plot Using text() Function in Base R (3 Examples)

### Add Time to Date Object in R (Example)

### Add Vertical & Horizontal Line to gglot2 Plot in R (4 Examples)

### Add X & Y Axis Labels to ggplot2 Plot in R (Example)

### Adjust Space Between ggplot2 Axis Labels and Plot Area in R (2 Examples)

### Aggregate Daily Data to Month & Year Intervals in R (2 Examples)

### aggregate Function in R (3 Examples)

### all_equal Function of dplyr R Package (2 Examples)

### Annotate Multiple Lines of Text to ggplot2 Plot in R (Example)

### Annotate Text Outside of ggplot2 Plot in R (Example)

### Append to Data Frame in Loop in R (2 Examples) | Add Column / Row in for-Loop

### Append to List in Loop in R (Example) | Add Element in while- & for-Loops

### Append to Vector in Loop in R (Example) | Add Value in while- & for-Loops

### Append Value to Vector in R (4 Examples)

### Apply Function to data.table in Each Specified Column in R (Example)

### Apply Function to Every Row of Data Frame or Matrix in R (Example)

### Apply Function to Every Row of Data Using dplyr Package in R | rowwise Function Explained

### apply Functions in R (6 Examples) | lapply, sapply, vapply, tapply & mapply

### Apply unique Function to Multiple Columns in R (2 Examples)

### apropos & find Functions in R (2 Examples)

### arrange Function of dplyr R Package (2 Examples)

### Arrange List of ggplot2 Plots in R (Example)

### as.Date Function in R (Example)

### as.double & is.double Functions in R (2 Examples)

### as.name & is.name Functions in R (2 Examples)

### as.tbl & is.tbl R Functions of dplyr Package (2 Examples)

### asp in R Plot (2 Example Codes) | Set Aspect Ratio of Scatterplot & Barplot

### Assign Column Names Based On Existing Row in R (2 Examples)

### Assign Fixed Colors to Categorical Variable in ggplot2 Plot in R (Example)

### assign Function in R (2 Examples)

### Assign Value to Elements in Certain Range in R (Example)

### Assignment Operators in R (3 Examples) | Comparing = vs. ＜- vs. ＜＜-

### attach & detach Functions in R | 2 Examples: Data Frame & Package

### attr, attributes & structure Functions in R | 4 Examples (get, remove & set)

### Avoid for-Loop in R? (Alternatives) | Using lapply Function Instead

### Barplot in R (8 Examples) | How to Create Barchart & Bargraph in RStudio

### Bernoulli Distribution in R (4 Examples) | dbern, pbern, qbern & rbern Functions

### Beta Distribution in R (4 Examples) | dbeta, pbeta, qbeta & rbeta Functions

### between Function of dplyr R Package (2 Examples)

### bind_rows & bind_cols R Functions of dplyr Package (2 Examples)

### Binomial Distribution in R (4 Examples) | dbinom, pbinom, qbinom & rbinom Functions

### Boxplot in R (9 Examples) | Create a Box-and-Whisker Plot in RStudio

### break & next Functions in R for-loop (2 Examples)

### c() Function in R (2 Examples)

### Calculate Combinations & Permutations in R (4 Examples)

### Calculate Correlation Matrix Only for Numeric Columns in R (2 Examples)

### Calculate Critical t-Value in R (3 Examples)

### Calculate Euclidean Norm of Vector in R (Example)

### Calculate Moving Average, Maximum, Median & Sum of Time Series in R (6 Examples)

### Calculate Percentage in R (2 Examples)

### Calculate Square in R (4 Examples)

### case_when & cases Functions in R (2 Examples)

### Cauchy Density in R (4 Examples) | dcauchy, pcauchy, qcauchy & rcauchy Functions

### cbind R Command | 3 Example Codes (Data Frame, Vector & Multiple Columns)

### Change Axis Labels of Boxplot in R (2 Examples)

### Change Background Color of ggplot2 Plot in R (3 Examples)

### Change Background Color of ggplot2 Text Label Annotation in R (Example)

### Change Color of ggplot2 Boxplot in R (3 Examples)

### Change Color, Shape & Size of One Data Point in Plot (Base R & ggplot2)

### Change Colors in ggplot2 Line Plot in R (Example)

### Change Colors of Axis Labels & Values of Base R Plot (2 Examples)

### Change Colors of Bars in ggplot2 Barchart in R (2 Examples)

### Change Colors of Ranges in ggplot2 Heatmap in R (2 Examples)

### Change Default Working Directory in R & RStudio (Step-by-Step Example)

### Change Display Order of ggplot2 Plot Legend in R (Example)

### Change Fill and Border Color of ggplot2 Plot in R (Example)

### Change Font of Plot in R (3 Examples)

### Change Font Size of ggplot2 Facet Grid Labels in R (Example)

### Change Font Size of ggplot2 Plot in R (5 Examples) | Axis Text, Main Title & Legend

### Change Format of Dates in R (4 Examples)

### Change Formatting of Numbers of ggplot2 Plot Axis in R (Example)

### Change ggplot2 Color & Fill Using scale_brewer Functions & RColorBrewer Package in R

### Change Index Numbers of Data Frame Rows in R (2 Examples)

### Change Labels of ggplot2 Facet Plot in R (Example)

### Change Legend Labels of ggplot2 Plot in R (2 Examples)

### Change Legend Size in Base R Plot (2 Examples)

### Change Legend Title in ggplot2 (2 Example Codes) | Modify Text of ggplot Legends

### Change Line Width in ggplot2 Plot in R (Example)

### Change Point Size in ggplot2 Scatterplot in R (2 Examples)

### Change Position of ggplot Title in R (4 Examples) | Adjust to Center, Right-Aligned or Vertical Positioning

### Change Row Names of Data Frame or Matrix in R (4 Examples)

### Change Space & Width of Bars in ggplot2 Barplot in R (2 Examples)

### Change Spacing Between Horizontal Legend Items of ggplot2 Plot in R (Example)

### Change Spacing of Axis Tick Marks in Base R Plot (2 Examples)

### Change Y-Axis to Percentage Points in ggplot2 Barplot in R (2 Examples)

### Check Existence of Local File in R (2 Examples)

### Check if Column Exists in Data Frame in R (Example)

### Check if Number is Integer in R (3 Examples)

### Check if Object is Defined (exists in R) | 4 Examples: Vector, Variable, Function, Error

### Check if Package is Missing and Install Automatically (R Programming Example)

### Check If Two Data Frames are the Same in R (2 Examples)

### Check in R if a Directory Exists and Create if It doesn't (Programming Example)

### Chi Square Distribution in R (4 Examples) | dchisq, pchisq, qchisq & rchisq Functions

### Clear All Plots in RStudio Using R Code (Example)

### Clear Data Object from Workspace in R (3 Examples) | rm & remove Functions

### Clear R and RStudio Console (2 Examples)

### coalesce R Function of dplyr Package (2 Examples)

### Color Scatterplot Points in R (2 Examples)

### Coloring Plot by Factor in R (2 Examples)

### colSums, rowSums, colMeans & rowMeans in R | 5 Example Codes + Video

### Combine Multiple ggplot2 Legends in R (Example)

### combine R Function of dplyr Package (2 Examples)

### Combine Two Data Frames with Different Variables by Rows in R (Example)

### Combine Two ggplot2 Plots from Different Data Frames in R (Example)

### Combine Two Vectors into Data Frame or Matrix in R (2 Examples)

### Comment Out Block of Code in R (3 Examples)

### Common Main Title for Multiple Plots in Base R & ggplot2 (2 Examples)

### Compare Character Strings with Logical Operator Conditionally in R (3 Examples)

### Compare Vectors and Find Differences in R (5 Examples)

### Complete Cases in R (3 Programming Examples)

### Compute Mean of Data Frame Column in R (6 Examples)

### Compute z-score in R (2 Examples)

### Concatenate Two Matrices in R (2 Examples)

### Concatenate Vector of Character Strings in R (2 Examples) | How to Combine Text Cases

### Conditionally Remove Row from Data Frame in R (3 Examples) | How to Delete Rows

### Continuous Uniform Distribution in R (4 Examples) | dunif, punif, qunif & runif Functions

### Control Line Color & Type in ggplot2 Plot Legend in R (Example)

### Control Point Border Thickness of ggplot2 Scatterplot in R (Example)

### Control Size of ggplot2 Legend Items in R (Example) | How to Adjust Symbols

### Control the Size of the Points in a Scatterplot in R (Example)

### Convert All Character String Variables in Data Frame to Uppercase in R (Example)

### Convert Categorical Variable to Numeric in R (2 Examples)

### Convert Character Matrix to Numeric in R (Example)

### Convert Character String to Date Object in R (Example)

### Convert Character String to Variable Name in R (2 Examples)

### Convert Character to Factor in R (3 Examples)

### Convert Column Classes of Data Table in R (2 Examples)

### Convert Data Frame Column to Numeric in R (2 Examples) | Change Factor, Character & Integer

### Convert Data Frame Column to Vector in R (3 Examples)

### Convert Data Frame Columns to List Elements in R (2 Examples)

### Convert Data Frame Row to Vector in R (Example)

### Convert Data Frame Rows to List in R (Example)

### Convert Data Frame to Matrix in R (2 Examples)

### Convert Data Frame with Date Column to Time Series Object in R (Example)

### Convert data.frame to data.table in R (Example)

### Convert Date to Day of Week in R (3 Examples) | How to Find the Weekday

### Convert Date to Numeric Time Object in R (Example)

### Convert Dates to Year/Quarter Format in R (3 Examples)

### Convert Factor to Character Class in R (3 Examples) | Change Vector & Data Frame Column

### Convert Factor to Date in R (2 Examples)

### Convert Factor to Dummy Indicator Variables for Every Level in R (Example)

### Convert List of Vectors to Data Frame in R (2 Examples)

### Convert List to Lowercase or Uppercase in R (2 Examples)

### Convert List to Vector in R (2 Examples)

### Convert Logical to Dummy Vector in R (2 Examples)

### Convert Matrix to Data Frame in R (2 Examples)

### Convert Matrix to List of Column-Vectors in R (2 Examples)

### Convert Matrix to Vector in R (3 Examples)

### Convert Name of Data Object to Character String in R (Example)

### Convert Named Vector to Data Frame in R (Example)

### Convert Nested Lists to Data Frame or Matrix in R (2 Examples)

### Convert Numeric Values to Month Names & Abbreviations R (2 Examples)

### Convert Row Names into Column of Data Frame in R (Example)

### Convert Table to Data Frame in R (Example)

### Convert UNIX Timestamp to Date Object in R (2 Examples)

### Convert Values in Column into Row Names of Data Frame in R (Example)

### Convert Vector to List in R (Example)

### Convert Vector to Matrix in R (Example)

### Correlation Matrix in R (3 Examples)

### Count NA Values in R (3 Examples)

### Count Non-Zero Values in Vector & Data Frame Columns in R (2 Examples)

### Count Number of Cases within Each Group of Data Frame in R (Example) | Counting Rows

### Count Number of Characters in String in R (2 Examples)

### Count Number of List Elements in R (2 Examples)

### Count Number of Occurrences of Certain Character in String in R (2 Examples)

### Count Number of Rows by Group Using dplyr Package in R (Example)

### Count Number of Values in Range in R (Example)

### Count Number of Words in Character String in R (Example)

### Count Observations by Factor Level in R (3 Examples)

### Count TRUE Values in Logical Vector in R (2 Examples)

### Count Unique Values by Group in R (3 Examples)

### Count Unique Values in R (3 Examples) | Frequency of Vector or Column

### Create a Histogram in Base R (8 Examples) | hist Function Tutorial

### Create Categories Based On Integer & Numeric Range in R (2 Examples)

### Create Color Range Between Two Colors in R (Example)

### Create Comma Separated Vector in R (Example)

### Create Data Frame of Unequal Lengths in R (Example)

### Create Data Frame Row by Row in R (2 Examples)

### Create Data Frame where a Column is a List in R (Example)

### Create Data Frame with n Rows & m Columns in R (Example)

### Create Data Frame with Spaces in Column Names in R (Example)

### Create Distinct Color Palette in R (5 Examples)

### Create Dummy Variable in R (3 Examples)

### Create Empty Data Frame in R (2 Examples)

### Create Empty Matrix in R (Example)

### Create ggplot2 Histogram in R (7 Examples) | geom_histogram Function

### Create Heatmap in R (3 Examples) | Base R, ggplot2 & plotly Package

### Create Kernel Density Plot in R (7 Examples) | density() Function

### Create Lagged Variable by Group in R (Example)

### Create Legend in ggplot2 Plot in R (2 Examples)

### Create List of Data Frames in R (Example)

### Create List of Installed Packages in R (Example)

### Create List of Vectors in R (Example)

### Create Matrix that Only Contains Zeros in R (2 Examples)

### Create Nested List in R (2 Examples)

### Create Plot Window of Particular Size in R & RStudio (3 Examples)

### Create Random Matrix in R (Example)

### Create Sequence of Repeated Values in R (Example) | Replicate N Times

### Create Variable Name Using paste() Function in R (Example)

### Create Vector with Intervals in R (2 Examples)

### cumall, cumany & cummean R Functions of dplyr Package (3 Examples)

### cumsum R Function Explained (Example for Vector, Data Frame, by Group & Graph)

### Cumulative Frequency & Probability Table in R (2 Examples)

### cut Function in R (Example)

### data.table Package in R | Tutorial & Programming Examples

### Deal with Special Characters in Functions (2 Examples)

### DescTools Package in R | Tutorial & Programming Examples

### Detach All User-Installed Packages in R (Example)

### Determine Classes of All Data Frame Columns (2 Examples)

### Determine Memory Usage of Data Objects in R (2 Examples)

### Determine Path of Current Script in R (Example)

### diff Function in R (2 Examples) | How to Calculate the Difference in R

### Difference Between facet_grid & facet_wrap ggplot2 Functions in R (2 Examples)

### Difference Between library & require in R (2 Examples)

### Difference Between Single & Double Square Brackets in R (3 Examples)

### Difference of Global & Local Variables in R (2 Examples)

### Different Colors of Points & Lines in Base R Plot Legend (Example)

### dir R Function | 3 Example Codes

### Disable Messages when Loading a Package in R (Example)

### Disable Scientific Notation in R (2 Examples) | How to Prevent Exponential Numbers

### Display All X-Axis Labels of Barplot in R (2 Examples)

### Display Large Numbers Separated with Comma in R (2 Examples)

### Display Only Integer Values on ggplot2 Axis in R (Example)

### Display Only Values in Plot in R (2 Examples)

### dist Function in R (4 Examples) | Compute Euclidean & Manhattan Distance

### Distance Along Rhumb Line in R (Example)

### distinct R Function of dplyr Package (Example)

### Divide Each Row of Matrix & Data Frame by Vector Elements in R (2 Examples)

### Divide Legend of ggplot2 Plot in R (Example)

### Divide One Column of Data Frame Through Another in R (2 Examples)

### do.call & call Functions in R (3 Examples)

### Don't Display Data Frame Row Names in R (Example)

### Don't Display Quotes when Printing Character String to R Console (3 Examples)

### dplyr mutate Function with Logical ifelse Condition in R (2 Examples)

### dplyr Package in R | Tutorial & Programming Examples

### Draw Boxplot with Means in R (2 Examples)

### Draw Composition of Plots Using the patchwork Package in R (3 Examples)

### Draw Dates to X-Axis of Plot in R (2 Examples) | Time Series in Base R & ggplot2 Graph

### Draw ggplot2 Legend at the Bottom & with Two Rows in R (Example)

### Draw ggplot2 Legend without Plot in R (Example)

### Draw ggplot2 Plot of Data Frame Subset in R (3 Examples)

### Draw ggplot2 Plot with Lines and Points in R (Example)

### Draw ggplot2 Plot with Two Y-Axes in R (Example) | Different Scale on Each Side

### Draw Grouped Barplot in R (3 Examples)

### Draw Histogram with Logarithmic Scale in R (3 Examples)

### Draw Histogram with Percentages Instead of Frequency Counts in Base R

### Draw Legend Outside of Plot Area in Base R Graphic (Example Code)

### Draw Multiple Boxplots in One Graph in R Side-by-Side (4 Examples)

### Draw Multiple Function Curves to Same Plot in R (2 Examples)

### Draw Multiple ggplot2 Plots Side-by-Side (R Programming Example)

### Draw Multiple Graphs & Lines in Same Plot in R (Example)

### Draw Multiple lattice Plots in One Window in R (Example)

### Draw Multiple Overlaid Histograms with ggplot2 Package in R (Example)

### Draw Multiple Time Series in Same Plot in R (2 Examples)

### Draw Multiple Variables as Lines to Same ggplot2 Plot in R (2 Examples)

### Draw Plot of Function Curve in R (2 Examples)

### Draw Plot with Actual Values as Axis Ticks & Labels in R (2 Examples)

### Draw Plot with Confidence Intervals in R (2 Examples)

### Draw Plot with Two Y-Axes in R (Example)

### Draw Scatterplot with Labels in R (3 Examples) | Base R & ggplot2

### Draw Stacked Barplot in R (3 Examples)

### Draw Time Series Plot with Events Using ggplot2 Package in R (Example)

### Draw Unbalanced Grid of ggplot2 Plots in R (Example)

### Draw Vertical Line to X-Axis of Class Date in ggplot2 Plot in R (Example)

### Drop Multiple Columns from Data Frame Using dplyr Package in R (Example)

### droplevels R Example | How to Drop Factor Levels of Vector & Data Frame

### ecdf in R (Example) | Compute & Plot the Empirical Cumulative Distribution Function

### Error in model.frame.default : 'data' must be a data.frame, environment, or list

### Error: attempt to apply non-function in R (2 Examples)

### Error: Coerce List Object to Type Double in R (2 Examples)

### Error: Unexpected ',' or '=' or ')' in R (Examples) | How to Reproduce & Fix

### Estimate Linear Model with Fixed Intercept in R (2 Examples)

### Execution Pause for X Seconds in R (Example)

### Exponential Distribution in R (4 Examples) | dexp, pexp, qexp & rexp Functions

### Export CSV File without Row Names in R (Example)

### Export List to CSV or TXT File in R (2 Examples)

### Export Multiple Data Frames to Different Excel Worksheets in R (2 Examples)

### Export Nicely-Formatted Data Frame in R (2 Examples)

### Export Plot to EPS File in R (2 Examples)

### Export Plot to File Using grid.arrange Function in R (2 Examples)

### Extend Contingency Table with Proportions & Percentages in R (4 Examples)

### Extract & Count Unique Values in Each Column of Data Frame in R (2 Examples)

### Extract Certain Columns of Data Frame in R (4 Examples)

### Extract Column of dplyr Tibble in R (Example)

### Extract Data Frame Rows that do not Match Logical Condition in R (Example)

### Extract data.table Column as Vector Using Index Position in R (Example)

### Extract Day from Date in R (Example)

### Extract Default Color Palette of ggplot2 R Package (Example)

### Extract Every nth Element of a Vector in R (Example)

### Extract F-Statistic, Number of Predictor Variables/Categories & Degrees of Freedom from Linear Regression Model in R

### Extract File & Directory Name from Path in R (2 Examples)

### Extract First N Rows of Data Frame in R (3 Examples)

### Extract First or Last n Characters from String in R (3 Examples) | Get Leading & Trailing Chars

### Extract Frequency Counts from Histogram in R (Example)

### Extract Hours, Minutes & Seconds from Date & Time Object in R (Example)

### Extract Just Number from Named Numeric Vector in R (3 Examples)

### Extract Month from Date in R (Example)

### Extract Most Common Values from Vector in R (Example)

### Extract Multiple & Adjusted R-Squared from Linear Regression Model in R (2 Examples)

### Extract Names of List Elements in R (2 Examples)

### Extract Numbers from Character String Vector in R (2 Examples)

### Extract Regression Coefficients of Linear Model in R (Example)

### Extract Residuals & Sigma from Linear Regression Model in R (3 Examples)

### Extract Row from Data Frame in R (2 Examples)

### Extract Significance Stars & Levels from Linear Regression Model in R (Example)

### Extract Single Column as Data Frame in R (3 Examples)

### Extract Single Element from Data Frame in R (2 Examples)

### Extract Standard Error, t-Value & p-Value from Linear Regression Model in R (4 Examples)

### Extract Subset of Data Frame Rows Containing NA in R (2 Examples)

### Extract Substring Before or After Pattern in R (2 Examples)

### Extract Unique Values in R (3 Examples)

### Extract Values & Names from table Object in R (2 Examples)

### Extract Values from Matrix by Column & Row Names in R (3 Examples)

### Extract Year & Month from yearmon Object in R (2 Examples)

### Extract Year from Date in R (Example)

### F Distribution in R (4 Examples) | df, pf, qf & rf Functions

### filter R Function of dplyr Package (Example)

### Find & Count Exact Matches in Character String Vector in R (3 Examples)

### Find Common Elements from Multiple Vectors in R (Example)

### Find Common Rows Between Two Data Frames in R (2 Examples)

### Find Earliest & Latest Date in R (Example)

### Find Index of Element in Vector in R (2 Examples)

### Find Index of Maximum & Minimum Value of Vector & Data Frame Row in R (2 Examples)

### Find Index Position of First Non-NA Value in R (Example)

### Find Max & Min Length of Character Strings in Columns in R (4 Examples)

### Find Out Which Package Version is Loaded in R (Example Code)

### Find Position of Character in String in R (3 Examples) | Identify Location

### Find Rows in First Data Frame that are not in Second in R (Example)

### Find Transparent Equivalent of Color in R (2 Examples)

### Find Unique Combinations of All Elements from Two Vectors in R (2 Examples)

### Find Unique Values in List in R (Example)

### Find Values Contained in First Vector but not Another in R (2 Examples)

### Fit Smooth Curve to Plot of Data in R (Example)

### Fitting Polynomial Regression Model in R (3 Examples)

### Fix Aspect Ratio in ggplot2 Plot in R (2 Examples)

### Fix R Error: '\U' used without hex digits in character string starting ""C:\U"

### for-Loop in R (10 Examples) | Writing, Running & Using Loops in RStudio

### for-Loop Index in R (2 Examples)

### for-Loop Only Returns Last Value in R (2 Examples)

### for-Loop with Increments in R (Example) | Increment by Size / Step 2

### for-Loop with Range in R (Example)

### Force Plot Axes to Start at Zero in R (2 Examples)

### Force R to Show Scientific Notation (2 Examples)

### format Function in R (2 Examples)

### Format Number as Percentage in R (3 Examples) | Express Numeric Values in Percent

### Format Number of Decimal Places in R (2 Example Codes)

### Gamma Distribution in R (4 Examples) | dgamma, pgamma, qgamma & rgamma Functions

### Geometric Distribution in R (4 Examples) | dgeom, pgeom, qgeom & rgeom Functions

### Geometric Mean in R (2 Examples)

### Geospatial Distance Between Two Points in R (Example)

### Get & Set Directory Path of Installed Packages Using libPaths Function in R (3 Examples)

### Get & Set Working Directory in R (3 Examples) | getwd & setwd Functions

### Get All Factor Levels of Vector & Data Frame Column in R (2 Examples)

### Get Column Index in Data Frame by Variable Name in R (2 Examples)

### Get Frequency of Elements with Certain Value in Vector (2 R Programming Examples)

### Get Last Value of Vector in R (2 Examples)

### Get Row Index Number in R (Example) | Find Indices in Data Frame

### Get Row Indices where Data Frame Column has a Particular Value in R (2 Examples)

### Get Second Lowest & Highest Value in R (2 Examples)

### Get Second Sub Entry of Every List Element in R (Example)

### Get Sum of Data Frame Column Values in R (2 Examples)

### Get Value of Data Element without Name or Index in R (3 Examples)

### Get Week Number of Date in R (2 Examples)

### GGally Package in R | Tutorial & Programming Examples

### ggplot2 Barplot with Axis Break & Zoom in R (2 Examples)

### ggplot2 Error in R: "`data` must be a data frame, or other object coercible by `fortify()`, not an integer vector"

### ggplot2 Error in R: Cannot use `+.gg()` with a single argument - new line?

### ggplot2 Error in R: Must be Data Frame not S3 Object with Class Uneval

### ggplot2 Plot in Script is not Displayed in R (Example)

### ggplot2 Plot with Transparent Background in R (2 Examples)

### ggplot2 Title & Subtitle with Different Size and Color in R (2 Examples)

### ggplot2 Warning - geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?

### glm.fit Warning Messages in R: algorithm didn't converge & probabilities 0/1

### Graphics in R (Gallery with Examples)

### grep & grepl R Functions (3 Examples) | Match One or Multiple Patterns in Character String

### Group Data Frame by Multiple Columns in R (Example)

### Group data.table by Multiple Columns in R (Example)

### Group Factor Levels in R (Example)

### Handling '+' Sign in R Prompt / RStudio Console

### Handling Errors & Warnings in R | List of Typical Messages & How to Solve

### Harmonic Mean in R (2 Examples)

### Haversine Great Circle Distance in R (Example)

### How to Add New Elements to a List in R (Example)

### How to Apply a Function to Each Element of a Matrix in R (2 Examples)

### How to Catch an integer(0) in R (2 Examples)

### How to cbind & rbind Vectors with Different Length in R (2 Examples)

### How to Combine Lists in R (2 Examples)

### How to Compute Euler's Number in R (Example)

### How to Compute Summary Statistics by Group in R (3 Examples)

### How to Convert a Character to Numeric in R

### How to Convert a Factor to Numeric in R

### How to Create a Range of Dates in R (Example)

### How to Create a Vector of Zero Length in R (Example)

### How to Create a Vector of Zeros in R (5 Examples)

### How to Create a Venn Diagram in R (8 Examples)

### How to Create an Empty Plot in R (2 Examples)

### How to Delete a File Using R (Example)

### How to Draw a Horizontal Barplot in R (2 Examples)

### How to Extract the Intercept from a Linear Regression Model in R (Example)

### How to Filter a Vector in R (Example)

### How to Fix in R: Error in file(file, "rt") : cannot open the connection

### How to Fix the R Error in stripchart.default(x1, ...) : invalid plotting method

### How to Fix the R Error: bad restore file magic number (file may be corrupted) -- no data loaded

### How to Rename a Column Name in R | 3 Examples to Change Colnames of a Data Frame

### How to Save a Data Frame in R (Example)

### How to Set Column Names within the aggregate Function in R (2 Examples)

### How to Split a Date-Time Column into Separate Variables in R (Example)

### How to Use R to Download File from Internet (Example)

### Hypergeometric Distribution in R (4 Examples) | dhyper, phyper, qhyper & rhyper Functions

### If Else Statement in R (4 Examples)

### if_else R Function of dplyr Package (2 Examples)

### Ignore Outliers in ggplot2 Boxplot in R (Example)

### Import & Merge Multiple csv Files in R (Example)

### Import Text File as Single Character String in R (Example)

### Increase Font Size in Base R Plot (5 Examples)

### Increase Space Between ggplot2 Facet Plot Panels in R (Example)

### Increase Y-Axis Scale of Barplot in R (2 Examples)

### Index Element of List in R (3 Examples)

### Indexing Up to the End of Vector & Data Frame in R (2 Examples)

### Insert Character Pattern at Particular Position of String in R (2 Examples)

### Insert New Column Between Two Data Frame Variables in R (2 Examples)

### Insert Rows for Missing Dates in R (Example)

### Integrate Function in R (Example) | Using integrate() to Compute Integral

### Introduction to ggpattern Package in R (6 Examples) | ggplot2 Plots with Textures

### Introduction to ggvenn Package in R (4 Examples)

### Introduction to the pacman Package in R (3 Examples)

### Introduction to the patchwork Package in R (Example Codes)

### Inverse of Matrix in R (Example)

### IQR Function in R (2 Examples) | How to Compute the Interquartile Range

### Join Data Frames with the R dplyr Package (9 Examples)

### Keep Original Row Order when Merging Data (Example)

### Keep Unused Factor Levels in ggplot2 Barplot in R (Example)

### Law of Cosines Great Circle Distance in R (Example)

### layout Function in R (3 Examples) | Arrange Grid of Plots in Base R

### lead & lag R Functions of dplyr Package (2 Examples)

### Left-Align Text in ggplot2 Plot in R (Example)

### List All Column Names But One in R (2 Examples)

### List All Files with Specific Extension in R (Example) | list.files Function

### List Error in R - attempt to select less than one element in get1index real

### List of Useful R Packages

### Load Multiple Packages at Once in R (Example)

### Locate & Extract Regular Expression Match in R (2 Examples)

### log Function in R (5 Examples) | Natural, Binary & Common Logarithm

### Log Normal Distribution in R (4 Examples) | dlnorm, plnorm, qlnorm & rlnorm Functions

### Logistic Distribution in R (4 Examples) | dlogis, plogis, qlogis & rlogis Functions

### Loop Through List in R (Example) | while- & for-Loop Over Lists

### Loop Through Vector in R (Example) | Run while- & for-Loops Over Vectors

### Loop with Character Vector in R (Example)

### Loop with Multiple Conditions in R (2 Examples) | while- & for-Loops

### Loops in R (Examples) | How to Write, Run & Use a Loop in RStudio

### lowess() R Smoothing Function | 2 Example Codes for Normalization by Lowess Regression

### match Function in R (4 Example Codes)

### Match Wildcard Pattern and Character String in R (Example)

### Matrix Multiplication Error in R: non-conformable arguments (2 Examples)

### matrixStats Package in R | Tutorial & Programming Examples

### Mean by Group in R (2 Examples) | dplyr Package vs. Base R

### mean Function in R (4 Examples)

### Meaning of $ Operator in R (2 Examples)

### Measuring Execution Time of Function in R (Example Code)

### Median Absolute Deviation in R (Example) | mad Function Explained

### Median in R (5 Examples)

### Meeus Great Circle Distance in R (Example)

### Merge Data Frames by Column Names in R (3 Examples)

### Merge Data Frames by Row Names in R (Example)

### Merge Data Frames by Two ID Columns in R (2 Examples)

### Merge Time Series in R (Example)

### Merge Two data.table Objects in R (Example)

### Merge Two Lists in R (Example)

### Merge Two Matrices by Columns in R (2 Examples)

### Merge Two Unequal Data Frames & Replace NA with 0 in R (Example)

### message() vs. warning() vs. stop() Functions in R (4 Examples)

### Mode in R (4 Programming Examples)

### Modify Major & Minor Grid Lines of ggplot2 Plot in R (5 Examples)

### Modify Numbers with Comma as Thousand Separator in R (2 Examples)

### Move Axis Label Closer to Plot in Base R (2 Examples)

### Move Column to First Position of Data Frame in R (2 Examples)

### Move Position of Barplot Legend in R (Example)

### Move Position of ggplot2 Legend in R (4 Examples)

### Multiply Rows of Matrix by Vector in R (Example)

### mutate & transmute R Functions of dplyr Package (2 Example Codes)

### NA Omit in R | 3 Example Codes for na.omit (Data Frame, Vector & by Column)

### na_if R Function of dplyr Package (2 Examples) | Convert Value to NA

### Name Variables in for-Loop Dynamically in R (2 Examples)

### names Function in R (2 Examples)

### NaN in R Explained (Example Code) | is.nan Function, Count, Replace & Remove

### near R Function of dplyr Package (2 Examples)

### Negative Binomial Distribution in R (4 Examples) | dnbinom, pnbinom, qnbinom & rnbinom Functions

### Nested ifelse Statement in R (2 Examples)

### Nested Loop in R (2 Examples)

### Normal Distribution in R (5 Examples) | dnorm, pnorm, qnorm & rnorm Functions

### nth, first & last R Functions of dplyr Package (4 Examples)

### Number of Months Between Two Dates in R (Example)

### Numbering Rows within Groups of Data Frame in R (2 Examples)

### Obtain List of Directories in R (2 Examples) | list.dirs Function Explained

### Only Import Selected Columns of Data in R (2 Examples)

### openxlsx Package in R | Tutorial & Programming Examples

### optim Function in R (Example)

### optimize Function in R (Example) | One Dimensional Optimization

### Order Bars of ggplot2 Barchart in R (4 Examples)

### Order Data Frame by Date in R (Example)

### Order Data Frame Rows According to Vector in R (2 Examples)

### Overlay Density Plots in Base R (2 Examples)

### Overlay ggplot2 Boxplot with Line in R (Example)

### Overlay ggplot2 Density Plots in R (2 Examples)

### Overlay Histogram with Fitted Density Curve in Base R & ggplot2 Package (2 Examples)

### Overlay Normal Density Curve on Top of ggplot2 Histogram in R (Example)

### par Function in R (3 Examples)

### parse, deparse & expression Functions in R | Handle Character String & Expression

### Pass Data Frame Column Name to Function in R (Example)

### paste & paste0 R Functions (4 Examples)

### Paste Multiple Columns Together in R (2 Examples)

### Pause R Script Until Key is Pressed in R (Example)

### pivot_longer & pivot_wider Functions of tidyr Package in R (2 Examples)

### Play Sound at End of R Script (2 Examples) | beep Function

### Plot All Columns of Data Frame in R (3 Examples) | How to Draw Each Variable

### Plot Data in R (8 Examples) | plot() Function

### Plot Frequencies on Top of Stacked Bar Chart with ggplot2 in R (Example)

### Plot Line in R (8 Examples) | Create Line Graph & Chart in RStudio

### Plot Mean in ggplot2 Barplot in R (Example)

### Plot Only One Variable in ggplot2 Plot in R (2 Examples)

### Plot Only Text in R (2 Examples)

### plotrix Package in R | Tutorial & Programming Examples

### Plotting Categorical Variable with Percentage Points Instead of Counts on Y-Axis in R (2 Examples)

### plyr Package in R | Tutorial & Programming Examples

### Poisson Distribution in R (4 Examples) | dpois, ppois, qpois & rpois Functions

### Position geom_text Labels in Grouped ggplot2 Barplot in R (Example)

### print & cat Functions in R (3 Examples) | Return Data to RStudio Console

### Print Character String & Variable on Same Output Line in R (3 Examples)

### Print Character String to Newline of RStudio Console in R (Example)

### Print Entire tibble to R Console (2 Examples)

### Print First or Last Rows of Data Frame in R (4 Examples)

### Print ggplot2 Plot within for-Loop in R (Example)

### Print Output of Loop in R (Example) | Return Inside of while- & for-Loops

### Print Time with Milliseconds in R (Example)

### Probability Distributions in R (Examples) | PDF, CDF & Quantile Function

### Proportions with dplyr Package in R (Example) | Create Relative Frequency Table

### psych Package in R | Tutorial & Programming Examples

### pull R Function of dplyr Package (2 Examples)

### quantile Function in R (6 Examples)

### Quantile-Quantile Plot in R (4 Examples) | qqplot, qqnorm & qqline Functions | ggplot2 Package

### Quit & Restart Clean R Session from within R (Example)

### R abs Function (6 Example Codes) | How to Calculate an Absolute Value

### R attach Warning: The following objects are masked

### R Capitalize First Letter of Each Word in Character String (3 Examples)

### R cor Function Shows Only NA & 1 (2 Examples)

### R dplyr & plyr Error: Can't rename columns that don't exist. (2 Examples)

### R dplyr group_by & summarize Functions don't Work Properly (Example)

### R Equivalent to COUNTIF in Excel (Example)

### R Error - Multiplication requires numeric/complex matrix/vector arguments

### R Error - Undefined Columns Selected when Subsetting Data Frame

### R Error : 'names' attribute must be the same length as the vector

### R Error in apply(data) : dim(X) must have a positive length

### R Error in as.Date.numeric(X) : 'origin' must be supplied (2 Examples)

### R Error in as.POSIXlt.character : string not standard unambiguous format

### R Error in barplot.default() : 'height' must be a vector or a matrix (Example)

### R Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)

### R Error in file(file, "rt") : invalid 'description' argument (read.table & csv)

### R Error in Function: Unused Argument (2 Examples)

### R Error in hist.default : 'x' must be numeric (2 Examples)

### R Error in lm.fit(x, y, offset, singular.ok , ...) : 0 (non-NA) cases (2 Examples)

### R Error in lm.fit(x, y, offset, singular.ok, ...) : NA/NaN/Inf in 'x' (2 Examples)

### R Error in plot.window(...) : need finite 'xlim' values (2 Examples)

### R Error in read.table : more columns than column names (3 Examples)

### R Error in read.table: duplicate 'row.names' are not allowed (3 Examples)

### R Error in scan: Line 1 did not have X Elements (3 Examples)

### R Error in setwd() : cannot change working directory (2 Examples)

### R Error in solve.default() : Lapack routine dgesv: system is exactly singular

### R Error in strsplit : non-character argument (Example)

### R Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' length differ

### R Error: `n()` must only be used inside dplyr verbs. (2 Examples)

### R Error: 'R' is an unrecognized escape in character string starting ""C:R"

### R Error: $-Operator is Invalid for Atomic Vectors (Examples)

### R Error: Argument is of Length Zero (Example)

### R Error: Arguments Imply Differing Number of Rows (2 Examples)

### R Error: Cannot Allocate Vector of Size N GB (2 Examples) | How to Increase the Memory Limit

### R Error: contrasts can be applied only to factors with 2 or more levels

### R Error: Could not Find Function X (2 Examples)

### R Error: incorrect number of dimensions (2 Examples)

### R Error: incorrect number of subscripts on matrix (2 Examples)

### R Error: Invalid Graphics State (2 Examples)

### R Error: JAVA_HOME cannot be determined from the Registry (Example)

### R Error: Non-numeric Argument to Binary Operator | How to Fix (Example)

### R Error: Object of Type Closure is not Subsettable in R (2 Examples)

### R Error: Object X not Found (2 Examples)

### R Error: Package or Namespace Load Failed for ggplot2 & data.table

### R Error: plot.new has not been called yet (2 Examples)

### R Error: Replacement has X Rows, Data has Y (2 Examples)

### R Error: Subscript Out of Bounds (Example)

### R Error: unexpected '}' in Code (2 Examples)

### R Error: Unexpected else in "else" (2 Examples)

### R Error: Unexpected Input in X (2 Examples)

### R Error: Unexpected Numeric Constant in X (2 Examples)

### R Error: Unexpected SPECIAL in X (2 Examples)

### R Error: Unexpected String Constant in X (2 Examples)

### R Error: Unexpected Symbol in X (2 Examples)

### R eval Function (3 Examples) | Evaluate Expressions & Character Strings

### R File Extension (Explained) | How to Open an .r File in RStudio?

### R Find Missing Values (6 Examples for Data Frame, Column & Vector)

### R Functions List (+ Examples) | All Basic Commands of the R Programming Language

### R ggplot2 Error: Aesthetics must be either length 1 or the same as the data

### R ggplot2 Error: Continuous value supplied to discrete scale (2 Examples)

### R ggplot2 Error: Discrete Value Supplied to Continuous Scale (2 Examples)

### R ggplot2 Error: Don't know how to automatically pick scale for object type

### R ggplot2 Error: geom_point requires the following missing aesthetics: x, y

### R ggplot2 Error: Mapping should be created with `aes()` or `aes_()`.

### R ggplot2 Error: stat_count() must not be used with a y aesthetic (Example)

### R ggplot2 Warning Message - Use of data$X is discouraged. Use X instead

### R ggplot2 Warning Message: Removed rows containing missing values

### R ggplot2 Warning: Scale for 'fill' is already present - Replace existing

### R Help - Error in if (NA) { : missing value where TRUE/FALSE needed

### R Help (2 Examples) - Warning: invalid factor level, NA generated

### R How to Fix: Error in plot.new() : figure margins too large (3 Examples)

### R is.na Function Example (remove, replace, count, if else, is not NA)

### R Loop Through Data Frame Columns & Rows (4 Examples) | for-, while- & repeat-Loops

### R max and min Functions | 8 Examples: Remove NA Value, Two Vectors, Column & Row

### R merge Error in fix.by(by.y, y) : 'by' must specify a uniquely valid column

### R Merge Multiple Data Frames in List (2 Examples) | Base R vs. tidyverse

### R NA – What are <Not Available> Values?

### R outer Function | 4 Example Codes (Basic Application & User Defined)

### R pairs & ggpairs Plot Functions | 5 Example Codes (Color, Labels, Panels & by Group)

### R polygon Function | 6 Example Codes (Frequency & Density Plot)

### R predict Error in eval(predvars, data, env) : numeric 'envir' arg not of length one

### R predict() Warning message: 'newdata' had X rows but variables found have Y rows

### R pretty Function | 3 Example Codes (Interval Sequence & Set Axis Labels of Plot)

### R rbind Function Error: Names don't Match Previous Names (3 Examples)

### R Replace Last Comma of Character with &-Sign (5 Examples)

### R Replace NA with 0 (10 Examples for Data Frame, Vector & Column)

### R scan Function (5 Example Codes) | Read Text or CSV File Line by Line

### R Set Row & Column Names of Data with Unknown Dimension (Example)

### R sink Function (3 Examples) | Export R output as txt & csv File

### R substr & substring Functions | Examples: Remove, Replace, Match in String

### R sweep Function | 3 Example Codes (Matrix Operation with MARGIN & STATS)

### R transform Function (2 Example Codes) | Transformation of Data Frames

### R union Function | 3 Example Codes (Two Vectors, Data Frames & Lists)

### R unlist Function | 3 Example Codes (List of Vectors, Data Frame & String)

### R Warning Message - In Ops.factor : not meaningful for factors (Example)

### R Warning message in min & max: no non-missing arguments; returning Inf

### R Warning Message in read.table: Incomplete Final Line Found by readTableHeader

### R Warning Message: Condition Length > 1 Only First Element Will Be Used

### R Warning message: In scan(file... : embedded nul(s) found in input

### R Warning Message: NAs Introduced by Coercion (Example)

### R Warning Message: Number of items to Replace is not Multiple of Length

### R Warning: cannot remove prior installation of Package 'X'

### R.Version Function in R (Examples) | Which Version is Currently Running?

### Random Numbers in R (2 Examples) | Draw Randomly from Probability Distribution & Given Data

### Randomize Vector in R (Example) | Shuffle & Mix Elements Randomly

### Randomly Reorder Data Frame by Row and Column in R (2 Examples)

### Rank Functions of dplyr Package in R (row_number, ntile, min_rank, dense_rank, percent_rank & cume_dist)

### rbind Data Frames by Column Index in R (Example)

### rbind in R | 3 Examples (Vector, Data Frame & rbind.fill for Missing Columns)

### Read All Files in Directory & Apply Function to Each Data Frame in R (Example)

### Read All Worksheets of Excel File into List in R (Example)

### Read Fixed Width Text File in R (Example)

### Read Only Header of File in R (2 Examples)

### Read SPSS sav File into R (2 Examples)

### Read TXT File with Spaces as Delimiter in R (Example)

### Read xlsx & xls Excel File in R (6 Examples)

### reader Package in R | Tutorial & Programming Examples

### readLines, n.readLines & readline in R (6 Example Codes)

### readxl Package in R | Tutorial & Programming Examples

### recode & recode_factor R Functions of dplyr Package (2 Examples)

### Reduce Space Around Plot in R (Examples)

### Remove All Objects But One from Workspace in R (Example)

### Remove All Special Characters from String in R (2 Examples)

### Remove All White Space from Character String in R (2 Examples)

### Remove All Whitespace in Each Data Frame Column in R (2 Examples)

### Remove All-NA Columns from Data Frame in R (Example)

### Remove Axis Labels & Ticks of ggplot2 Plot (R Programming Example)

### Remove Axis Values of Plot in Base R (3 Examples)

### Remove Border of ggplot2 geom_label Text Annotation in R (Example)

### Remove Bottom N Rows from Data Frame in R (2 Examples)

### Remove Characters Before or After Point in String in R (Example)

### Remove Data Frame Columns by Name in R (6 Examples)

### Remove Duplicated Rows from Data Frame in R (Example)

### Remove Element from List in R (7 Example Codes) | How to Delete a List Component

### Remove Empty Rows of Data Frame in R (2 Examples)

### Remove First Row of Data Frame in R (Example)

### Remove Grid, Background Color, Top & Right Borders from ggplot2 Plot in R (Example)

### Remove Header from Data in R (Example)

### Remove Intercept from Regression Model in R (2 Examples)

### Remove Labels from ggplot2 Facet Plot in R (Example)

### Remove Last N Elements of Vector in R (2 Examples)

### Remove Leading and Trailing Zeros in R (5 Examples)

### Remove Legend in ggplot2 (3 Example Codes) | Delete One or All Legends

### Remove Legend Title from ggplot2 Plot in R (Example)

### Remove Multiple Columns from data.table in R (Example)

### Remove Multiple Data Objects Using rm Function in R (Example)

### Remove Multiple Values from Vector in R (Example)

### Remove NA Values from ggplot2 Plot in R (Example)

### Remove NA Values from Vector in R (2 Examples)

### Remove Newline from Character String in R (2 Examples)

### Remove Outliers from Data Set in R (Example)

### Remove Row & Column Names from Matrix in R (2 Examples)

### Remove Rows with Any Zero Value in R (Example)

### Remove Rows with NA in R Data Frame (6 Examples) | Some or All Missing

### Remove Rows with NA Using dplyr Package in R (3 Examples)

### Remove Vertical or Horizontal Gridlines in ggplot2 Plot in R (2 Examples)

### Remove Working Directory Using R (Example)

### Rename Data Object in R (2 Examples)

### Rename Files Using R (Example)

### Rename List Elements in R (2 Examples)

### Reorder Boxplot in R (2 Examples)

### Reorder Columns of Data Frame in R (4 Examples)

### Reorder Facets in ggplot2 Plot in R (Example)

### Reorder Levels of Factor without Changing Order of Values in R (Example)

### rep Function in R (3 Examples)

### Repeat Character String N Times in R (2 Examples)

### Repeat Rows of Data Frame N Times in R (2 Examples)

### repeat-Loop in R (2 Examples) | Writing & Running repeat-Statements

### Replace 0 with NA in R (Example) | Changing Zero in Data Frame & Vector

### Replace Blank by NA in R (2 Examples)

### Replace Character Value with NA in R (2 Examples)

### replace Function in R (Example)

### Replace Inf with NA in Vector & Data Frame in R (Example)

### Replace Missing Values by Column Mean in R (3 Examples)

### Replace Multiple Letters with Accents in R (Example)

### Replace NA with Last Observed Value in R (Example)

### Replace Negative Values by Zero in R (2 Examples)

### Replace Particular Value in Data Frame in R (2 Examples)

### Replace Spaces in Column Names in R (2 Examples)

### Replace Specific Characters in String in R (4 Examples)

### Replace Value of Data Frame Variable Using dplyr Package in R (Example)

### Replace Values in Data Frame Conditionally in R (4 Examples)

### Replace Values in Factor Vector or Column in R (3 Examples)

### Replace Values in Vector in R (2 Examples)

### Replace X-Axis Values in R (Example) | How to Change & Customize Ticks

### Report Missing Values in Data Frame in R (2 Examples)

### Reset par to Default Values in R (Example)

### Reshape Data Frame from Long to Wide Format in R (2 Examples)

### Reshape Data Frame from Wide to Long Format in R (2 Examples)

### Return Column Name of Largest Value for Each Row in R (Example)

### Return Data Frame Row Based On Value in Column in R (Example)

### Return Index Position of Element in Matrix Using which() Function in R (Example)

### Return Multiple Objects from User-Defined Function in R (Example)

### Return Value from R Function (3 Examples)

### rev R Function | 3 Examples (Reverse of Vector, Data Frame by Column & by Row)

### Reverse Axis Limits of Plot in Base R & ggplot2 (2 Examples)

### robustbase Package in R | Tutorial & Programming Examples

### Rotate Axis Labels of Base R Plot (3 Examples)

### Rotate ggplot2 Axis Labels in R (2 Examples)

### Round Numeric Columns of Data Frame with Character & Factor Variables in R (2 Examples)

### Round Up to Nearest 10 or 100 in R (Example)

### Rounding in R (4 Examples) | round, ceiling, floor, trunc & signif Functions

### Run Multiple Regression Models in for-Loop in R (Example)

### Run R Script within Other Scripts (2 Examples)

### sample Function in R (6 Examples)

### Sample Random Rows of Data Frame in R (2 Examples) | Select with Base R vs. dplyr Package

### sample_n & sample_frac R Functions | Sample Data with dplyr Package

### Save & Load RData Workspace Files in R (3 Examples)

### Save All Console Input & Output to File in R (Example)

### Save Plot in Data Object in Base R (Example)

### Scale Bars of Stacked Barplot to a Sum of 100 Percent in R (2 Examples)

### Scale Data to Range Between Two Values in R (4 Examples)

### Scatterplot in R (10 Examples) | Create XYplot in Base R, ggplot2 & lattice

### SDMTools Package in R | Tutorial & Programming Examples

### select & rename R Functions of dplyr Package (2 Examples)

### Select CRAN Mirror in R (2 Examples) | Manually Specify Repository

### Select Data Frame Column Using Character Vector in R (Example)

### Select Data Frame Columns by Logical Condition in R (2 Examples)

### Select Data Frame Rows based on Values in Vector in R (4 Examples)

### Select Data Frame Rows where Column Values are in Range in R (2 Examples)

### Select First Element of Nested List in R (2 Examples)

### Select First Row of Each Group in Data Frame in R (Example)

### Select Last Column of Data Frame in R (2 Examples)

### Select Multiple Elements from List in R (Example)

### Select Odd & Even Rows & Columns from Data Frame in R (4 Examples)

### Select Only Numeric Columns from Data Frame in R (Example)

### Select Random Element from List in R (Example)

### Select Row with Maximum or Minimum Value in Each Group in R (Example) | dplyr vs. data.table Packages

### Select Rows if Value in One Column is Smaller Than in Another in R (Examples)

### Select Rows with Partial String Match in R (2 Examples)

### Select Second to Last Columns of Data Frame in R (2 Examples)

### Select Subset of Data Table Columns in R (Example)

### Select Top N Highest Values by Group in R (3 Examples)

### seq Function in R (5 Examples)

### Sequence of Alphabetical Character Letters from A-Z in R (3 Examples)

### Set Area Margins of ggplot2 Plot in R (Example)

### Set Axis Breaks of ggplot2 Plot in R (3 Examples)

### Set Axis Limits in ggplot2 R Plot (3 Examples)

### Set Axis Limits of ggplot2 Facet Plot in R (4 Examples) | Using facet_wrap & scales

### Set Axis Limits of Plot in R (3 Examples)

### Set Column Names when Using cbind Function in R (2 Examples)

### Set ggplot2 Axis Limit Only on One Side in R (Example)

### Set Legend Alpha of ggplot2 Plot in R (Example)

### Set NA to Blank in R (2 Examples)

### Set Number of Bins for Histogram in R (2 Examples)

### Set Origin of ggplot2 Plot Axes to Zero in R (Example)

### Set Working Directory to Source File Location Automatically vs. Manually in RStudio (2 Examples)

### setNames vs. setnames in R (+ Examples) | stats & data.table Package

### Shapiro-Wilk Normality Test in R (Example)

### Show ggplot2 Legend at the Bottom of a Plot & Horizontally Aligned in R (Example)

### sign Function in R (Example)

### Simulate Bivariate & Multivariate Normal Distribution in R (2 Examples)

### Skip for-Loop to Next Iteration in R (Example)

### slice R Function of dplyr Package (Example)

### Solve System of Equations in R (3 Examples) | Using solve() Function

### Sort Data Frame by Multiple Columns in R (3 Examples)

### Sort Data Frame in R (4 Examples)

### Sort Matrix According to First Column in R (Example)

### Sort Variables of Data Frame by Column Names in R (2 Examples)

### Sort Vector Based on Values of Another in R (Example)

### sort, order & rank R Functions | 6 Examples: Data Table, List & by Group Column

### Specify Column Names for X & Y when Joining with dplyr Package in R (Example)

### Specify Multiple Arguments in apply Functions in R (Example)

### Specify Reference Factor Level in Linear Regression in R (Example)

### Specify Row Names when Reading a File in R (Example)

### split & unsplit Functions in R (2 Examples)

### Split Character String at Whitespace in R (2 Examples)

### Split Character String into Chunks in R (2 Examples)

### Split Code Over Multiple Lines in R (3 Examples)

### Split Data Frame in R (3 Examples) | Divide (Randomly) by Row & Column

### Split Data Frame into Custom Bins in R (Example)

### Split Data Frame into List of Data Frames Based On ID Column in R (Example)

### Split Data Frame Variable into Multiple Columns in R (3 Examples) | Separate Character String Based on Delimiter

### Split Data into Train & Test Sets in R (Example)

### Split Vector into Chunks in R (2 Examples)

### sprintf R Function (6 Example Codes)

### Square Root in R (5 Examples) | Apply sqrt Function in R Studio

### Standard Deviation in R (3 Examples) | Apply sd Function in R Studio

### Standard Error in R (2 Examples)

### Standardize Data Frame Columns in R (2 Examples) | scale Function

### stats Package in R | Tutorial & Programming Examples

### Stop for-Loop when Warnings Appear in R (Example)

### Stop Running R Code with Keyboard Shortcut (Example)

### Store Results of Loop in Data Frame in R (Example) | Save while- & for-Loops

### Store Results of Loop in List in R (Example) | Save Output of while- & for-Loops

### Store Results of Loop in Vector in R (Example) | Save Output of for-Loop in Array

### str_c R Function of stringr Package (3 Example Codes)

### str_count Function in R (stringr Package)

### str_detect Function in R (stringr Package)

### str_dup Function in R (stringr Package)

### str_extract Function in R (stringr Package)

### str_flatten Function in R (Example)

### str_length Function in R (Example)

### str_locate & str_locate_all Functions in R (2 Examples)

### str_match & str_match_all Functions in R (2 Examples)

### str_order & str_sort Functions in R (2 Examples)

### str_remove & str_remove_all Functions in R (Example)

### str_replace & str_replace_all Functions in R (2 Examples)

### str_replace_na Function in R Programming (Example)

### str_split & str_split_fixed Functions in R (2 Examples)

### str_starts & str_ends Functions in R (2 Examples)

### str_sub R Function of stringr Package (2 Examples)

### str_subset & str_which Functions in R (2 Examples)

### str_trim Function in R (Example)

### str_trunc Function in R (Example)

### str_wrap Function in R (Example)

### stringr Package in R | Tutorial & Programming Examples

### stringsAsFactors Argument of data frame Function in R (2 Examples)

### strptime & strftime in R | 5 Example Codes (How to Set Year, Day, Hour & Time Zone)

### strsplit Function in R (3 Examples) | How to Split a Character String

### Student t distribution in R (4 Examples) | dt, pt, qt & rt Functions

### Studentized Range Distribution in R (2 Examples) | ptukey & qtukey Functions

### sub & gsub R Functions (2 Examples) | Replace One or Multiple Patterns

### Subset Data Frame and Matrix by Row Names in R (2 Examples)

### Subset Data Frame Between Two Dates in R (Example)

### Subset Data Frame Rows Based On Factor Levels in R (2 Examples)

### Subset Data Frame Rows by Logical Condition in R (5 Examples)

### Substitute Data Frame Row Names by Values in Vector in R (2 Examples)

### Sum Across Multiple Rows & Columns Using dplyr Package in R (2 Examples)

### Sum by Group in R (2 Examples)

### sum Function in R (3 Examples)

### Sum of Two or Multiple Data Frame Columns in R (2 Examples)

### Summarize Multiple Columns of data.table by Group in R (Example)

### summary Function in R (3 Examples)

### Sums of Rows & Columns in Data Frame or Matrix in R (2 Examples)

### Suppress Output of Command in R (Example)

### Suppress Warnings Globally in R (Example)

### switch Statement in R (2 Examples) | How to Use the switch() Function

### Test for Equality of All Vector Elements in R (2 Examples)

### Test if Character is in String in R (2 Examples)

### Test If List Element Exists in R (3 Examples)

### Test if Vector Contains Given Element in R (Example)

### The all & any R Functions | 4 Example Codes

### The difftime R Function | 3 Examples (Return Time Difference in Days, Seconds or Weeks)

### The dim Function in R (4 Examples)

### The get Function in R (5 Examples)

### The is.null Function in R (4 Examples)

### The jitter R Function | 3 Example Codes (Basic Application & Boxplot Visualization)

### The length Function in R (3 Examples for Vector, List & String)

### The nchar R Function | 3 Examples (String, Vector & Error: nchar Requires a Character)

### The ncol Function in R (3 Examples)

### The nrow Function in R (4 Examples)

### The pmax and pmin R Functions | 3 Examples (How to Handle Warnings & NA)

### The segments R Function | 3 Example Codes

### The setdiff R Function (3 Example Codes)

### Time Difference Between Dates in Weeks, Days, Hours, Minutes & Seconds in R (5 Examples)

### tolower, toupper, casefold & chartr R Functions (3 Examples)

### top_n & top_frac R Functions of dplyr Package (2 Examples)

### Transform ggplot2 Plot Axis to log10 Scale in R (Example)

### Transparent Scatterplot Points in Base R & ggplot2 (2 Examples)

### Transpose Data Frame in R (Example) | Rotate Matrix & Table with t Function

### Trim Leading and Trailing Whitespace in R (Example for trimws Function)

### Two Functions with Same Name in Different Packages in R (Example)

### type.convert R Function (Example) | Type Conversion in R Programming

### unique Function in R (2 Examples)

### Unique Rows of Data Frame Based On Selected Columns in R (Example)

### unit Function in R (Example) | How to Create a Unit Object with the grid Package

### Unload Package without Restarting R (Example)

### Use apply Function Only for Specific Data Frame Columns in R (Example)

### Use Function in Each Row of Data Frame in R (2 Examples)

### Use of Tilde ~ in R (Example)

### Use Previous Row of data.table in R (2 Examples)

### Using hjust & vjust to Move Elements in ggplot2 Plots in R (3 Examples)

### Using tryCatch Function to Handle Errors & Warnings in R (3 Examples)

### Variance in R (3 Examples) | Apply var Function with R Studio

### Venn Diagram with Opacity in R (2 Examples)

### Venn Diagram with Proportional Size in R (2 Examples)

### Vincenty Ellipsoid Great Circle Distance in R (Example)

### Vincenty Sphere Great Circle Distance in R (Example)

### Warning in R: reached getOption("max.print") | How to Increase Limit

### Warning in R: The following objects are masked from package (Example)

### Warning Message in R: argument is not numeric or logical: returning NA

### Warning Message in R: longer object length not multiple of shorter object

### weekdays, months, quarters & julian Functions in R (4 Examples)

### Weibull Distribution in R (4 Examples) | dweibull, pweibull, qweibull & rweibull Functions

### Weighted Mean in R (5 Examples)

### Weighted Sum in R (Example)

### which Function in R (5 Examples)

### while-Loop in R (2 Examples) | Writing, Running & Using while-Statement

### Why & How to Set a Random Seed in R (Example) | set.seed Function Explained

### Wilcoxon Signedank Statistic Distribution in R (4 Examples) | dsignrank, psignrank, qsignrank & rsignrank Functions

### Wilcoxonank Sum Statistic Distribution in R (4 Examples) | dwilcox, pwilcox, qwilcox & rwilcox Functions

### with & within Functions in R (2 Examples)

### Write & Read Multiple CSV Files Using for-Loop in R (2 Examples)

### Write Data Frame to SPSS .sav File in R (Example)

### Write Data Frame without Header in R (Example)

### write Function in R (2 Examples)

### Write Lines of Text to TXT File in R (3 Examples)

### Write Model Formula with Many Variables of Data Frame in R (5 Examples)

### Write xlsx & xls in R (4 Examples) | How to Export Data from R to Excel File

### X. Prefix in Column Names when Reading Data Frame in R (Example)

### xlsx Package in R | Tutorial & Programming Examples

### Zoom into ggplot2 Plot without Removing Data in R (Example)

## The Increasing Popularity of R Programming

Since the R programming language provides features for almost all statistical tasks without any costs for the user, R is rapidly growing since its release. Let’s check some numbers…

**Graphic 1: Google Scholar Search Results for R Programming Filtered by Year**

## Reasons to Learn R

**The pros:**

+ R is free

+ R’s popularity is growing – More and more people will use it

+ Almost all statistical methods are available in R

+ New methods are implemented in add-on packages quickly

+ Algorithms for packages and functions are publicly available (transparency and reproducibility)

+ R provides a huge variety of graphical outputs

+ R is very flexible – Essentially everything can be modified for your personal needs

+ R is compatible with all operating systems (e.g. Windows, MAC, or Linux)

+ R has a huge community that is organized in forums to help each other (e.g. stackoverflow)

+ R is fun 🙂

**The cons:**

– Relatively high learning burden at the beginning (even though it’s worth it)

– No systematic validation of new packages and functions

– No company in the background that takes responsibility for errors in the code (this is especially important for public institutes)

– R is almost exclusively based on programming (no extensive drop-down menus such as in SPSS)

– R can have problems with computationally intensive tasks (only important for advanced users)

You are not sure yet, whether you should learn the R programming language? In that case, I can recommend the following video of the YouTube channel RenegadeThinking. The speaker provides you with many reasons, why it is advisable to learn R.

**Please accept YouTube cookies to play this video.** By accepting you will be accessing content from YouTube, a service provided by an external third party.

If you accept this notice, your choice will be saved and the page will refresh.

## Appendix

**Appendix 1: R code for the creation of Graphic 1**

year <- 2018:2000 # Years r_gs <- c(21600 * 2, 43300, 43100, 38100, 33200, 29800, # Google Scholar searches 28500, 25500, 22400, 19100, 15900, 12000, 8270, 5930, 3740, 2600, 1980, 1600, 1360) data <- data.frame(software = rep("R", 19), # Combine data year = year, searches = r_gs) ggplot(data) + # Create plot geom_point(aes(x = year, y = searches, color = software, shape = software)) + geom_line(aes(x = year, y = searches, color = software)) + theme(legend.title = element_blank(), legend.position = "none") + ggtitle("Google Scholar Search Results") + labs(x = "Year", y = "Search Results") + scale_y_continuous(labels = comma) |

year <- 2018:2000 # Years r_gs <- c(21600 * 2, 43300, 43100, 38100, 33200, 29800, # Google Scholar searches 28500, 25500, 22400, 19100, 15900, 12000, 8270, 5930, 3740, 2600, 1980, 1600, 1360) data <- data.frame(software = rep("R", 19), # Combine data year = year, searches = r_gs) ggplot(data) + # Create plot geom_point(aes(x = year, y = searches, color = software, shape = software)) + geom_line(aes(x = year, y = searches, color = software)) + theme(legend.title = element_blank(), legend.position = "none") + ggtitle("Google Scholar Search Results") + labs(x = "Year", y = "Search Results") + scale_y_continuous(labels = comma)

**Appendix 2: How to create the header graphic of this page**

par(mar = c(0, 0, 0, 0)) # Remove space around plot par(bg = "#1b98e0") # Set background color set.seed(10293847) # Seed N <- 100000 # Sample size x <- rnorm(N) # X variable y <- rnorm(N) + x # Correlated Y variable plot(x, y, col = "#353436", pch = 19, cex = 0.1 # Create plot , xlim = c(- 4, 4), ylim = c(- 7, 7)) text(0, 0, "R", col = "#1b98e0", cex = 12) # Write R points(0, 0, col = "#1b98e0", cex = 30, lwd = 5) # Create circles points(0, 0, col = "#1b98e0", cex = 50, lwd = 5) points(0, 0, col = "#1b98e0", cex = 70, lwd = 5) points(0, 0, col = "#1b98e0", cex = 90, lwd = 5) points(0, 0, col = "#1b98e0", cex = 110, lwd = 5) box(col="#1b98e0") # Color of box |

par(mar = c(0, 0, 0, 0)) # Remove space around plot par(bg = "#1b98e0") # Set background color set.seed(10293847) # Seed N <- 100000 # Sample size x <- rnorm(N) # X variable y <- rnorm(N) + x # Correlated Y variable plot(x, y, col = "#353436", pch = 19, cex = 0.1 # Create plot , xlim = c(- 4, 4), ylim = c(- 7, 7)) text(0, 0, "R", col = "#1b98e0", cex = 12) # Write R points(0, 0, col = "#1b98e0", cex = 30, lwd = 5) # Create circles points(0, 0, col = "#1b98e0", cex = 50, lwd = 5) points(0, 0, col = "#1b98e0", cex = 70, lwd = 5) points(0, 0, col = "#1b98e0", cex = 90, lwd = 5) points(0, 0, col = "#1b98e0",