Report function outputs in R programming

0 votes

I'm using the pcaPP package in R and i have the following code:


x  <-  rbind(rmvnorm(200,  rep(0,  6),  diag(c(5,  rep(1,5)))),
             rmvnorm(  15,  c(0,  rep(20,  5)),  diag(rep(1,  6))))

pc  <-  PCAproj(x)

This is the documentation for the output value of the PCAproj function:

The function returns a list of class '"princomp"', i.e. a list
similar to the output of the function 'princomp'.
    sdev: the (robust) standard deviations of the principal components.

loadings: the matrix of variable loadings (i.e., a matrix whose columns 
          contain the eigen- vectors). This is of class "loadings":
          see loadings for its print method.

  center: the means that were subtracted.

   scale: the scalings applied to each variable.

   n.obs: the number of observations.

  scores: if 'scores = TRUE', the scores of the supplied data on the
          principal components.

    call: the matched call.

My question is how can I return the other outputs of PCAproj like sdev and then report those in R-studio?

Jan 14 in Data Analytics by Tyrion anex
• 8,280 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

In your case, you've stored the output in pc.

Use the interactive mode and type pc$sdev and pc$loading to see their outputs:

> pc$sdev
  Comp.1   Comp.2
2.425413 1.346727

> pc$loadings

   Comp.1 Comp.2
V1  0.972  0.153
V2 -0.201  0.447
V3        -0.130
V4        -0.211
V5         0.739
V6 -0.109  0.412

               Comp.1 Comp.2
SS loadings     1.000  1.000
Proportion Var  0.167  0.167
Cumulative Var  0.167  0.333
answered Jan 14 by Sophie may
• 9,050 points

Related Questions In Data Analytics

0 votes
1 answer

R function for finding the index of an element in a vector?

Yes, we can find the index of ...READ MORE

answered Apr 13, 2018 in Data Analytics by zombie
• 3,690 points
0 votes
1 answer

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
0 votes
1 answer

Why should I use set.seed function() in R?

set.seed(seed) Set the seed of R‘s random number ...READ MORE

answered Apr 23, 2018 in Data Analytics by zombie
• 3,690 points
0 votes
1 answer

Python equivalent to replace function in R

There is actually a replace function in ...READ MORE

answered May 30, 2018 in Data Analytics by Bharani
• 4,550 points
+1 vote
2 answers
0 votes
1 answer

R programming logic

Use gsub to match the substring that we want ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,000 points
0 votes
1 answer
+4 votes
2 answers
0 votes
1 answer

Can we have an if loop inside a for loop in R programming?

You're If loop doesn't have any condition ...READ MORE

answered Dec 21, 2018 in Data Analytics by Sophie may
• 9,050 points
0 votes
1 answer

R Programming error in 'fert'

You're using a factor: fert <- factor(c(50,20,10,10,20,50)) levels(fert) #[1] ...READ MORE

answered Dec 27, 2018 in Data Analytics by Sophie may
• 9,050 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.