Config Router

  • Google Sheets
  • CCNA Online training
    • CCNA
  • CISCO Lab Guides
    • CCNA Security Lab Manual With Solutions
    • CCNP Route Lab Manual with Solutions
    • CCNP Switch Lab Manual with Solutions
  • Juniper
  • Linux
  • DevOps Tutorials
  • Python Array
You are here: Home / Error: Incorrect number of dimensions in R

Error: Incorrect number of dimensions in R

October 8, 2021 by James Palmer

Elle, try this if you want to exclude the records with NA.
library(psych)
data <- sat.act[complete.cases(sat.act), ] prcomp(data) Standard deviations: [1] 146.8300134 68.2543504 9.5430803 3.6666452 1.1715551 0.4647055 Rotation: PC1 PC2 PC3 PC4 PC5 gender 0.0003401435 -0.0012020541 0.0010970565 0.005788342 -0.0591625722 education -0.0004299901 -0.0002918314 -0.0850528466 0.024064095 -0.9943380906 age 0.0027020833 0.0014188342 -0.9929359565 -0.084983862 0.0824906340 ACT -0.0208448308 0.0016963799 -0.0827031922 0.995852246 0.0314096125 SATV -0.6956211490 -0.7182796666 -0.0017374908 -0.013494765 0.0003648618 SATQ -0.7181010432 0.6957498829 0.0003989952 -0.016166443 -0.0003874180 PC6 gender -0.9982301944 education 0.0589781669 age -0.0064738244 ACT 0.0038129483 SATV 0.0005261265 SATQ -0.0011528452 Or if you want to force NA to 0 data <- sat.act data[is.na(data)] <- 0 prcomp(data) Standard deviations: [1] 159.4488983 85.1587086 9.5463091 3.7961644 1.1814762 0.4653497 Rotation: PC1 PC2 PC3 PC4 PC5 gender 0.0003915730 -7.364935e-04 0.0008193646 0.002717142 -0.0591610356 education -0.0004932616 -9.314099e-05 -0.0837084272 0.019199014 -0.9945610838 age 0.0012746540 4.606768e-03 -0.9933615141 -0.080624581 0.0817016560 ACT -0.0172578373 -1.064616e-02 -0.0788111515 0.996345023 0.0259420620 SATV -0.5500283967 -8.349310e-01 -0.0030404778 -0.018696325 0.0002655931 SATQ -0.8349664116 5.502319e-01 0.0021652104 -0.008410428 -0.0000266278 PC6 gender -0.9982440693 education 0.0589261882 age -0.0058797665 ACT 0.0011109106 SATV 0.0003311219 SATQ -0.0007530176 I got the same error, that is, an incorrect number of dimensions. I created the matrix as below and I had given the dimension dim as c(x,x,x) ary <- array(seq(from=-98, to=100, by=4), dim= c(5,5,1)) While accessing it as below, it threw the "incorrect number of dimensions" error ary[1,] &ary[,1] & ary[1,1] then I recreated the matrix again as below and I gave the dimension dim as c(x,x) ary <- array(seq(from=-98, to=100, by=4), dim= c(5,5)) Now the error is gone and we can access the array as usual

Related

Filed Under: Uncategorized

Recent Posts

  • How do I give user access to Jenkins?
  • What is docker volume command?
  • What is the date format in Unix?
  • What is the difference between ARG and ENV Docker?
  • What is rsync command Linux?
  • How to Add Music to Snapchat 2021 Android? | How to Search, Add, Share Songs on Snapchat Story?
  • How to Enable Snapchat Notifications for Android & iPhone? | Steps to Turn on Snapchat Bitmoji Notification
  • Easy Methods to Fix Snapchat Camera Not Working Black Screen Issue | Reasons & Troubleshooting Tips to Solve Snapchat Camera Problems
  • Detailed Procedure for How to Update Snapchat on iOS 14 for Free
  • What is Snapchat Spotlight Feature? How to Make a Spotlight on Snapchat?
  • Snapchat Hack Tutorial 2021: Can I hack a Snapchat Account without them knowing?

Copyright © 2025 · News Pro Theme on Genesis Framework · WordPress · Log in