R Programming Data frame: Exercises, Practice, Solution
R Programming Data frame [26 exercises with solution]
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
1. Write a R program to create an empty data frame.
Click me to see the sample solution
2. Write a R program to create a data frame from four given vectors.
Click me to see the sample solution
3. Write a R program to get the structure of a given data frame.
Click me to see the sample solution
4. Write a R program to get the statistical summary and nature of the data of a given data frame.
Click me to see the sample solution
5. Write a R program to extract specific column from a data frame using column name.
Click me to see the sample solution
6. Write a R program to extract first two rows from a given data frame.
Click me to see the sample solution
7. Write a R program to extract 3rd and 5th rows with 1st and 3rd columns from a given data frame.
Click me to see the sample solution
8. Write a R program to add a new column in a given data frame.
Click me to see the sample solution
9. Write a R program to add new row(s) to an existing data frame.
Click me to see the sample solution
10. Write a R program to drop column(s) by name from a given data frame.
Click me to see the sample solution
11. Write a R program to drop row(s) by number from a given data frame.
Click me to see the sample solution
12. Write a R program to sort a given data frame by multiple column(s).
Click me to see the sample solution
13. Write a R program to create inner, outer, left, right join(merge) from given two data frames.
Click me to see the sample solution
14. Write a R program to replace NA values with 3 in a given data frame.
Click me to see the sample solution
15. Write a R program to change a column name of a given data frame.
Click me to see the sample solution
16. Write a R program to change more than one column name of a given data frame.
Click me to see the sample solution
17. Write a R program to select some random rows from a given data frame.
Click me to see the sample solution
18. Write a R program to reorder an given data frame by column name.
Click me to see the sample solution
19. Write a R program to compare two data frames to find the row(s) in first data frame that are not present in second data frame.
Click me to see the sample solution
20. Write a R program to find elements which are present in two given data frames.
Click me to see the sample solution
21. Write a R program to find elements come only once that are common to both given data frames.
Click me to see the sample solution
22. Write a R program to save the information of a data frame in a file and display the information of the file.
Click me to see the sample solution
23. Write a R program to count the number of NA values in a data frame column.
Click me to see the sample solution
24. Write a R program to create a data frame using two given vectors and display the duplicated elements and unique rows of the said data frame.
Click me to see the sample solution
25. Write a R program to call the (built-in) dataset airquality. Check whether it is a data frame or not? Order the entire data frame by the first and second column.
Click me to see the sample solution
26. Write a R program to call the (built-in) dataset airquality. Remove the variables 'Solar.R' and 'Wind' and display the data frame.
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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/r-programming-exercises/dataframe/index.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics