R Date Format: How to format dates using format()

R Date Format - How to Format Dates in R

R programming language provides several functions to deal with date and time. Formatting and converting dates from one format to another is a frequent task any developer could face. The general rule of thumb for dealing with date/time in R is to use the simplest technique possible. Otherwise, it gets ugly and complex. R Date … Read more

scale in R: How to Use scale() Function

scale() Function in R - The Complete Guide

Scaling is a process to compare the data that is not measured in the same approach. Scaling is the normalization of a dataset using the mean value and standard deviation. Scaling is often used with vectors or columns of a data frame. The scaling is especially helpful in a regression analysis where the magnitude range … Read more

head in R: How to Use head() Function in R

R head() Function- How to Get First Part of R Object

If you have a large dataset to analyze, it will get tough to condense a vast dataset that has 30+ columns and have thousands of rows. To solve this problem, you can use either head() or tail() function. It gives you a snapshot of that large dataset. In this tutorial, we will see how to … Read more

Mean in R: How to Calculate Average in R

How to Calculate Average in R

The average of a number represents the middle or central value in the set of data. For example, the mode, median, or mean that calculated by dividing the sum of the values set by their count of the number. The mathematical formula for calculating the average is the following. Average in R To calculate the … Read more

str in R: How to Check Data Structure of Object in R

str() Function in R with Example

R language consists of different data types, and each data type has its unique ability. When we are working with large datasets, sometimes, we need to get an overview of the specific structure, and to solve that problem, we can use the str() function. It compactly displays the internal structure of an R object. str … Read more

How to Remove Rows in R

How to Remove Single Row or Multiple Rows in R

To understand a detailed analysis of the dataset, sometimes, we want to remove specific rows and clear the data to analyze more efficiently. This is where subsetting is essential and, in other words deleting specific rows. How to remove rows in R To remove the rows in R, use the subsetting in R. There is … Read more

summary in R: How to Use summary() Function

summary() Function in R with Example

To get a better idea of the distribution of your variables in the dataset, use the summary() function. If you need a quick survey of your dataset, you can, of course, always use the R str() function and look at the structure. summary in R The summary is a built-in R function used to produce result summaries of various … Read more

sprintf in R: How to Print Formatted String in R

sprintf() Function in R with Example

R provides the sprintf() function that provides string formatting as the same C language. Specifically, the sprintf() method is a wrapper for the C library method of the same name. sprintf in R The sprintf() is a built-in R function that returns a character vector containing the formatted combination of text and variable values. It … Read more

seq_along() Function in R: Complete Guide

seq_along() Function in R - Complete Guide

The seq() function acts like the seq_along() method except when passed a vector of length 1, in which case it works like the seq_len() method. If the input number to seq() function is length 1 then the outputs between seq() and seq_along() will be different. Let’s deep dive into seq_along() function. seq_along() function in R … Read more

seq_len in R: How to Create a Sequence from 1 to N

seq_len in R - How to Create a Sequence from 1 to N

In the past, we used the “colon sequence” notation to create sequences. for (k in 1:5) { print(paste(k)) } Output [1] “1” [1] “2” [1] “3” [1] “4” [1] “5” But there is a problem using this notation. The colon sequence notation can be dangerous as it does not correctly handle the empty sequence case. … Read more