aiorazabala / qmethod

R package to analyse Q methodology data
GNU General Public License v2.0
34 stars 18 forks source link

allow two 0 columns in import.q.sorts #304

Closed maxheld83 closed 3 years ago

maxheld83 commented 8 years ago

@aiorazabala just suggested:

The import.q.sorts function to allow two central columns with zero. I see that this is not optimal from a research design point of view, but some people might do it too, and it's not strictly incorrect (plus this restriction requires to code some tweaks to convert the CSV files to the format that the function wants!)

maxheld83 commented 8 years ago

just to be clear, @aiorazabala, because I don't quite understand why people would use two central columns with zero – this is merely for because data entry is easier (b/c the column height is lower), correct?

maxheld83 commented 8 years ago

three comments:

So bottom line: I probably won't spend time doing this, but sure, why not, if people find it helpful.

aiorazabala commented 8 years ago

Hummm, I see the logic of the import.q.sorts() function.

  1. So basically, having two 0 columns wouldn't matter as long as the bottom row indicates which are the column values, Correct?
  2. if (1 == T) then the problem would occur when someone enters these Q-sorts but excludes the last line indicating column values, Correct?
aiorazabala commented 8 years ago

Here's the code snippet I used to fix this issue when using our 'faulty' data. mydata is a raw matrix like the one you read from a Q-sort csv.

  # Merge the 0 columns
  central <- (ncol(mydata-1))/2
  top.part <- matrix(data=NA, nrow=dim(mydata)[1], ncol=dim(mydata)[2]-1)
  top.part[,central] <- mydata[ ,central+1] 
  colnames(top.part) <- colnames(mydata[ ,-(central+1)])
  mydata <- rbind(top.part, mydata[ ,-(central+1)])

This could be either integrated inside the function (e.g. as an optional argument) or simply point at this snippet whenever someone has this issue.