Concatenate in R programming with functions paste and paste0

There are multiple ways how to concatenate values in R programming. Functions like paste and paste0 are used for that. It is good to know the difference between them.

Split (separate) data frame column into rows by using R

When you have a data frame with a column content grouped by a delimiter, you might want to split that into rows by using R. Not so frequent activity as splitting column into multiple columns by separator.

How to add or subtract months from a date in R

If you want to add or subtract months from a date in R, it might sound simple, but some situations are worth considering. Even though the lubridate package has function months that you can use to subtract months, you might get NA in the result. That is usually the case with the last dates of… Continue reading How to add or subtract months from a date in R

Replace Inf in R

Here is how to replace Inf in R if that is necessary for your data frame. It might appear in various situations, for example, when dividing with zero. In my example in this post, I have infinity when detecting min or max values in each data frame row.

Sort text as numbers in R

Sometimes it might be useful to sort text as numbers in R. For example, if you have a month’s names and it is necessary to show them in chronological order in ggplot. Even if the content is already in the right order, it doesn’t work that way on the x-axis.

The exact number in the middle of the data series in R

Here is how to locate the number in the middle of the data series in R. If there is an odd number of values, you can easily calculate that with the median, but it is not the case if there is an even number of values. In the situation with an even number of values… Continue reading The exact number in the middle of the data series in R

Extract quarter from date in R, create a year and quarter combination

Sometimes it is necessary to extract the quarter form date in R. You can use quarters to group values in a data frame or visualization. There are multiple options to achieve desired results, and you can choose what suits the best for you.

How to get when a file is created or modified in R

Here is how to get information when the file is created or modified in R. With help of R, you can extract this and other valuable information about files.

Year and month combination in R

The year and month combination in R is possible in different ways. In my case, it is a combination in one data frame column that is logically sortable. For example, the combination in a format YYYYMM.

Replace values in the entire R data frame or range of columns

Sometimes data frames or a wide range of columns might contain values that you want to remove or replace. Here is how to replace values in the entire R data frame or range of columns.

Exit mobile version