Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 103 of 196

How to convert first letter of multiple string columns into capital in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 15-Nov-2021 296 Views

To convert first letter of multiple string columns into capital in R data frame, we can follow the below steps −First of all, create a data frame with string columns.Then, use sub function along with mutate_each function of dplyr package to convert first letter into capital in string columns.ExampleCreate the data frameLet’s create a data frame as shown below −Names

Read More

How to find the index of values in an R data frame column if they occur once?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 15-Nov-2021 201 Views

To find the index of values in an R data frame column if they occur once, we can follow the below steps −First of all, create a data frame.Then, use which function along with duplicated function and single square brackets for subsetting to find the index of values in a column if they occur once.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to create a column with column name for maximum value in each row of an R data frame?

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

To create a column with column name for maximum value in each row of an R data frame, we can follow the below steps −First of all, create a data frame.Then, use mutate function of dplyr package along with max.col function to create a column with column name for maximum value in each row of an R data frame.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to find the row variance of columns having same name in data.table object in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 15-Nov-2021 207 Views

To find the row variance of columns having same name in data.table object in R, we can follow the below steps −First of all, create a data.table object with some columns having same name.Then, use tapply along with colnames and var function to find the row variance of columns having same name.ExampleCreate the data.table objectLet’s create a data.table object as shown below −library(data.table) DT

Read More

How to find the row mean of columns having same name in R data frame?

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

To find the row mean of columns having same name in R data frame, we can follow the below steps −First of all, create a data frame with some columns having same name.Then, use tapply along with colnames and mean function to find the row mean of columns having same name.ExampleCreate the data frameLet’s create a data frame as shown below −df

Read More

How to find the sin of each value in columns if some columns are categorical in R data frame?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 15-Nov-2021 314 Views

To find the sin of each value in columns if some columns are categorical in R data frame, we can follow the below steps −First of all, create a data frame.Then, use numcolwise function from plyr package to find the sin of each value in columns if some columns are categorical.ExampleCreate the data frameLet’s create a data frame as shown below −Level

Read More

How to remove hyphen at last position from every value in R data frame column?

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

To remove hyphen at last position from every value in R data frame column, we can follow the below steps −First of all, create a data frame with a column having hyphen at last position in every value.Then, use gsub function to remove hyphen at last position from every value in the column.ExampleCreate the data frameLet’s create a data frame as shown below −x

Read More

How to remove a particular value from a vector in R?

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

To remove a particular value from a vector, we can use negation of value.For example, if we have a vector called V that contains repetitive values starting from 1 to 10 and if we want to remove all 10s from V then we can use the command given below −V

Read More

How to find rows in an R data frame that do not have missing values?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 554 Views

Dealing with missing values is one of the most critical task in data analysis. If we have a large amount of data then it is better to remove the rows that contains missing values. For the removal of such rows we can use complete.cases function.For example, if we have a data frame called df that contains some missing values then we can remove the rows with missing values using the below given command −df[complete.cases(df),]Example 1Following snippet creates a sample data frame −x1

Read More

How to highlight a value with underline in base R plot?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 12-Nov-2021 900 Views

To highlight a value with underline in base R plot, we can use underline function within text function. The text function will be used to define the value that we need to underline in the plot and underline function will only underline that part.Check out the below given example to understand how it works.ExampleTo highlight a value with underline in base R plot, use the code given below −plot(1:5)OutputIf you execute the above given code, it generates the following output −To highlight a value with underline in base R plot, add the following code to the above code −plot(1:5) text(4, ...

Read More
Showing 1021–1030 of 1,958 articles
« Prev 1 101 102 103 104 105 196 Next »
Advertisements