Category: R
Auto-detect R data frame column data types
Here is how to auto-detect and change data types for multiple columns in R at the same time.
Multiple left joins in R
Here is a quick and easy way to perform multiple left joins in R with multiple data frames.
How to run Windows batch file from R script
For me, it worked like this, but there is also modification needed in the actual batch file. system(“cmd.exe”, input = paste(‘C:\\This\\Is\\Path\\Your.bat’)) In the batch file, I added exit command at the end because that was running in an endless loop. On the other hand, endless loops with proper timing and conditions in the batch…
How to convert accented characters to unaccented in R or Power BI
Sometimes it’s necessary to convert accented characters to non accented in R or Power BI for text analysis purposes. Accented characters might be a problem in texts with spelling mistakes and spoil the analysis.
How to concatenate text by group in R
To concatenate, you can use R base functions paste and paste0 that are almost the same. The only difference is in the separator argument. In this situation, we will use the collapse argument that will separate all the text within a group when concatenated.
How to get maximum or minimum value by each group in R
Here is a quick and easy way hot to get the maximum or minimum value within each group in R in separate columns. Let’s take a look at the data set with NA values, which makes it a little bit harder.
How to modify or create RStudio code snippets
RStudio snippets are very handy when it comes to dealing with repetitive tasks. Here is how to modify RStudio snippets or create a new one.
Cumulative sum or count in R
Here is how to calculate cumulative sum or count by using R built-in datasets.
How to fill down values in R data frame
There are at least two ways how to fill down values in R data frame columns. The fastest way is to use zoo package function na.locf that is combined with dplyr function mutate. Besides, sometimes in R, it is necessary to replace NA with 0. All of those things in this post.
How to combine numbers and find sums with R
In this post, I will explain the approach on how to combine numbers with R to find out which of them makes a certain sum. First of all, we will generate all possible number combinations from the vector or data frame column. That will give us multiple matrices. Then we will combine them in a…