ropensci / neotoma

Programmatic R interface to the Neotoma Paleoecological Database.
https://docs.ropensci.org/neotoma
Other
30 stars 16 forks source link

Some mammal sites throw errors for get_download #91

Closed SimonGoring closed 10 years ago

SimonGoring commented 10 years ago

Some sites throw an error: Error in rep(NA, ncol(counts)) : invalid 'times' argument

This happens in the get.samples function in get_download, I assume it' because there's only one sample, but need to debug later. Happens for example on datasetid 4574

gavinsimpson commented 10 years ago

Haven't looked closely but could that be NCOL(), which would work with a vector as well as a matrix, instead of the lowercase version?

gavinsimpson commented 10 years ago

Having had a quick look, NCOL() could work, but several places after counts is first created you are subsetting without drop = FALSE which is probably where the real problem lies. You could fix the rep() call but things could still fail later on. Best to ensure counts stays a data frame throughout.

SimonGoring commented 10 years ago

Thanks Gavin, I figured that was the problem, I just didn't want to fix it right away so I left this up to remind me since I don't get around to playing with mammal data as much as I do with the pollen data. I think keeping counts as a dataset is the way to go.

SimonGoring commented 10 years ago

Sorry, just to comment this out. Fixed in commit c200d62, just added the drop = F just like @gavinsimpson said. Worked like a charm.