I am trying to plot my biological data values against their unifrac distances in R. However, I got an error that the classes of data were different, and thats why I subsequently had errors with my plot, so I converted both to matrices, but am still getting errors when I run this:
unifrac.melt <- melt(as.matrix(unifrac.w))
unifrac.melt <- t(unifrac.melt)
fi.melt <- melt(as.matrix(data$fi)) #convert to dataframe
fi.melt <- t(fi.melt)
class(fiber.melt)
plot(fi.melt ~ unifrac.melt)
Error in xy.coords(x, y, xlabel, ylabel, log): 'x' and 'y' lengths differ
If anyone has suggestions please let me know!
How fi.melt appears:
row.names   V1          V2          V3  
1   Var1    1.00000     2.000000    3.000000
2   Var2    1.00000     1.000000    1.000000    
3   value   10.43247    8.837031    7.093047
How unifrac.melt appears:
row.names   V1          V2          V3  
1   Var1    30841102    49812105    26402102    
2   Var2    X30841102   X30841102   X30841102   
3   value   0.00000000  0.50184564  ....
The data appears as such, where it has 152 observations for 13 variables:
 row.names  BSequence   Sequence    Fi  FiCategory  Wg  WgCategory  V   VCategory   Fr  FrCategory  TVs An  Description
 1  30841102    CGATGCTGTAGATCGC    CTGTCTCTTATACACATCT 10.432465   Low 3.289473    Low 164.952225  Low 0.000000    None    222.952225  Yes NA
 2  49812105    TAATGAGCTAACCTCT    CTGTCTCTTATACACATCT 8.837031    Low 0.254120    Low 85.095326   Low 0.275000    Low 90.720326   No  NA
 3  26402102    TCCTGTTCTATCCTCT    CTGTCTCTTATACACATCT 7.093047    Low 2.619711    Low 96.203285   Low 0.000000    None    114.703285  No  NA
So, for reproducibility,
the original data comes as:
  envd <- matrix(rexp(2000, rate=.1), nrow=3, ncol=1976)
"fi" is the 3rd column of envd
unifrac.melt is like:
  unifracd <- matrix(rexp(30000, rate=.1), nrow= 3, ncol= 23104)
