[R] organizing my data before doing a cluster analysis

Michael elopomorph at hotmail.com
Tue Jan 26 17:48:33 CET 2016

I have been reading the different cluster analysis methods available in R.  I have a problem getting my data in the correct format so I can use these methods.  I explain below.

I am trying to cluster different fish species to see what fish are caught with each other on a commercial fishing trips.  I gave each fish species a 1 if it was caught on a trip and a 0 if it was not.  I also have the depth where the fish were caught on each trip.  So my data looks like this:

              Depth   Species1    Species 2   Species 3
Trip A       14          1                1               0
Trip B        8           0                1               1
Trip C       22          1                0               1

I looked at the cluster analysis examples in R and they have the data in a format with variables for the columns the rows are the objects you want to be clustered.  When I transpose my data I get depth as a row.  I show an example below:

                     Trip A      Trip B      Trip C
Depth               14            8            22
Species 1           1            0             1
Species 2           1            1             0
Species 3           0            1             1

So the R cluster program will treat depth as an object that will be clustered.  I don't know how to still incorporate depth into the analysis, and also not have it be treated as an object that will be clustered.  Any help would be greatly appreciated.


	[[alternative HTML version deleted]]

More information about the R-help mailing list