Creating Matrices using Data Frames - English
- subtitles off
- captions off
- English
- Questions posted on Forums
- R Tutorials - English
-
TRUE MATRIX MULTIPLICATION
Hi,I have a doubt regarding true matrix multiplication.matrixA as per the video - 45,49,47,22,21,14,12,13,14 subdata <- captaincy[1:3,c("played","won","lost")] > matrixA <- as.matrix(subdata)> print(matrixA) played won lost [1] 45 22 12 [2] 49 21 13 [3] 47 14 14 matrixB - my own values <- c(1,0,1,1,0,1,0,1,0)> matrixB <- matrix(values,nrow=3,ncol=3,byrow=FALSE) print(matrixB) [,1] [,2] [,3] [1,] 1 1 0[2,] 0 0 1 [3,] 1 1 0 true matric multiplication - matrixA %*% matrixB - THE RESULTS I AM GETTING ARE - [,1] [,2] [,3] 1 57 57 22 2 62 62 21 3 61 61 14 THE RESULTS SHOWN IN THE VIDEO - (with matrixB values of his own <-c(1,0,0,0,1,0,0,0,1)) [,1] [,2] [,3] 1 45 22 12 2 49 21 13 3 47 14 14 Could you please explain where am I going wrong ? Thanks!
07-08M 50-60S PRANATHI_KALANGI
Answer last updated on: Sept. 24, 2024, 9:01 a.m.
-
by enter the command as given in tutorial matrix didn't make
print(matrixB)Error in print(matrixB) : object 'matrixB' not foundTHE ABOVE LINE SHOWN BY R STUDIO WHILE MAKING MATRIX.
03-04M 10-20S tanishagoyal
Answer last updated on: Aug. 17, 2021, 4:14 p.m.
-
Assignment
matrixB=matrix(nrow=4,ncol=2,data = c(9,10,11,12,13,14,15,16))print(matrixB) [,1] [,2][1,] 9 13[2,] 10 14[3,] 11 15[4,] 12 16Sir i have doubt if i type the above coding i am getting the above solution but the assignment was to create two vectors so i have the coding as x=c(9,10,11,12)y=c(13,14,15,16)matrixB=matrix(nrow=4,ncol=2,x,y) print(matrixB) [,1] [,2][1,] 9 10[2,] 11 12[3,] 9 10[4,] 11 12i am getting like above solution , pls correct me sir
10-11M 50-60S kajalmeena
Answer last updated on: Aug. 15, 2021, 11:49 a.m.
-
Assignment
Is an assignment, for submission or practice? if it is for submission so how to submit?
09-10M 30-40S shiksha_saxena
Answer last updated on: June 17, 2020, 1:16 p.m.
-
Matrix multiplication
what is the difference between matrixA*matrixBmatrixA%*%matrixB
08-09M 20-30S bindukannan
Answer last updated on: June 17, 2020, 12:11 p.m.
-
what is %*%
what operation exactly perform ?
08-09M 10-20S nameisbond7@gmail.com
Answer last updated on: May 24, 2020, 5:12 p.m.
-
Assignment
Check for the assignment sirx=c(9,10,11,12) y=c(13,14,15,16) matrixA=matrix(x,y,nrow = 4,ncol = 2) print(matrixA) [,1] [,2] [1,] 9 10 [2,] 11 12 [3,] 9 10 [4,] 11 12
09-10M 40-50S Alamu
Answer last updated on: May 16, 2020, 3:32 p.m.
-
subdata
Sir in the current vidoe "subdata" you used small letter for data but in the previous lecture indexing and slicing for the subset you used " "subData". Is both correct sir
06-07M 20-30S Alamu
Answer last updated on: May 16, 2020, 3:29 p.m.
-
Print command
When should print command be used for displaying output and when is it not required? In this video, the author is using print(matrixB) command to obtain matrix output in Console window.However, in assignment solution, output is being obtained even without print command.How is it so?
06-07M 40-50S dsouzafleur@gmail.com
Answer last updated on: April 29, 2020, 5:31 p.m.
-
MATRICES- Creating 3 X 3 IDENTITY MATRIX
I have encountered a problem in creating 3 x 3 identity matrix. #create a matrix of 3 rows and 3 columns using the following codevalues <- c(1,0,0,0,1,0,0,0,1)matrixB <- as.matrix(values, nrow = 3, ncol = 3, byrow = TRUE) print(matrixB)But output i am getting isprint(matrixB) [,1] [1,] 1 [2,] 0 [3,] 0 [4,] 0 [5,] 1 [6,] 0 [7,] 0 [8,] 0 [9,] 1Please tell me the solution..Thanks.
06-07M 30-40S annieahuja89@gmail.com
Answer last updated on: April 28, 2020, 2:54 p.m.
-
Creating Matrices using Data Frames
Is there an option to create matrix directly without creating a vector?
05-06M 50-60S angaiaruvi@gmail.com
Answer last updated on: April 28, 2020, 12:39 p.m.
-
1Overview of R and RStudio
-
2Installing R and RStudio on Linux
-
3Installing R and RStudio on Windows
-
4Introduction to basics of R
-
5Introduction to Data Frames in R
-
6Introduction to RStudio
-
7Introduction to R script
-
8Working directories in RStudio
-
9Indexing and Slicing Data Frames
-
Creating Matrices using Data Frames
-
11Operations on Matrices and Data Frames
-
12Merging and Importing Data
-
13Data types and Factors
-
14Lists and its Operations
-
15Plotting Histograms and Pie Chart
-
16Plotting Bar Charts and Scatter Plot
-
17Introduction to ggplot2
-
18Aesthetic Mapping in ggplot2
-
19Data Manipulation using dplyr Package
-
20More Functions in dplyr Package
-
21Pipe Operator
-
22Conditional Statements
-
23Functions in R
Questions posted on ST Forums:
19679 visits
Outline:
Data required in a matrix format Convert a data frame into a matrix Create a matrix with known data Add two matrices Subtract two matrices Multiply two matrices elementwise Perform true matrix multiplication Calculate the transpose of a matrix Calculate the determinant of a matrix
Width: | 812 | Height: | 610 |
---|---|---|---|
Duration: | 00:10:52 | Size: | 5.5 MB |
Show video info