hrbrmstr/Rforecastio — pull request #5 by dlebauer (2014-11-20 03:49:59+00:00)
Title: Return solar data from forecast.io

This is an experimental feature. I am not familiar with json and have been having trouble getting the solar radiation into the dataframe (because it is a list rather than numeric like other values returned). But this is a start (albiet a hacky one):

```r
hourly <- lapply(fio$hourly$data, unlist)
solar <- lapply(hourly, function(x) x[grepl("solar", names(x))])
solar.df <- suppressWarnings(do.call("rbind", sapply(solar, function(x) if(length(x) > 0){as.numeric(x)}else{rep(0,5)})))

colnames(solar.df) <- c("azimuth", "altitude", "dni", "ghi", "dhi", "etr")
lapply(fio$hourly$data, function(x) ifelse(!is.null(x$solar), x$solar, x$solar))
```