leifeld / dna

Discourse Network Analyzer (DNA)
126 stars 41 forks source link

cannot create a network data from a matrix using network function #264

Closed kemorkemor closed 3 weeks ago

kemorkemor commented 1 year ago

I'm using rDNA(3.0.9) package on R in order to control dna-3.0.9.jar.

When I try to create network data using sample.dna file according to dna-manual-3(pp.83-4) under the windows 10 circumstances, I got the following error. I would appreciate if somebody could help me with a solution.

congruence <- dna_network(networkType = "onemode", statementType = "DNA Statement", variable1 = "organization", variable2 = "concept", qualifier = "agreement", qualifierAggregation = "congruence", duplicates = "document") congruence

nw <- network(congruence)


following comes out:

Error in as.network.matrix(x, directed = directed, hyper = hyper, loops = loops, : the dimensions of the matrix argument (7 by 7) do not match the network size indicated by the attached n attribute (22), perhaps matrix.type argument is not correct

Thank you in advance.

leifeld commented 1 year ago

Where did you find a manual for version 3? I think we only have one for version 2 at the moment.

I think the problem may arise because in version 3 of rDNA, networks are saved as matrices with some additional attributes and a new class label for one- or two-mode network matrices. When you try statnet's as.network function, this function expects a matrix, not a DNA network matrix. You can cast the object into a matrix using as.matrix before you hand it over to as.network.

Can you try it and let me know if this fixes your problem?

The documentation hasn't kept up with the development, unfortunately, but I will try to rectify this some time later this year.

kemorkemor commented 1 year ago

Thank you for your comment. I am a new-bee and was perplexed when I used rDNA after having created and coded my DNA data with ver.3.09. Now I have carefully read your instructions and found out the issue.

I have fixed my problem with statnet's as.network function. Thank you very much for your advice!