Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_storm_data err: could not find function "xpath_class" #68

Closed
timtrice opened this issue Jun 7, 2017 · 1 comment
Closed

get_storm_data err: could not find function "xpath_class" #68

timtrice opened this issue Jun 7, 2017 · 1 comment
Labels
Bugs Fix me, I'm broken! DON'T DELAY!!! High Priority NOW NOW NOW

Comments

@timtrice
Copy link
Contributor

timtrice commented Jun 7, 2017

Error Message

Error in do.call(method, list(parsed_selector)) : 
  could not find function "xpath_class"

Reproducible Example

al182012_fstadv <- get_storms(year = 2012, basin = "AL") %>% 
    filter(Name == "Hurricane Sandy") %>% 
    .$Link %>% 
    get_storm_data(products = "fstadv")

Traceback

56: do.call(method, list(parsed_selector))
55: .self$xpath(tree)
54: selector_to_xpath(selector, prefix)
53: FUN(X[[i]], ...)
52: lapply(X = X, FUN = FUN, ...)
51: sapply(selectors, function(selector) selector_to_xpath(selector, 
        prefix))
50: tran$css_to_xpath(sel, pref)
49: selectr::css_to_xpath(css, prefix = ".//")
48: make_selector(css, xpath)
47: xpath_search(x$node, x$doc, xpath = xpath, nsMap = ns, num_results = Inf)
46: xml_find_all.xml_node(x, make_selector(css, xpath))
45: xml2::xml_find_all(x, make_selector(css, xpath))
44: html_nodes.default(., ".center")
43: rvest::html_nodes(., ".center")
42: function_list[[i]](value)
41: freduce(value, `_function_list`)
40: `_fseq`(`_lhs`)
39: eval(expr, envir, enclos)
38: eval(quote(`_fseq`(`_lhs`)), env, env)
37: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
36: xml2::read_html(link) %>% rvest::html_nodes(".center") %>% rvest::html_nodes(".content") %>% 
        rvest::html_nodes("table") %>% rvest::html_nodes("td") %>% 
        rvest::html_children()
35: get_storm_content(link)
34: eval(expr, envir, enclos)
33: eval(lhs, parent, parent)
32: get_storm_content(link) %>% rvest::html_attr("href") %>% na.omit()
31: .f(.x[[i]], ...)
30: .Call(map_impl, environment(), ".x", ".f", "list")
29: purrr::map(valid.link, get_products)
28: eval(expr, envir, enclos)
27: eval(lhs, parent, parent)
26: purrr::map(valid.link, get_products) %>% purrr::flatten_chr()
25: get_fstadv("http://www.nhc.noaa.gov/archive/2012/SANDY.shtml?")
24: do.call(.f, c(.x, list(...)), envir = .env)
23: .f(.x[[1L]], .y[[1L]], ...)
22: .Call(map2_impl, environment(), ".x", ".y", ".f", "list")
21: map2(.f, .x, invoke, ..., .env = .env)
20: purrr::invoke_map(., .x = list(link = link))
19: function_list[[i]](value)
18: freduce(value, `_function_list`)
17: `_fseq`(`_lhs`)
16: eval(expr, envir, enclos)
15: eval(quote(`_fseq`(`_lhs`)), env, env)
14: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
13: sprintf("get_%s", x) %>% purrr::invoke_map(.x = list(link = link)) %>% 
        purrr::flatten_df()
12: .f(.x[[i]], ...)
11: .Call(map_impl, environment(), ".x", ".f", "list")
10: purrr::map(products, .f = function(x) {
        sprintf("get_%s", x) %>% purrr::invoke_map(.x = list(link = link)) %>% 
            purrr::flatten_df()
    })
9: get_storm_data(., products = "fstadv")
8: function_list[[k]](value)
7: withVisible(function_list[[k]](value))
6: freduce(value, `_function_list`)
5: `_fseq`(`_lhs`)
4: eval(expr, envir, enclos)
3: eval(quote(`_fseq`(`_lhs`)), env, env)
2: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
1: al.2012 %>% filter(Name == "Hurricane Sandy") %>% .$Link %>% 
       get_storm_data(products = "fstadv")

Session Info

R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=C              LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dplyr_0.5.0     rrricanes_0.2.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10      digest_0.6.12     withr_1.0.2       assertthat_0.2.0  R6_2.2.0          DBI_0.6-1         git2r_0.18.0     
 [8] magrittr_1.5      httr_1.2.1        stringi_1.1.5     lazyeval_0.2.0    curl_2.5          data.table_1.10.4 xml2_1.1.1       
[15] devtools_1.12.0   tools_3.3.3       selectr_0.3-1     stringr_1.2.0     purrr_0.2.2       rvest_0.3.2       memoise_1.0.0    
[22] tibble_1.3.0   
@timtrice timtrice added Bugs Fix me, I'm broken! DON'T DELAY!!! High Priority NOW NOW NOW In Progress Actively under development labels Jun 7, 2017
@timtrice
Copy link
Contributor Author

timtrice commented Jun 7, 2017

This issue is resolved in commit 653ca77. Primary issue is targeting data with css param in rvest::html_nodes() rather than using xpath param.

@timtrice timtrice closed this as completed Jun 7, 2017
@timtrice timtrice removed the In Progress Actively under development label Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugs Fix me, I'm broken! DON'T DELAY!!! High Priority NOW NOW NOW
Projects
None yet
Development

No branches or pull requests

1 participant