
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2038 Articles for R Programming

9K+ Views
The error hist.default, 'x' must be numeric occurs when we pass a non-numerical column or vector to the hist function. If we have a non-numerical column in a data frame or a non-numerical vector and we want to create the histogram of that data can be created with the help of barplot and table function.Check out the below given Exampleto understand how it can be done.ExampleFollowing snippet creates a sample data frame −x

211 Views
To create a column of log with base 2 in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of log with base 2 in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

207 Views
To create a column of natural log in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of natural log in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

1K+ Views
To create a data frame with numerical as well as factor columns in R, we simply need to add factor function before factor columns and numerical columns will be created without mentioning any specific characteristics, the values of numerical columns just need to be numerical in nature.Example 1Following snippet creates a sample data frame df1 with factor and numerical column −Gender

136 Views
To create a column of raise to the power 3 in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of raise to the power 3 in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

177 Views
To create a column of square root in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of square root in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

2K+ Views
To randomize rows of a matrix in R, we can use sample function along with nrow function to get the random rows and then subset the matrix with single square brackets.For example, if we have a matrix called M then randomization of rows in M can be done by using the command given below − Random_rows

193 Views
To create a column of square in data frames stored in R list, we can follow the below steps −First of all, create a list of data frames.Then, use lapply function to create a column of square in data frames stored in the list.ExampleCreate the list of data framesUsing data.frame function to create data frames and list function to create the list of those data frames −df1

3K+ Views
If we have a data frame column that contains some duplicate values or represent categories then we might want to split the data frame based on that column.For example, if we have a data frame called df that contains a column say Col then we can split the data frame by Col by using the command given below −split(df,df$Col)Example 1Following snippet creates a sample data frame −Group