Trying to add an extra column to an already existing matrix

0 votes
I already have a matrix with 20 columns, i need to another column with 10 values in it. How can I go about it?
Nov 2, 2018 in Data Analytics by Ali
• 10,670 points
59 views

1 answer to this question.

0 votes

Try this @Ali,

a <- matrix(1:5000, nrow=100)
a <- cbind(a,apply(a[,1:10],1,mean))
answered Nov 2, 2018 by Maverick
• 10,820 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

I'm trying to start rattle on R Studio and end up with an error

You need the package RGtk2 for rattle to ...READ MORE

answered Nov 26, 2018 in Data Analytics by Maverick
• 10,820 points
812 views
0 votes
2 answers

How to add an image to shiny application?

Hi Prachi. To include an image in the ...READ MORE

answered Aug 30, 2019 in Data Analytics by anonymous
• 32,460 points
2,394 views
0 votes
1 answer

Add a index/Row number column to dataframe

Hi, Bharath. You can add index using seq(1:nrow(data frame)). Example ...READ MORE

answered Sep 10, 2019 in Data Analytics by Cherukuri
• 32,460 points
676 views
0 votes
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 32,460 points
321 views
+9 votes
3 answers

Which is a better initiative to learn data science: Python or R?

Well it truly depends on your requirement, If ...READ MORE

answered Aug 8, 2018 in Data Analytics by Abhi
• 3,680 points
162 views
0 votes
1 answer

How can I perform word stemming in R

The tm package in R provides the stemDocument() function to stem the ...READ MORE

answered Aug 20, 2018 in Data Analytics by Abhi
• 3,680 points
207 views
0 votes
1 answer

How to know the type of an object?

To find the type of an object ...READ MORE

answered Sep 19, 2018 in Data Analytics by Abhi
• 3,680 points
57 views
0 votes
1 answer

an error occurred" because rows do not match when trying to use lm to perform an ANOVA test

Maybe you could do something like this. ...READ MORE

answered Nov 2, 2018 in Data Analytics by Maverick
• 10,820 points
64 views
0 votes
1 answer

Error saying "Failed to get an access token." when trying to access my Google Analytics API

Try this: library(RGoogleAnalytics) oauth_token <- Auth( client.id = ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,820 points
344 views