markdly / conquestr

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

length of key string #26

Closed LCisannoyed closed 6 years ago

LCisannoyed commented 6 years ago

I am currently working on domain based analysis and have LOTS of items in a run. eg 350+ items

current command results in a super long line `key 111111111111111111111111 etc ! 1'

can we split that key string into more manageable chunks

markdly commented 6 years ago

You can now use cqc_exact_wrap() for this.

cat(conquestr::cqc_exact_wrap("abcdef", 4))
#> abcd
#> ef

An extended example, if you're wanting to generate syntax

#devtools::install_github("markdly/conquestr")
library(tidyverse)
library(conquestr)

mykey <- "abcabcabcabcabcabc"
mydefault <- cqc_defaults()
mydefault["key"] <- mykey

# default key example
cqc_syntax("myname", resp_cols = "1-10", lookup_vals = mydefault) %>%
  unlist() %>%
  writeLines()
#> reset;
#> data myname.txt;
#> format  responses 1-10;
#> label << myname.lab;
#> key abcabcabcabcabcabc ! 1;
#> model item;
#> estimate ! iter=1000, nodes=30;
#> itanal >> myname.itn;
#> show ! estimates=latent >> myname.shw;
#> export logfile >> myname.CQL;
#> put >> myname.CQS;

# wrap key every 3 items
mydefault <- cqc_defaults()
mydefault["key"] <- cqc_exact_wrap(mykey, 3)
cqc_syntax("myname", resp_cols = "1-10", lookup_vals = mydefault) %>%
  unlist() %>%
  writeLines()
#> reset;
#> data myname.txt;
#> format  responses 1-10;
#> label << myname.lab;
#> key abc
#> abc
#> abc
#> abc
#> abc
#> abc ! 1;
#> model item;
#> estimate ! iter=1000, nodes=30;
#> itanal >> myname.itn;
#> show ! estimates=latent >> myname.shw;
#> export logfile >> myname.CQL;
#> put >> myname.CQS;

Created on 2018-05-12 by the reprex package (v0.2.0).