Error when using locq2 from REAT package: Error in locqs[, i] <- locq(locq_workfile_j$e_ij, sum(locq_workfile_j$e_ij),

I am using locq2 from the REAT package. I have followed the exact guidelines on how to use locq2. The link below provides instructions on how to use locq2. (locq2 function - RDocumentation))

The only difference is that I am using my own dataset. When I use locq2, I get the following error

:

“ Error in locqs[, i] <- locq(locq_workfile_j$e_ij, sum(locq_workfile_j$e_ij), : number of items to replace is not a multiple of replacement length” [See attached for Rscript used labeled “x.R”.

Below you find the reproducible example of my Rscript. Any assistance on this issue will be of great help.

  library (REAT)
  library(datapasta)
  
  
  data2<-data_locq2  #See trible below of data2 contents
  datapasta::tribble_paste(data2)
#> Error in is.data.frame(input_table): object 'data2' not found
  tibble::tribble(
~ind_code, ~region_code, ~emp_all,
   "1151",         "40",      9.5,
   "2111",         "40",    374.5,
   "2123",         "40",     59.5,
   "2131",         "40",      534,
   "2211",         "40",    374.5,
   "2212",         "40",     59.5,
   "2213",         "40",      9.5,
   "2331",         "40",     59.5,
   "2332",         "40",    174.5,
   "4461",         "80",     5344,
   "4471",         "80",     2014,
   "4481",         "80",     2132,
   "4482",         "80",      486,
   "4483",         "80",      385,
   "4511",         "80",     1072,
   "4512",         "80",      487,
   "4521",         "80",   3749.5,
   "4529",         "80",   1749.5,
   "4531",         "80",      357,
   "4532",         "80",      883,
   "4533",         "80",      361,
   "4539",         "80",      639,
   "4541",         "80",     1399,
   "4542",         "80",    374.5,
   "4543",         "80",    374.5,
   "4811",         "80",     59.5,
   "4812",         "80",     59.5,
   "4831",         "80",    174.5,
   "4832",         "80",      9.5,
   "4841",         "80",     4158
)
#> # A tibble: 30 x 3
#>    ind_code region_code emp_all
#>    <chr>    <chr>         <dbl>
#>  1 1151     40              9.5
#>  2 2111     40            374. 
#>  3 2123     40             59.5
#>  4 2131     40            534  
#>  5 2211     40            374. 
#>  6 2212     40             59.5
#>  7 2213     40              9.5
#>  8 2331     40             59.5
#>  9 2332     40            174. 
#> 10 4461     80           5344  
#> # … with 20 more rows

    #Running locq2 with data2 
  lqs <- locq2(e_ij = data2$emp_all, data2$ind_code, data2$region_code, LQ.output = "df")


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.