markdly / conquestr

R package for working with ConQuest item response modelling software
Other
1 stars 0 forks source link

auto-detect number of pvs in pv file #4

Open markdly opened 6 years ago

markdly commented 6 years ago

Currently users need to specify the number of plausible values contained in a file when importing.

library(conquestr)
fname <- cq_example(display = FALSE, example_name = "ex1_10.pv") 
pv <- cq_pv(fname, np = 10)  
head(pv)
#> # A tibble: 6 x 4
#>   index val   recid field
#>   <chr> <chr> <int> <chr>
#> 1 1     10001     1 pid  
#> 2 1     3.02      1 pv1  
#> 3 2     3.16      1 pv2  
#> 4 3     2.43      1 pv3  
#> 5 4     5.34      1 pv4  
#> 6 5     2.85      1 pv5

Created on 2018-03-28 by the reprex package (v0.2.0).

It would be better if this was auto-detected on import. Or, at the very least provide a warning if the number of pvs appears to be incorrect for the file specified...