How to create reproducible R data frame from existing one

Short answer – create a reproducible R data frame with function dput. Dput will give you a good reproducible piece of code that you can use for examples.

Extract text based on match of multiple possible strings in R

Sometimes there are multiple possible strings that you can locate in text. If you would like to extract text in R based on the first match of multiple strings, this post is for you.

ifelse and NA problem in R

If your data frame contains NA values, then the R function ifelse might return results you don’t desire. Missing values might be a problem for ifelse. The first victory is that you are aware of that.

Replace R data frame column values conditionally

Here are multiple examples of how to replace R data frame values conditionally. Sometimes it is a specific value like NA, but sometimes exact columns, where you want to do the replacement.

Check if a column has a missing values (NA) in R

Here are easy ways how to check if an R data frame column has missing values (NA). It might impact results by using R functions like ifelse, and it is good to know where the NA values might cause a problem.

Last or first date of the month in R

Here is probably the easiest way how to get the last or first date of the month that might be helpful in further calculations in R. You will need a lubridate package.

Remove or replace unwanted characters in R

In a messy text might be a lot of characters that you don’t want to export to CSV or text files. That might cause a problem in loading them properly. Characters like tab, line breaks, or carriage returns. Here is how to remove or replace characters in R.

Exit mobile version