use match() instead of which() to deal with the case where there are no matches.
Check to see if pPDF is a data frame with rows and columns, rather than checking to see if the first element is NA.
Not necessary
Wording
attempt to make the vignette compilable