Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

R Programming: Remove the variables 'Solar.R' and 'Wind' from airquality

R Programming: Data frame Exercise-26 with Solution

Write a R program to call the (built-in) dataset airquality. Remove the variables 'Solar.R' and 'Wind' and display the data frame.

Sample Solution :

R Programming Code :

data = airquality
print("Original data: Daily air quality measurements in New York, May to September 1973.")
print(data)
data[,c("Solar.R")]=NULL
data[,c("Wind")]=NULL
print("data.frame after removing 'Solar.R'  and 'Wind' variables:")
print(data)

Sample Output:

[1] "Original data: Daily air quality measurements in New York, May to September 1973."
    Ozone Solar.R Wind Temp Month Day
1      41     190  7.4   67     5   1
2      36     118  8.0   72     5   2
3      12     149 12.6   74     5   3
4      18     313 11.5   62     5   4
5      NA      NA 14.3   56     5   5
.........
152    18     131  8.0   76     9  29
153    20     223 11.5   68     9  30
[1] "data.frame after removing 'Solar.R'  and 'Wind' variables:"
    Ozone Temp Month Day
1      41   67     5   1
2      36   72     5   2
3      12   74     5   3
4      18   62     5   4
5      NA   56     5   5
.........
152    18   76     9  29
153    20   68     9  30                         

R Programming Code Editor:



Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: 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.

Test your Programming skills with w3resource's quiz.

What is the difficulty level of this exercise?