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
• 11,360 points
597 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,840 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,840 points
4,191 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
• 33,030 points
12,326 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
• 33,030 points
4,582 views
+1 vote
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
• 33,030 points
1,798 views
+10 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 9, 2018 in Data Analytics by Abhi
• 3,720 points
1,613 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,720 points
4,532 views
0 votes
1 answer

How to know the type of an object?

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

answered Sep 20, 2018 in Data Analytics by Abhi
• 3,720 points
707 views
+1 vote
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,840 points
972 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,840 points
1,231 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP