ajdamico / asdfree

analyze survey data for free
http://asdfree.com/
GNU General Public License v3.0
612 stars 449 forks source link

get_catalog 'subscript out of bounds' error #359

Closed sjgenco closed 10 months ago

sjgenco commented 3 years ago

I see this issue came up once a few years ago with regard to a different db (https://github.com/ajdamico/asdfree/issues/301#issue-267172582) I'm getting it today with the ANES data catalog.

Here's my session: Per your 'Preliminaries' page I installed these packages:

install.packages( "devtools" , repos = "http://cran.rstudio.com/" ) 
install.packages( "convey" , repos = "http://cran.rstudio.com/" ) 
install.packages( "srvyr" , repos = "http://cran.rstudio.com/" )  
library(devtools)
install_github( "ajdamico/lodown" , dependencies = TRUE )  

Output:

Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Skipping install of 'lodown' from a github remote, the SHA1 (4be675fa) has not changed since last install.
  Use `force = TRUE` to force installation

Then I loaded these libraries:

library(lodown)
library(convey)
library(survey)
library(srvyr)
#library()$results[,1]   #uncomment this to get a list of all libraries loaded

Uncommenting the last line showed all the necessary libraries were loaded. Then I ran the get_catalog command, copied from your site:

anes_cat <-
    get_catalog( "anes", output_dir = file.path( path.expand( "~" ), "ANES" ), your_email = "me@myemail.com" )

Output:

building catalog for anes

Error in FUN(X[[i]], ...): subscript out of bounds
Traceback:

1. get_catalog("anes", output_dir = file.path(path.expand("~"), 
 .     "ANES"), your_email = "sjgenco@gmail.com")
2. cat_fun(data_name = data_name, output_dir = output_dir, ...)
3. stringr::str_trim(sapply(strsplit(rvest::html_text(rvest::html_nodes(z, 
 .     "article")), "\\r\\n"), "[[", 2))
4. stri_trim_both(string)
5. sapply(strsplit(rvest::html_text(rvest::html_nodes(z, "article")), 
 .     "\\r\\n"), "[[", 2)
6. lapply(X = X, FUN = FUN, ...)

Here's my environment:

ajdamico commented 3 years ago

are you able to submit a pull request to fix this? thanks!

sjgenco commented 3 years ago

I'm kind of a newbie here and not quite sure how to do that. Do I just copy this issue post over to Pull requests?

sjgenco commented 3 years ago

If I read Pull requests correctly, they are for solutions, not problems. Plus there's a whole thing with forks that I don't understand. So, in a nutshell, I haven't been able to submit a pull request. What should i do next?

asheetal commented 3 years ago

getting the same rvest error on cpsbasic dataset as well

So I used patch-1 tag of lodown, of course had to install some DB packages from github and then now gives me ftp timeout error. To me sounds like the download URL for cpsbasic changed(?). Cant be sure.

paulgronke commented 3 years ago

I encounter the same error in the console:

anes_cat <- get_catalog( "anes", output_dir = "/home/courses/pol377f20/ANES/", your_email = "gronkep@reed.edu")
building catalog for anes

Error in FUN(X[[i]], ...) : subscript out of bounds
ajdamico commented 10 months ago

hi! apologies for the long delay. i've made a couple of big updates to asdfree.com that hopefully make the website a bit better, but i've decided to stop maintaining the lodown package so probably won't fix the bug you've reported. the new asdfree does have anes data, but only for the most current year. thanks