-2

I am creating a PCA plot from data:

label <- read.table('label_clusters.tsv')
mydata <- read.table('raw_clusters.tsv')

GP.svd = svd(mydata)
dat = data.frame("pc1"= GP.svd$u[,1],
             "pc2"= GP.svd$u[,2],
             "Data"= c(rep("my", nsamples(our.obj2)), rep("zeller",    nsamples(z.obj))))

GP.svd is a large list in the form of:

                [,97]         [,98]         [,99]        [,100]       [,101]        [,102]
  [1,] -9.616173e-02 -0.0779788701 -0.1087899396 -0.0653396699 -0.140911786 -5.064931e-02
  [2,]  1.101038e-01  0.0465664554  0.0237686772  0.1344639223  0.035536326  2.715842e-02
  [3,] -3.247248e-02  0.0295960109  0.0148926826  0.0021550661 -0.003509716 -1.887659e-02

When I run the code thus far, I get this error:

Error in data.frame(pc1 = GP.svd$u[, 1], pc2 = GP.svd$u[, 2], Data = c(rep("my",  : 
could not find function "nsamples"

I am not sure why this is happening, any help is appreciated

cncx
  • 1

1 Answers1

1

Your code cannot find the nsamples function. This means that you:

  • have to import an package that contains nsamples, or
  • write an nsamples function yourself that works correctly on our.obj2, or
  • use a different function, for example nrow if our.obj2 is a data.frame.
Roland
  • 127,288
  • 10
  • 191
  • 288
Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
  • I imported _softclassval_, though now the error says `our.obj2 not found.` Do you know why this is? Isn't that just a generic call that works on any data? – cncx Jan 07 '16 at 13:13