I want to find out how many photos on Flickr have been posted per hour on a specific subject.
But it gives the total amount of pictures for all the hours per hour(see the outcome bellow the code)
Packages used (RJSONIO) and (RCurl)
downloadFlickrDataMultipleHours <- function(minHourStart, maxHourEnd, text) {
allhours <- as.list(seq(minHourStart,
maxHourEnd,
by="1 hour"))
allFlickrData <- NULL
for (thehour in allhours) {
cat("Downloading data for hour beginning", format(thehour), "...\n")
api_key <- "API_Key"
theURL <- paste0("https://api.flickr.com/services/rest/?",
"method=flickr.photos.search",
"&api_key=", api_key,
"&text=", text,
"&min_taken_date=", minHourStart,
"&max_taken_date=", maxHourEnd,
"&format=json&nojsoncallback=1")
theURL <- URLencode(theURL)
rawData <- getURL(theURL)
parsedData <- fromJSON(rawData)
total <- parsedData$photos$total
total <- as.numeric(total)
flickrDF <- data.frame(Date=thehour,
PhotoCount=total)
allFlickrData<- rbind(allFlickrData, flickrDF)
}
return(allFlickrData)
}
This is the outcome:
Date PhotoCount
1 2012-10-29 01:00:00 2995
2 2012-10-29 02:00:00 2995
3 2012-10-29 03:00:00 2995
4 2012-10-29 04:00:00 2995
How can I change the code so that it will show the amount per hour?