R/getMaxPages.R

Defines functions getMaxPages

Documented in getMaxPages

getMaxPages <-
function ( url ) {
	# Finds the number of pages of data to ensure getGradCafeData exits.
	webpage = getURL( url )
	webpage = readLines( tc <- textConnection(webpage) ); close(tc)
	
	#defines the line of data needed to find the number of pages
	pgs= "\t\t\t\tShowing <strong>[0-9]* results</strong> over [0-9]* pages"
	max_index = grep( pgs, webpage )
	
	#return the number of data pages
	as.numeric( strsplit( webpage[max_index], " " )[[1]][5] )
}

Try the brewdata package in your browser

Any scripts or data that you put into this service are public.

brewdata documentation built on May 29, 2017, 4:28 p.m.