Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-> Create lab02_NOAA.R that reads /u1/junk/cs617/NOAA_gsod/1929/030050-99999-192

ID: 3889485 • Letter: #

Question


-> Create lab02_NOAA.R that reads /u1/junk/cs617/NOAA_gsod/1929/030050-99999-1929.op into a data frame using read.fwf. Note that /u1/junk/cs617/NOAA_gsod/*.txt describes the data. 3a) Have your program produce a file lab02_NOAA.csv that includes columns: Date, Max Temp, Min Temp, Precip The date should be displayed as "2017-12-31", and Precip should be empty if there was no precipitation that day and "y" if there was precipitation that day. The Precip data is taken from the last column. 3b) Have your program also print the number of days, first date, last date, average Min Temp, average Max temp, and percentage of days that had precipitation.

3) Create labe2_NOAA.R that reads /u1/junk/cs617/NOAA_gsod/1929/030050-99999-1929.op into a data frame using read.fwf. Note that /u1/junk/cs617/NOAA_gsod/*.txt describes the data. 3a) Have your program produce a file lab02_NOAA.csv that includes columns: Date, Max Temp, Min Temp, Precip The date should be displayed as "2017-12-31", and Precip should be empty if there was no precipitation that day and "y" if there was precipitation that day. The Precip data is taken from the last column 3b) Have your program also print the number of days, first date, last date, average Min Temp, average Max temp, and percentage of days that had precipitation.

Explanation / Answer

library(GSODR) Tbar #> Checking requested station file for availability on server. #> Starting data file processing head(Tbar) #> WBAN STNID STN_NAME CTRY STATE CALL LAT LON #> 1 99999 955510-99999 TOOWOOMBA AIRPORT AS -27.55 151.917 #> 2 99999 955510-99999 TOOWOOMBA AIRPORT AS -27.55 151.917 #> 3 99999 955510-99999 TOOWOOMBA AIRPORT AS -27.55 151.917 #> 4 99999 955510-99999 TOOWOOMBA AIRPORT AS -27.55 151.917 #> 5 99999 955510-99999 TOOWOOMBA AIRPORT AS -27.55 151.917 #> 6 99999 955510-99999 TOOWOOMBA AIRPORT AS -27.55 151.917 #> ELEV_M ELEV_M_SRTM_90m BEGIN END YEARMODA YEAR MONTH DAY YDAY #> 1 642 635 19980301 20161122 20100101 2010 01 01 1 #> 2 642 635 19980301 20161122 20100102 2010 01 02 2 #> 3 642 635 19980301 20161122 20100103 2010 01 03 3 #> 4 642 635 19980301 20161122 20100104 2010 01 04 4 #> 5 642 635 19980301 20161122 20100105 2010 01 05 5 #> 6 642 635 19980301 20161122 20100106 2010 01 06 6 #> TEMP TEMP_CNT DEWP DEWP_CNT SLP SLP_CNT STP STP_CNT VISIB VISIB_CNT #> 1 21.2 8 17.9 8 1013.4 8 942.0 8 NA 0 #> 2 23.2 8 19.4 8 1010.5 8 939.3 8 NA 0 #> 3 21.4 8 18.9 8 1012.3 8 940.9 8 14.3 6 #> 4 18.9 8 16.4 8 1015.7 8 944.1 8 23.3 4 #> 5 20.5 8 16.4 8 1015.5 8 944.0 8 NA 0 #> 6 21.9 8 18.7 8 1013.7 8 942.3 8 NA 0 #> WDSP WDSP_CNT MXSPD GUST MAX MAX_FLAG MIN MIN_FLAG PRCP PRCP_FLAG #> 1 2.2 8 6.7 NA 25.78 17.78 1.5 G #> 2 1.9 8 5.1 NA 26.50 19.11 0.3 G #> 3 3.9 8 10.3 NA 28.72 19.28 * 19.8 G #> 4 4.5 8 10.3 NA 24.11 16.89 * 1.0 G #> 5 3.9 8 10.8 NA 24.61 16.72 0.3 G #> 6 3.2 8 7.7 NA 26.78 17.50 0.0 G #> SNDP I_FOG I_RAIN_DRIZZLE I_SNOW_ICE I_HAIL I_THUNDER I_TORNADO_FUNNEL #> 1 NA 0 0 0 0 0 0 #> 2 NA 0 0 0 0 0 0 #> 3 NA 1 1 0 0 0 0 #> 4 NA 0 0 0 0 0 0 #> 5 NA 0 0 0 0 0 0 #> 6 NA 1 0 0 0 0 0 #> EA ES RH #> 1 2.1 2.5 84.0 #> 2 2.3 2.8 82.1 #> 3 2.2 2.5 88.0 #> 4 1.9 2.2 86.4 #> 5 1.9 2.4 79.2 #> 6 2.2 2.6 84.6