[R] R Coding Help

David L Carlson dc@r|@on @end|ng |rom t@mu@edu
Thu Mar 7 22:04:25 CET 2019


We can see a few errors in what you have given us, but not enough to solve your problem as John indicates.

Looking at your Environment window, you have a data frame "phdtext" which is displayed in the upper left window. That appears to be a symmetrical 17 x 17 matrix so it is not clear why you are trying to create another one with the as.matrix(read.table()) command. It is not working because phDMatrix is empty as is phdDist.

Your first visible error message involves trying to install package vegan without using "vegan", i.e. install.packages("vegan"). That was not fatal because you were able to use library(vegan) to load it (i.e. you had already installed vegan). 

Based on these hints, the following code MIGHT work:

phdDist <- as.dist(phdtext)
phdMDS <- metaMDS(phdDist)

----------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of John Kane
Sent: Thursday, March 7, 2019 2:20 PM
To: Aryana Nabavizadeh <anabavizadeh using ucdavis.edu>
Cc: R. Help Mailing List <r-help using r-project.org>
Subject: Re: [R] R Coding Help

Thanks for the screenshot but it is not really all that useful. We
really need the actual code and some sample data.

Have a look at
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
or  http://adv-r.had.co.nz/Reproducibility.html for some suggesitions.

Providing the sample data in dput() format is the best way to supply it.

On Thu, 7 Mar 2019 at 13:19, Aryana Nabavizadeh
<anabavizadeh using ucdavis.edu> wrote:
>
> Hello,
>  I uploaded a square matrix to R and followed the exact coding, however, the coding is incorrect. I was wondering if you could take a look at my coding to see where the issue is. Attached below is my square matrix and a screenshot of the coding on R. However, I did not add the labels to the columns and rows as I had issues with the header as I would upload the matrix (meaning that I used the file labeled phdtext.csv) . However, I also do not know if I should keep the labels or not (and instead use the file PHDfullmatrix2.csv). The point of doing this was to generate a knowledge structure graph with the words as the nodes and the distances from one-another representing the similarity of association of the two words (the shorter the distance, the more the two words were associated with one another). At the end of this, I would get the eccentricity values and was wondering if I could get help with where I went wrong. Attached below as well is the associated link that I followed with i
 nstructions.
>
> http://www.wouterspekkink.org/r/mds/gephi/2015/12/15/a-simple-example-of-mds-using-r-and-gephi.html
>
>
> Thank you,
>
> Aryana Nabavizadeh
>
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
John Kane
Kingston ON Canada

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list