[R] Download daily weather data

James Muller james.s.muller at gmail.com
Thu Feb 26 21:56:44 CET 2009


Thomas,

Have a look at the source code for the webpage (ctrl-u in firefox,
don't know in internet explorer, etc.). That is what you'd have to
parse in order to get the forecast from this page. Typically when I
parse webpages such as this I use regular expressions to do so (and I
would never downplay the usefulness of regular expressions, but they
take a little getting used to). There are two parts to the task: find
patterns that allow you to pull out the datum/data you're after; and
then write a program to pull it/them out. Also, of course, download
the webpage (but that's no issue).

I bet you'd be able to find a comma separated value (CSV) file
containing the weather report somewhere, which would probably involve
a little less labor in order to produce your automatic wardrobe
advice.

James



On Thu, Feb 26, 2009 at 3:47 PM, Thomas Levine <thomas.levine at gmail.com> wrote:
> I'm writing a program that will tell me whether I should wear a coat,
> so I'd like to be able to download daily weather forecasts and daily
> reports of recent past weather conditions.
>
> The NOAA has very promising tabular forecasts
> (http://forecast.weather.gov/MapClick.php?CityName=Ithaca&state=NY&site=BGM&textField1=42.4422&textField2=-76.5002&e=0&FcstType=digital),
> but I can't figure out how to import them.
>
> Someone must have needed to do this before. Suggestions?
>
> Thomas Levine!
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list