markdly / conquestr

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

Separating data file from name of analysis #7

Closed LCisannoyed closed 6 years ago

LCisannoyed commented 6 years ago

Currently {name} is used for $title, $data, $label etc. Could we use something like data {filename}.txt; so that we can use one datafile for many subsets of analysis?

> cq_cmds $reset [1] "reset;" ` $title [1] "title {name} {title};" $data [1] "data {name}.txt;" $label [1] "label << {name}.lab;" $format [1] "format {group_resp_cols} responses {resp_cols};" $codes [1] "codes {codes};"`

markdly commented 6 years ago

Sure we should be able to do this with existing functions. I'll make a reprex for it

markdly commented 6 years ago

Here's a possible solution using existing functions. If you think this is something we'll do often let's build it in to the core functionality so you don't need to do workarounds...

library(conquestr)
my_cmds <- cqc_cmds()
my_defaults <- cqc_defaults()
my_cmds$data <- "data {customfile}.txt"
my_defaults$customfile <- "my_default_file.txt"

writeLines(unlist(cqc_syntax("example1", "1-10", my_cmds, my_defaults)))
#> reset;
#> data my_default_file.txt.txt
#> label << example1.lab;
#> format  responses 1-10;
#> model item;
#> estimate ! iter=1000, nodes=30;
#> itanal >> example1.itn;
#> show ! estimates=latent >> example1.shw;
#> export logfile >> example1.CQL;
#> put >> example1.CQS;

Created on 2018-04-20 by the reprex package (v0.2.0).

LCisannoyed commented 6 years ago

I reckon I will frequently need to do this .
I am happy to use your reprex in the interim

thanks for get me a solution so quickly

markdly commented 6 years ago

New commit to develop branch should address this issue now. If you don't want a custom filename it defaults to the current setup and uses the value of the name argument provided to cqc_syntax

markdly commented 6 years ago

This is now been merged into the master branch with https://github.com/markdly/conquestr/commit/8dae71860803cdb83d48384c7bf5b49ad2853c2e