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,380 points
17 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,020 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,020 points
178 views
0 votes
1 answer

With the help of tidyverse: how to rename a column to a variable name

With the help of Dplyr: rename function ...READ MORE

answered Apr 3, 2018 in Data Analytics by DeepCoder786
• 1,700 points

edited Apr 3, 2018 by DeepCoder786 25 views
0 votes
1 answer

How to change mulitiple characters in a column to a date

Firstly we have to set dataf variable ...READ MORE

answered Apr 3, 2018 in Data Analytics by DeepCoder786
• 1,700 points
15 views
0 votes
1 answer

How to sort a data frame by columns in R?

You can just use the order function ...READ MORE

answered Apr 10, 2018 in Data Analytics by darklord
• 6,140 points
60 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 ANMOL
• 3,620 points
37 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 ANMOL
• 3,620 points
21 views
0 votes
1 answer

Remove NA values from the output in R programming

Edit your code: columnmean <- function(x, removeNA = ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 36,340 points
27 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,020 points
20 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,020 points
52 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.