leifeld / dna

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

Installation Issue #245

Closed mytm1 closed 2 years ago

mytm1 commented 2 years ago

Hi there,

I have an issue with initializing the DNA on R. Just to let you know I do not have much experience in R and DNA before. So, I have been following the DNA manual file to start using this. I followed everything in the manual; however, I wasn't successful to make my functions work. Again, I have minimal experience with these, so I might be making a simple mistake too. Everything before the following steps looks normal based on user's manual.

The first type of error I receive is pasted below. I went to environments menu and added java 1.8.0_333 location there.

.jinit() .jcall("java/lang/System", "S", "getProperty", "java.version") [1] "1.8.0_333" library("rDNA") Version: 3.0.8 Date: 2022-06-16 Author: Philip Leifeld (University of Essex) Project home: github.com/leifeld/dna dna_init() Jar file downloaded from GitHub to working directory. Jar file: C:/Users/myetim1/Documents/dna-3.0.8.jar Error in dna_init() : java.lang.UnsupportedClassVersionError: dna/Dna has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Since this gives me an error about the java version. I also downloaded JDK 13.0.2 and changed the location of my java from the environments menu. This time I was able to make the connection to DNA. However, the system does not recognize the functions of DNA. Then the error becomes the following:

library("rDNA") Version: 3.0.8 Date: 2022-06-16 Author: Philip Leifeld (University of Essex) Project home: github.com/leifeld/dna dna_init() Jar file downloaded from GitHub to working directory. Jar file: C:/Users/myetim1/Documents/dna-3.0.8.jar DNA connection established. dna_gui(infile = dna_sample()) Error in dna_gui(infile = dna_sample()) : could not find function "dna_gui"

(I think I am stuck at Java since my .jinit() entry on R Studio does not give any response in both java versions.)

.jinit() .jcall("java/lang/System", "S", "getProperty", "java.version") [1] "13.0.2"

Thank you in advance!

leifeld commented 2 years ago

You need to delete the 3.0.8 jar file and instead put the version 2.0 beta 25 jar file in its place. Using packageVersion("rDNA"), make sure rDNA is also version 2. Also make sure there is no version 3 jar file under inst/ in the rDNA package directory of your local library. (You can put the version 2 jar file there if you want.) Does this work for you? If not, where are you stuck after following these instructions?

mytm1 commented 2 years ago

Thank you so much for the fast response. I will try this and let you know if I come across any issues. I have already coded my sample data on DNA 3. I believe this means I need to code it again since I cannot transfer codings from DNA 3 to DNA 2.

leifeld commented 2 years ago

Great. Please report back when successful, so I can close the issue.

I am planning to implement some of the rDNA 2 functionality in rDNA 3 until the end of next month. So depending on what you are looking for and what your time horizon is, it may be possible to just wait for a bit. Do you know yet what kinds of functions you want to use?

mytm1 commented 2 years ago

That sounds great. I believe I can wait a little bit for this.

I am not too familiar with the functions for now since this is my first attempt at this. However, The "network object" from the manual seems to be closer to what I am trying to do.

nw <- network(affil, bipartite = TRUE) colors <- as.character(t(affil)) colors[colors == "3"] <- "deepskyblue" colors[colors == "2"] <- "indianred" colors[colors == "1"] <- "#31a354" colors <- colors[colors != "0"] set.edge.attribute(nw, "color", colors) plot(nw, edge.col = get.edge.attribute(nw, "color"), vertex.col = c(rep("white", nrow(affil)), rep("black", ncol(affil))), displaylabels = TRUE, label.cex = 0.5 )

leifeld commented 2 years ago

Network objects via dna_network should be available by the end of next month. I will also aim to add data management functions like dna_getAttributes and dna_addDocument by then. More complicated analysis functions like scaling, polarization, MDS etc. probably not, though you can always implement them in a more manual way using the network matrices. OK, so in that case I suppose I can close the issue because you'll wait?

mytm1 commented 2 years ago

That sounds exciting. I will be waiting for the update. Yes, you can close the case. I am grateful for your help.

simona-sz commented 2 years ago

Hi, I am also very new to R in general and rDNA in particular and only follow the manual. I also have the problem that the rDNA functions cannot be found. My console-messages look just like the ones posted above by mytm1.

How exactly do I install the version 2 of rDNA? and how do I put the version 2.0 beta 25 jar file in the place of the 3.0.8 one?

I guess I have to substitute the "release" part in this command from the manual: _remotes::install_github("leifeld/dna/rDNA@release", INSTALLopts = "--no-multiarch") - but by what exactly?

I coded my project with the DNA 2.0beta-25 version, so there should be no troubles there. Although my aim right now is just to get acquainted with the package by using the sample file.

I would be really greatful for help and sorry if this is a total puppy question!

leifeld commented 2 years ago

Try this:

  1. If any version of rDNA is currently installed: remove.packages("rDNA")
  2. If the remotes package is not installed: install.packages("remotes")
  3. library("remotes")
  4. install_github("leifeld/dna/rDNA@v2.0-beta.25", INSTALL_opts = "--no-multiarch")
  5. Using the file manager of your operating system, go to the extdata subdirectory of the package installation directory for rDNA. In my case, for example, this is /home/philip/R/x86_64-suse-linux-gnu-library/4.2/rDNA/extdata/. Put the dna-2.0-beta25.jar file into this directory. If you don't have write access to this directory, put the jar file into the working directory returned by getwd() (in R) instead. The rDNA package will first look for the jar file in the extdata directory and then in the current working directory. Do not place the 3.0 jar file into either of the two directories. Do not use the dna_downloadJar function in rDNA because it will retrieve the 3.0 jar file, which is incompatible with the 2.0 version of rDNA.
  6. library("rDNA")
  7. dna_init()
  8. dna_connection("your_dna_database.dna")

Can you please try this and provide feedback? I might post these instructions on the landing page if they work well.

simona-sz commented 2 years ago

Yes, it works! Thank you very much!

The hint that there are different directories was very helpful for me as a total beginner, because at the first attempt the version 3 jar file was still saved in the working directory, which I did not define well in the beginning. I learned a lot :)

leifeld commented 2 years ago

Excellent, glad it worked!