markheckmann / OpenRepGrid

An R package for the analysis of repertory grids
http://markheckmann.github.io/OpenRepGrid/
GNU General Public License v2.0
16 stars 7 forks source link

Strange behaviour when working with clusters #22

Open weidenfreak opened 9 years ago

weidenfreak commented 9 years ago

Hi,

I think I encountered a bug in the cluster algorithm. I have a grid like the one shown in the screenshot below:

screen shot 2015-05-10 at 12 39 02

When I plot a normal bertin everything is fine. But if a want to draw a clustered version (either with cluster or bertinCluster) one of the constructs ("trustworthy - mysterious") (no kidding...) disappears and instead the construct "passive - interactive" appears twice but one time in a converted form. screen shot 2015-05-10 at 12 54 34

If I remove the "passive - interactive" construct then the "trustworthy - mysterious" appears again and everything works as expected.

Here's a gist with the file I'm using: https://gist.github.com/weidenfreak/5b2f3c7f7fb599d4ec6c

markheckmann commented 9 years ago

Well, yes that is indeed a "mysterious" bug :smile:

markheckmann commented 9 years ago

There is a problem in the internal OpenRepGrid:::align function. I always had doubts the quick-and-dirty approach I used in it was 100% sound. But now, due to the structure of your data, I can see that it is not. Unfortunately, there is no quick fix and I need to dig into into when I have more time.

Note, that the results turn out okay, if you slightly modify one cell in the data, e.g. x[1, 1] <- 2. If you tolerate this slight change before clustering (it won't change the structure too much I suppose), this may server as a quick-and-dirty work-around.

weidenfreak commented 9 years ago

No worries! I ended up clustering my data slightly different so it doesn't influence my work. It only seems to happen in very specific cases so I thought it would be helpful to report the bug with my initial data anyway.

Thanks for looking into it so quickly!