Return to Snippet

Revision: 46873
at May 27, 2011 01:38 by crock1255


Initial Code
rm(list=ls())
setwd(/Users/jonathancoleman/Dropbox/R)
library(XML)
climate_url <- "http://www.climate-zone.com/climate/united-states/north-carolina/raleigh/" # assign URL
climate_tables <- readHTMLTable(climate_url) #Read HTML in URL
climate_tables <- climate_tables[[13]] #Extract table 13 from URL
climate_tables <- climate_tables[-1,] #Delete Row 1
names(climate_tables) <- c("Raleigh Temperature", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Annual") #Rename headers
climate_tables <- climate_tables[-15,] #remove row 15
climate_tables <- climate_tables[-10,] #remove row 10
climate_tables <- climate_tables[-6,] #remove row 6
row.names(climate_tables) <- c("Avg. Temp", "Avg. Max Temp.", "Avg. Min Temp.", "Days with Max Temp >= 90 F", "days with Min Temp Below Freezing", "Raleigh Heating and Cooling", "Heating Degree Days", "Cooling Degree Days", "Raleigh Precipitation (inches)", "Precipitation (inches)", "Days with Precipitation >= 0.01 inches", "Monthly Snowfall (inches)", "Other Raleigh Weather Indicators", "Avg Wind Speed", "Clear Days", "Partly Cloudy Days", "Cloudy Days", "Percent of Possible Sunshine", "Avg. Relative Humidity") #rename rows
climate_tables <- climate_tables[,-1] #remove column 1
as.data.frame(climate_tables) #set as data.frame
climate_tables <- rnorm(climate_tables, mean = 0) #set means equal to zero

Initial URL
Raleigh_Climate

Initial Description


Initial Title
Raleigh Climate

Initial Tags


Initial Language
R