Assignment:
R Programming
Introduction
Assignment relates to a data set containing weather information for Howick (Auckland, New Zealand) from Jan 1 2013 to Jan 9 2013.1
The data are provided in nine CSV files called "data20130101.csv" to "data20130109.csv" which are available from the Lesson 2 web site for this course. The first few lines of the first file are shown in Figure. Each row of data gives various weather-related values for a time during the day:
• The time (in 10 minute intervals).
• The temperature (degrees Celsius)
• The dewpoint (degrees Celsius)
• The humidity (percentage)
• The average wind speed (km/h)
• The peak wind gust (km/h)
• The average wind direction (degrees)
• The total rainfall (mm)
• The barometer pressure (hPa)
time,temp,dew,hum,speed,gust,dir,rain,baro
00:00,14.1,11.1,82,0,0,0,0,1021
00:10,14.2,11.4,83,0,0,0,0,1021.3
00:20,14.2,11.4,83,0,0,0,0,1021.1
00:30,13.9,11.1,83,0,0,0,0,1020.9
00:40,13.7,11,84,0,0,0,0,1020.9
...
Figure: The first few lines of the first file in the weather data set.
Obtained from https://howickweather.info/.
1. Write R code to generate 9 file names without using a for loop.
You should end up with a result that looks like this:
> files
[1] "data20130101.csv" "data20130102.csv" "data20130103.csv"
[4] "data20130104.csv" "data20130105.csv" "data20130106.csv"
[7] "data20130107.csv" "data20130108.csv" "data20130109.csv"
2. Write a for loop that reads in each file, calculates the maximum value for each file, and prints out a message for each file, as shown below:
The maximum value in file data20130101.csv is 1021.6
The maximum value in file data20130102.csv is 1019.5
The maximum value in file data20130103.csv is 1012
The maximum value in file data20130104.csv is 1012.9
The maximum value in file data20130105.csv is 1014.5
The maximum value in file data20130106.csv is 1012.9
The maximum value in file data20130107.csv is 1004.6
The maximum value in file data20130108.csv is 1011.8
The maximum value in file data20130109.csv is 1014.5
Attachment:- Data information.rar