Category: R
Start every string with a capital letter in R
If you want to start every string with a capital letter in R, you should know a reliable function that works in every situation. Same as the PROPER function in Excel. Of course, it is possible to write your R functions, but sometimes it is not worth the effort.
Extract date from datetime in R
Here are a couple of examples on how to extract date from datetime in R – with the results class of Date or POSIXct. If you have a large dataset, then here is my favorite solution at this moment with the function fastPOSIXct from the fasttime package that can extract date as POSIXct.
Count unique values in column by using R
Here is the easy method of how to calculate the count of unique values in one or multiple columns by using R.
Remove duplicates and keep last in R
Here is how to remove duplicates but keep the last row in the R data frame.
Remove all objects except one or few in R
Sometimes you need an almost fresh start, and, in that case, here is how to remove all objects except one or few in R.
How to get top or bottom values by each group in R
It is easy to return top or bottom values by a group with functions slice_min and slice_max from dplyr in R. If you can’t find those functions, then you have to update dplyr.
How to categorize numbers in R
Here is my approach on how to categorize numbers by user-defined groups with R. When you have a few predictable groups, you can use the ifelse function. But sometimes, there is a long list of numbers that are changing over time.
How to automatically download files from SharePoint
Here is an example of how to automatically download files from SharePoint Online by using PowerShell. By knowing how to run PowerShell script from the Windows command line (CMD) you can also build a workaround to download files during R or Python script execution.
How to automatically upload files to SharePoint
Here is an example of how to automatically upload files to SharePoint Online by using PowerShell. By knowing how to run PowerShell script from the Windows command line (CMD) you can also build a workaround to upload files during R or Python script execution.