Operations on Matrices and Data Frames - English
- subtitles off
- captions off
- English
- Questions posted on Forums
- R Tutorials - English
-
assignment
i am not able to do the second question of the assignment please help me with the command.
12-13M 10-20S kinshuk02
Answer last updated on: Aug. 17, 2021, 4:05 p.m.
-
Adding Multiple Data Frame
Firstly, I performed rbind to add new data row.Then, the csv file is updated by doing write.csv operation.By running the R script file again, new column (X) exists in the dataframe and that makes number of columns of arguments do not match problem for further data frame addition.How to solve it?I also attached my code.captaincy=read.csv("CaptaincyData.csv")captaincy <- rbind(captaincy,data.frame(names="Dravid",Y=2008,played=25,won=8,lost=6,victory=0.32))write.csv(captaincy,"CaptaincyData.csv")In adding new column using cbind by running R script file repeatedly, new column exists. (in this case: just only new column exists)
08-09M 40-50S EKW
Answer last updated on: Feb. 6, 2021, 2:04 p.m.
-
File captaincy is not opening
source('C:/Users/Joohi/Desktop/My Project/Matrices/myMatrix.R', echo=TRUE)> # Clear R workspace> rm(list = ls() ) > # Declare a variable to read and store the data frame > captaincy = read.csv("CaptaincyData.csv")Error in file(file, "rt") : cannot open the connectionIn addition: Warning message:In file(file, "rt") : cannot open file 'CaptaincyData.csv': No such file or directory> # Clear R workspace> rm(list = ls() ) > > # Declare a variable to read and store the data frame > captaincy = read.csv("CaptaincyData.csv")Error in file(file, "rt") : cannot open the connectionIn addition: Warning message:In file(file, "rt") : cannot open file 'CaptaincyData.csv': No such file or directory> > # View the stored data frame > View(captaincy)Error in View : object 'captaincy' not found> CaptaincyData <- read.csv("C:/Users/Joohi/Desktop/My Project/Matrices/CaptaincyData.csv")> View(CaptaincyData)> # Clear R workspace> rm(list = ls() ) > > # Declare a variable to read and store the data frame > captaincy = read.csv("CaptaincyData.csv")Error in file(file, "rt") : cannot open the connectionIn addition: Warning message:In file(file, "rt") : cannot open file 'CaptaincyData.csv': No such file or directory> > # View the stored data frame > View(captaincy)Error in View : object 'captaincy' not found> # Clear R workspace> rm(list = ls() ) > > # Declare a variable to read and store the data frame > captaincy = read.csv("CaptaincyData.csv")Error in file(file, "rt") : cannot open the connectionIn addition: Warning message:In file(file, "rt") : cannot open file 'CaptaincyData.csv': No such file or directory> > # View the stored data frame > View(captaincy)Error in View : object 'captaincy' not found> # Declare a variable to read and store the data frame > captaincy = read.csv("CaptaincyData.csv")Error in file(file, "rt") : cannot open the connectionIn addition: Warning message:In file(file, "rt") : cannot open file 'CaptaincyData.csv': No such file or directory> > # View the stored data frame > View(captaincy)Error in View : object 'captaincy' not found>
01-02M 10-20S Joohi
Answer last updated on: Dec. 14, 2020, 1:38 p.m.
-
Remove of specific row
Sir I like to ask what is the command for removing the added row in the matrixes as by mistake add command two times because of which I made the entry of Kohli two times. As it is out of the topic but sir I am facing this problems. Kindly guide me to know the command for removable of specific row.
09-10M 40-50S manishakdey@gmail.com
Answer last updated on: June 28, 2020, 1:36 a.m.
-
Finding sum of all elements in matrixA using inbuilt functions
startTime <- Sys.time() totalsum <- 0 for (i in 1:3) { for (j in 1:3) { totalsum <- totalsum+matrixA[i,j] } } print(totalsum)[1] 237endTime <- Sys.time()endTime- startTimeTime difference of 0.008000851 secs startTime <- Sys.time() sum(matrixA)[1] 237 endTime <- Sys.time() endTime- startTimeTime difference of 0 secsSir the above time difference is ok
08-09M 20-30S Alamu
Answer last updated on: May 17, 2020, 12:26 a.m.
-
Creating New Row
inputcaptaincy <- rbind(captaincy, data.frame(names= "Kohli", y=2016, played=30, won=20, lost=9, victory=20/30 ) )View(captaincy)OutputError in match.names(clabs, names(xi)) : names do not match previous names
10-11M 10-20S kalaibalakannan@gmail.com
Answer last updated on: April 29, 2020, 1:54 p.m.
-
Operations on Matrices and Data Frames
[,1] [,2][1,] 9 10[2,] 11 12[3,] 13 14[4,] 15 16 valuesC[1,] 9 10 17[2,] 11 12 18[3,] 13 14 19[4,] 15 16 20 how to change the row header to 1, 2, 3. in the above output row header is not appearing for two columns. kindly guide.
11-12M 40-50S angaiaruvi@gmail.com
Answer last updated on: April 28, 2020, 2 p.m.
-
Usage of rbind function
1. Can a row be inserted in the middle of data frame using rbind function?2. Can multiple rows be inserted at once using rbind function in data frame?3. Can a data be inserted at once in multiple data frames using rbind function?
10-11M 10-20S annieahuja89@gmail.com
Answer last updated on: April 2, 2020, 11:32 p.m.
-
Regarding Matrix Operations
Apart from binding rows and cols using rbind and cbind , it would be more helpful, if the video suggests edit and delete operations on a matrix.
11-12M 50-60S sureshk1704@gmail.com
Answer last updated on: Oct. 12, 2019, 4:23 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
-
10Creating Matrices using Data Frames
-
Operations 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:
16681 visits
Outline:
How to find the inverse of a matrix How to calculate the sum of elements in a matrix using for loop How to calculate the sum of elements in a matrix using the sum function How to calculate the time elapsed in an operation How to find out the sum of rows of a matrix How to find out the sum of columns of a matrix How to add a new column or row to an existing data-frame How to use cbind and rbind function
Width: | 812 | Height: | 608 |
---|---|---|---|
Duration: | 00:13:54 | Size: | 6.6 MB |
Show video info