w3resource

R Programming Factors: Exercises, Practice, Solution

[An editor is available at the bottom of the page to write and execute the scripts.]

R Programming Factors [7 exercises with solution]

1. Write a R program to find the levels of factor of a given vector. Go to the editor
Click me to see the sample solution

2. Write a R program to change the first level of a factor with another level of a given factor. Go to the editor
Click me to see the sample solution

3. Write a R program to create an ordered factor from data consisting of the names of months. Go to the editor
Click me to see the sample solution

4. Write a R program to concatenate two given factor in a single factor. Go to the editor
Click me to see the sample solution

5. Write a R program to convert a given pH levels of soil to an ordered factor. Go to the editor
Click me to see the sample solution

6. Write a R program to extract the five of the levels of factor created from a random sample from the LETTERS (Part of the base R distribution.) Go to the editor
Click me to see the sample solution

7. Write a R program to create a factor corresponding to height of women data set, which contains height and weights for a sample of women. Go to the editor
Click me to see the sample solution

R Programming Code Editor:



More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.