Nizamuddin Siddiqui has Published 2307 Articles

How to convert a data frame row into character vector in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 14:04:58

597 Views

To create a character vector in R we can enclose the vector values in double quotation marks but if we want to use a data frame row values to create a character vector then as.character function can be used. For example, if we have a data frame df then the ... Read More

How to find the position of minimum value in a vector that contains integers as strings in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 14:00:12

117 Views

If integer vector is read as strings and we want to find the position of the minimum value in that vector then we need to use as.numeric along with the vector to read it as a numeric vector then use which function for finding the position of the minimum value. ... Read More

How to extract the strings between two words in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:58:13

3K+ Views

While dealing with text data, we sometimes need to extract values between two words. These words can be close to each other, at the end sides or on random sides. If we want to extract the strings between two words then str_extract_all function of stringr package can be used.Loading stringr ... Read More

How to extract a data frame’s column value based on a column value of another data frame in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:56:08

3K+ Views

In data analysis, we encounter many problems with a lot of variations among them. One such problem is we have some information in a place that needs to be checked through a different place and these places can be data frames. Therefore, we can to find a data frame’s column ... Read More

How to create sets using vector values in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:54:34

1K+ Views

A set in mathematics is defined as the collection of unique elements and the order of the elements does not matter. In R, we can create sets using set_power function of sets package. For example, if we have a vector x that contains A, B, C then the sets using ... 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 06-Nov-2020 13:53:43

155 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 ... Read More

How to view the complete output of tibble in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:49:24

933 Views

Tibbles are created when we analyze data using dplyr package and if the data size is large then only 10 values are printed in R. If we want to display the complete output of tibble then View function needs to be used. For example, if we want to perform calculation ... Read More

How to convert 12-hour time scale to 24-hour time in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:44:26

2K+ Views

Dealing with time data is not an easy task, it is sometimes difficult even in built-in analytical softwares, thus it won’t be easy in R as well. Mostly, we record time on a 12-hour time scale but in some situations, we need 24-hour time scale. Therefore, if we want to ... Read More

How to find the row-wise index of non-NA values in a matrix in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:40:21

448 Views

A matrix can also contain missing values and those missing values can be placed in a matrix by randomization as well, hence we cannot be sure about the positions of those values that are referred to as NA and the non-missing values. If we want to find the positions of ... Read More

How to multiply a matrix columns and rows with the same matrix rows and columns in R?

Nizamuddin Siddiqui

Nizamuddin Siddiqui

Updated on 06-Nov-2020 13:33:00

2K+ Views

To multiply a rows or columns of a matrix, we need to use %*% symbol that perform the multiplication for matrices in R. If we have a matrix M with 5 rows and 5 columns then row 1 of M can be multiplied with column 1 of M using M[1, ... Read More

Advertisements