#extractWeather
#
#
extractWeather <- function(dataFile,fromColumn,toColumn){
c <- character(nrow(dataFile))
for(i in 1:nrow(dataFile)) {
tempStr <- dataFile[i,fromColumn]
if(grepl("fog$", tolower(tempStr)))
c[i] <- "Fog"
if(grepl("wind$", tolower(tempStr)))
c[i] <- "Wind"
if(grepl("rain$", tolower(tempStr)))
c[i] <- "Rain"
if(grepl("hail$", tolower(tempStr)))
c[i] <- "Hail"
if(grepl("snow$", tolower(tempStr)))
c[i] <- "Snow"
#if(nchar(c[i]) < 1)
# c[i] <- "Normal"
}
dataFile[toColumn] <- c
return(dataFile)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.