Category: R
How to detect data type in R and change it if necessary
Here is how to detect data type in R and change it when necessary. Further data manipulations may require checking of that. For example, if you want to join two data frames, the data type of the key columns must match.
How to convert units in R like ft to m or lbs to kg
Here is a simple solution that helps to convert units in R and, in this case, feet to meters and pounds to kilograms. It is not always straightforward, and you have to do additional data transformations to get to the point where you can do the unit conversion in R.
4 ways how to create a gradient word cloud in R
If you have a gradient word cloud in R, then besides the size of each word representing results, an additional indicator is also the color. Here are 4 ways how to create that kind of word cloud in R using packages like ggplot2, quanteda, wordcloud, and wordcloud2.
How to join year, month, and day into a date in R
Here is how to join year, month, and day into a date in R if they are stored separately. There are at least two good ways how to combine them in date. In some situations, there might be only a year and month and creating a date for the first day of the month is…
How to convert string to date in R
Here is how to convert a string to a date in R. A string might contain a date for various reasons. Those reasons change the complexity of the solution. For example, you might have a date as a string after extracting date from a date-time or merging separate date components. Sometimes it might happen by…
Why as.Date function returning the wrong date in R
If you are converting a string to date, there might be a situation where function as.Date returning the wrong date in R. In that scenario, the key is to specify the format correctly.
How to create a gradient line chart in R
The gradient line chart in R is a little bit artistic approach to emphasize ups and downs or progression. A gradient line chart will be made with two directions of the color gradient using ggplot2. The first one will be vertical and the second horizontal.