etc5523-2020 / exercise2C

For students to submit their reproducible example in the issue
0 stars 0 forks source link

HELP! what is wrong with this matrix multiplication? #29

Open yliu0320 opened 4 years ago

yliu0320 commented 4 years ago

Hi, I have generated two matrixses and want to do this matrix multiplication, but it does not work! Thanks for your help!

set.seed(123)
A = matrix(sample(100,15), nrow=5, ncol=3)
set.seed(234)
B = matrix(sample(100,15), nrow=5, ncol=3)
A %*% B
#> Error in A %*% B: non-conformable arguments

Created on 2020-08-13 by the reprex package (v0.3.0)

Session info ``` r sessionInfo() #> R version 4.0.2 (2020-06-22) #> Platform: x86_64-w64-mingw32/x64 (64-bit) #> Running under: Windows 10 x64 (build 18362) #> #> Matrix products: default #> #> locale: #> [1] LC_COLLATE=Chinese (Simplified)_China.936 #> [2] LC_CTYPE=Chinese (Simplified)_China.936 #> [3] LC_MONETARY=Chinese (Simplified)_China.936 #> [4] LC_NUMERIC=C #> [5] LC_TIME=Chinese (Simplified)_China.936 #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> loaded via a namespace (and not attached): #> [1] compiler_4.0.2 magrittr_1.5 tools_4.0.2 htmltools_0.5.0 #> [5] yaml_2.2.1 stringi_1.4.6 rmarkdown_2.3 highr_0.8 #> [9] knitr_1.29 stringr_1.4.0 xfun_0.16 digest_0.6.25 #> [13] rlang_0.4.7 evaluate_0.14 ```