R Programming Articles

Found 1,740 articles

Which is Better to Learn Machine Learning: C++, Python, or R?

Devang Delvadiya
Devang Delvadiya
Updated on 27-Mar-2026 451 Views

Machine learning (ML) is the study of computer algorithms that learn patterns from data without explicit programming. When choosing a programming language for ML, three popular options are C++, Python, and R. Each has distinct advantages depending on your goals and experience level. What is Machine Learning? Machine Learning enables computers to identify patterns and make predictions by processing large datasets. It's widely used in healthcare, finance, e-commerce, manufacturing, and transportation. Tech giants like Google, Apple, and Microsoft rely heavily on ML to enhance user experiences and optimize operations. C++ for Machine Learning C++ is a ...

Read More

What Tools Besides Python, R, and SQL are all Data Scientists Expected to Know?

Tushar Sharma
Tushar Sharma
Updated on 27-Mar-2026 346 Views

Data science is a rapidly evolving field that requires a diverse set of skills and tools to keep up with the ever-changing data landscape. While Python, R, and SQL are undoubtedly the most commonly used tools in the data science industry, there are several other essential tools and technologies that data scientists are expected to be proficient with. In this article, we'll explore some of the key additional tools that every data scientist should be familiar with. Excel Excel remains a powerful tool for data analysis and is widely used in the business world. It is particularly valuable ...

Read More

How to replace blanks in a vector with the previous element in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 256 Views

Filling of blanks is not an easy task in data analysis, especially if the vector contains numerical or integer values. Suppose we have a vector x that contains 1, , 2, 3, 4, 5 and we want to put 1 in place of blank after first value then cummax function along with seq_along function can be used as x[cummax(seq_along(x)*(x!=""))].Example1x1

Read More

How to create a vector with all dates in a particular year in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

We know that some years are leap years and some are normal years. The leap years have 366 days and the normal years have 365 days. To create a vector with all dates in a particular year we can use first date and the last date of the year by reading them with as.Date and creating a sequence with seq function. Check out the below examples to understand how it is done.Example1Creating a vector with dates in year 2020 −seq(as.Date("2020-01-01"), as.Date("2020-12-31"), by="1 day")Output[1] "2020−01−01" "2020−01−02" "2020−01−03" "2020−01−04" "2020−01−05" [6] "2020−01−06" "2020−01−07" "2020−01−08" "2020−01−09" "2020−01−10" [11] "2020−01−11" "2020−01−12" "2020−01−13" "2020−01−14" "2020−01−15" ...

Read More

How to concatenate two or more vectors in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 5K+ Views

The concatenation of vectors can be done by using combination function c. For example, if we have three vectors x, y, z then the concatenation of these vectors can be done as c(x,y,z). Also, we can concatenate different types of vectors at the same time using the same same function.Example1set.seed(999) x1

Read More

What is the difference between creating a matrix by using matrix function or as.matrix function in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 580 Views

The difference between as.matrix and matrix function is that nrow argument or ncol argument are not helpful with as.matrix function but with matrix function we can use them. Therefore, we can actual define a matrix with matrix function but if we have a data frame or data table then it can be converted to matrix by using as.matrix function.Examples of creating matrix with as.matrix and matrix functionExample1M

Read More

How to calculate mahalanobis distance in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 746 Views

The Mahalanobis distance is the relative distance between two cases and the centroid, where centroid can be thought of as an overall mean for multivariate data. We can say that the centroid is the multivariate equivalent of mean. If the mahalanobis distance is zero that means both the cases are very same and positive value of mahalanobis distance represents that the distance between the two variables is large. In R, we can use mahalanobis function to find the malanobis distance.Example1y1

Read More

How to check if a matrix is invertible or not in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 2K+ Views

If the matrix is singular then it is not invertible and if it is non−singular then it is invertible. Therefore, we can check if a matrix is singular or not. We can use is.singular.matrix function of matrixcalc for this purpose. For example, if we have a matrix called M then to check whether it is invertible or not, we can use is.singular.matrix(M).Example1Loading matrixcalc package and creating a matrix −library(matrixcalc) M1

Read More

How to print a large number of values in R without index?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 1K+ Views

Whenever we print any vector then the left-hand side of the R window shows indexing, even if we have one value in the vector the index will be there. For example, if we print a vector that has value equal to 2 then the print output will be [1] 2, here [1] represents the index. If we want to print the vector without index then cat function can be used as shown in the below examples.Example1x1

Read More

How to change the repeated row names and column names to a sequence in a matrix in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 576 Views

To change the repeated row names and column names to a sequence, we first need to read those names in a vector then set them to row names and column names with make.unique function. For example, if a matrix has row names defined as A, B, A, B, A then it can be converted into A, B, A.1, B.1, A.2.Example1M1

Read More
Showing 1–10 of 1,740 articles
« Prev 1 2 3 4 5 174 Next »
Advertisements