A program that asks the user for the 8 values of a 2, 2x2 mathematical matrix. Another words, there are 4 values in one 2x2 matrix and another 4 values for the second matrix. And It should prompt a message to the user asking what operation they want to do with it like addition, subtraction, division, multiplication etc.

Oct 30, 2018 390 views

## 1 answer to this question.

In R, if you have a matrix:

```m1 <- matrix(c(2,2,2,2), ncol = 2)
m2 <- matrix(c(4,4,4,4), ncol = 2)  ```

and you want to add/subtract/divide/multiple the two you simply:

```m1 + m2
[,1] [,2]
[1,]    6    6
[2,]    6    6```

If you store the inputted values in a list, you can refer to it inside the matrix function as above:

```matrix(user_input, ncol = 2)
#or
matrix(c(ui1, ui2, ui3, ui4), ncol = 2)```
• 10,840 points

## Confusion matrix in R

A confusion matrix can be used to ...READ MORE

## "Error in if" while trying to execute simple code in R

This caused non-logical data or missing values passed ...READ MORE

+1 vote

## "subscript out of bounds" error in while executing simple R program

This is caused by trying to access ...READ MORE

## Check if a matrix is diagonalizable in R Programming Language

On a given matrix, a, the first way ...READ MORE

## By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

## How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

## In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

## How to create a list of Data frames?

Basically all we have to do is ...READ MORE