argument "string" is missing, with no default

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

argument "string" is missing, with no default

Shivi Bhatia-2
Hi All,

I am trying to fetch data from a pdf file with the below code but getting
the error message:
Error in stri_split_regex(string, pattern, n = n, simplify = simplify,  :
  argument "string" is missing, with no default

library(readr)library(stringr)library(magrittr)library(dplyr)
table_data <- nvsr65_05[ [ 14 ] ] %>%
  str_split(pattern = "\n") %>%
  unlist() %>%
  str_subset(pattern = "^[^…].*(\\. ){5}") %>%
  str_c(collapse = "\n") %>%
  read_table(col_names = FALSE) %>%
  mutate(X2 = str_replace_all(X2, "(\\. )*", ""),
         X5 = rep(c("Neonatal", "Postnatal"), each = 10)) %>%
  set_names(value = c("rank", "cause_of_death", "deaths", "percent", "group"))

Please advice. Thank you.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: argument "string" is missing, with no default

Duncan Murdoch-2
On 08/09/2018 9:12 AM, Shivi Bhatia wrote:

> Hi All,
>
> I am trying to fetch data from a pdf file with the below code but getting
> the error message:
> Error in stri_split_regex(string, pattern, n = n, simplify = simplify,  :
>    argument "string" is missing, with no default
>
> library(readr)library(stringr)library(magrittr)library(dplyr)
> table_data <- nvsr65_05[ [ 14 ] ] %>%
>    str_split(pattern = "\n") %>%
>    unlist() %>%
>    str_subset(pattern = "^[^…].*(\\. ){5}") %>%
>    str_c(collapse = "\n") %>%
>    read_table(col_names = FALSE) %>%
>    mutate(X2 = str_replace_all(X2, "(\\. )*", ""),
> X5 = rep(c("Neonatal", "Postnatal"), each = 10)) %>%
>    set_names(value = c("rank", "cause_of_death", "deaths", "percent", "group"))
>
> Please advice. Thank you.

Use traceback() to see which function called stri_split_regex.

Break up the long pipeline into smaller parts so you can see where the
error is comming from.

Don't post in HTML.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.