Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 14 of 196

How to draw concentric circles in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 846 Views

To draw concentric circles, we can use draw.circle function of plotrix package but firstly, we would need to create a blank graph with plot function as shown below.For Example, we can create three concentric circles at position X=5 and Y=5 having radius of 1, 2, and 3 by using the below command −draw.circle(5, 5, c(3, 2, 1), col=c("blue", "red", "green"))ExampleTo create three concentric circles at position X=5 and Y=5 having radius of 1, 2, and 3 add the following code to the above snippet −plot(1:10, type="n")OutputIf you execute all the above given snippets as a single program, it generates the ...

Read More

How to convert values greater than a threshold into 1 in R data frame column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 3K+ Views

To convert values greater than a threshold into 1 in R data frame column, we can follow the below steps −First of all, create a data frame.Then, use ifelse function to convert values greater than a threshold into 1.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to subset R data frame rows if at least one or more values matches?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 467 Views

To subset R data frame rows if at least one or more values matches, we can follow the below steps −First of all, create a data frame.Then, use rowSums function along with sapply function and values for match to subset the data frame rows if at least one or more values matches.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to repeat column values in R data frame by values in another column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 3K+ Views

To repeat column values in R data frame by values in another column, we can follow the below steps −First of all, create a data frame.Then, use rep function along with cbind function to repeat column values in the matrix by values in another column.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to standardize selected columns in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 3K+ Views

To standardize selected columns in R data frame, we can follow the below steps −First of all, create a data frame.Then, use scale function with subsetting to standardize selected columns.ExampleCreate the data frameLet’s create a data frame as shown below −v1

Read More

How to convert a data frame into two column data frame with values and column name as variable in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 1K+ Views

To convert a data frame into two column data frame with values and column name as variable in R, we can follow the below steps −First of all, create a data frame.Then, use stack function to convert data frame.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to extract number from string if string is in different format than normal in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 145 Views

To extract number from string if string is in different format than normal in R data frame, we can follow the below steps −First of all, create a data frame.Then, use gsub function along with as.numeric function to extract the number.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to extract number from string in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 2K+ Views

To extract number from string in R data frame, we can follow the below steps −First of all, create a data frame.Then, use gsub function to extract number from string.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to remove repeated numbers in sequence in R data frame column?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 455 Views

To remove repeated numbers in sequence in R data frame column, we can follow the below steps −First of all, create a data frame.Then, use diff function and subsetting with single square brackets to remove repeated numbers in sequence.Example 1Create the data frameLet’s create a data frame as shown below −x

Read More

How to split a factor variable into n number of variables equal to factor size with full length in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Nov-2021 464 Views

To split a factor variable into n number of variables equal to factor size with full length in R data frame, we can follow the below steps −First of all, create a data frame.Then, use mtabulate function of qdapTools package to split the factor variable.ExampleCreate the data frameLet’s create a data frame as shown below −factor

Read More
Showing 131–140 of 1,958 articles
« Prev 1 12 13 14 15 16 196 Next »
Advertisements