Category: R
Get full path to current R script
Are you wondering where is my current R script file located and how to determine the full path? Here is how to do that in RStudio or while running in batch mode.
Execute Windows CMD command (PowerShell) from R script
Here is an example of how to execute the Windows CMD command or PowerShell from R script. You can run cmd.exe by using the system function, and input might be something that you can run in CMD.
How to use OpenWeather API in R
Here is an approach that doesn’t require a dedicated package for using OpenWeather API in R.
Left join only selected columns in R
If you want to use dplyr left join or any other type of join in R to combine information from two or multiple data frames, this post might be very helpful. Here is how to left join only selected columns in R.
NA row names in R data frame
Here is one of the ways how you can run into this problem and get NA row names in the R data frame.
Play a sound at the end of R script in Windows command line
In my post about favorite RStudio tips and tricks, I mentioned sounds that could be played during R script execution. It works great but doesn’t make a sound after running R script from the Windows command line. Here is how to do that by using PowerShell and adding additional lines in the same batch file.
dplyr error: column must have a unique name
In rare cases, the data source may contain multiple columns with the same name, and some of the next actions with dplyr functions might result in the error “column must have unique name”.
How to rename data frame columns in R
Here are multiple ways how to rename columns in R using base functionality or dplyr functions like rename and select.
R error in data.frame : undefined columns selected
For me, R error undefined columns selected appears when I try to select some of the columns to keep in the data frame. It is easy to solve. You have to search for the misspelled column name, but if there is a long list of column names, then here is how to do that quickly.