If you want row-wise conversion, you need to use byrows=T with your matrix() function.
On Friday, April 3, 2020 at 9:46:17 AM UTC-7, lxiao63 wrote: > > Hello all, > > I am using the showPC function in Morpho package to restore landmark > coordinates from PC scores. > > I checked the source code for showPC function, which is shown below: > > [image: Snipaste_2020-04-04_00-22-55.png] > > > predPC is obtained by multiplying the eigenvector PC and PC scores scores. > The PC contains loadings of x1, y1, x2, y2,..., which are landmark > coordinates. Thus for a dataset with 3 2-dimensional landmarks, predPC > should be in the following format: > > [image: Snipaste_2020-04-04_00-30-20.png] > > > Thus when it is converted to matrix through matrix(predPC, dims[1], > dim2[2]), where dims[1] is the number of rows (3 in this case) and > dims[2] is the number of columns (2 in this case), the resulting matrix > would be like: > > [image: Snipaste_2020-04-04_00-30-30.png] > > This is not what we want. We want x1 and y1 to be in the same row (same > for x2/y2 and x3/y3). Therefore, it seems t(matrix(predPC, dims[2], > dims[1])) would do the trick. > > > Similar to my thinking, in the paper "Multivariate Comparison of Variance > in R" by Mitteroecker, the following function was used to calculated > coordinates from PC scores: > > [image: Snipaste_2020-04-04_00-42-34.png] > > transpose of the matrix was performed before converting 2D arrarys to 3D > arrays using arrayspecs. > > > I am not sure if my thinking went wrong somewhere or there is indeed the > need to update source code for showPC. Any ideas? > > > Best regards, > > Patrick Lv > > > > > > > > -- You received this message because you are subscribed to the Google Groups "Morphmet" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/morphmet2/dd8dc0db-5681-413f-aa6b-36b687bf151f%40googlegroups.com.
