Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 71 of 196

How to create a classification model using svm for multiple categories in R?

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

SVM is a supervised machine learning algorithm which can be used for both classification or regression challenges but mostly we use it for classification. The classification using svm can be done for two or more categories as well. In R, we can use simply use svm function of e1071 package.ExampleConsider the iris data −str(iris)Output'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 ...

Read More

How to find the table of ordered frequencies of vector elements in R?

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

We can create table of frequencies of a vector element by using table function and the ordering can be done by using sort function. If we want to order the frequencies in decreasing order then decreasing argument can be used. For example, if we have a vector x then the table of ordered frequencies can be created as sort(table(x)).Examplex1

Read More

How to remove duplicate rows and sort based on a numerical column an R data frame?

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

If we have duplicate rows in an R data frame then we can remove them by using unique function with data frame object name. And if we want to order the data frame with duplicate rows based on a numerical column then firstly unique rows should be found then order function can be used for sorting as shown in the below examples.ExampleConsider the below data frame −x1

Read More

How to replace upper triangular matrix with lower triangular matrix and vice versa in R?

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

The upper triangular matrix can be replaced with lower triangular matrix by transposing the whole matrix and extracting upper triangular matrix from it then storing it in the original matrix. For example, if we have a matrix M then upper triangular matrix of M can be replaced with lower triangular matrix by using the below code −M1[upper.tri(M1)]

Read More

How to divide row values of a numerical column based on categorical column values in an R data frame?

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

If we have a categorical column that has two or more categories and a numerical column then we might want to divide the one category numerical value from other category numerical value. This can be done by using divide sign / but we need to use the proper subset of the values.ExampleConsider the below data frame −x1

Read More

How to generate a probability density distribution from a set of observations in R?

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

The probability density distribution is the synonym of probability density function. It is a function that defines the density of a continuous random variable. In R, we can use density function to create a probability density distribution from a set of observations.Examplex1

Read More

How to set comma as decimal separator in R?

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

In European countries, a comma is used to separate the integral part of a number from the decimal part. Thus, we might want to create data or perform calculations with comma as decimal separator. In R, we can do this by just using the code options(OutDec=", "). Once we will type this in R console, all the numerical values with decimals will be printed with commas in place of dots.Exampleoptions(OutDec=", ") rnorm(10)Output[1] 0, 14421957 -0, 24152088 -0, 05215867 -0, 40577010 0, 19806357 -1, 49349808 [7] 0, 91085263 0, 43550033 2, 64009603 1, 17177332Examplernorm(50)Output[1] -0, 56186368 -2, 11404777 0, 99584461 -2, ...

Read More

How to save list where each element contains equal number of values to a text file in R?

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

If we want to save a list to a text file then first step would be converting that list to a data frame then write.table function can be used for saving. For example, if we have a list defined as LIST and it has elements each containing 50 values then we can convert it to a data frame as −LIST_df=as.data.frame(do.call(cbind,LIST))Now we can save it as −write.table(LIST_df,"LIST.txt")ExampleConsider the below list −x1

Read More

How to create a line chart using ggplot2 with larger width in R?

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

The width of the line chart can be increased by using size argument inside geom_line aesthetics of ggplot2. For example, if we have a data frame df that contains two numerical columns x and y, and we want to create a line chart between the two with larger width then it can be done as −ggplot(df)+geom_line(aes(x,y,size=2))ExampleConsider the below data frame −x

Read More

How to remove list elements by their name in R?

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

Data analysis not only includes mathematical operations, we have to spend a lot of time in data cleaning, data mining, feature engineering etc. One operation could be removing list elements by their name if they are not helpful to achieve our objective. The removal of the elements by using their names can be done with the help of which function.ExampleConsider the below list List1

Read More
Showing 701–710 of 1,958 articles
« Prev 1 69 70 71 72 73 196 Next »
Advertisements