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,400 points
26 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,040 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,040 points
293 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 in Data Analytics by anonymous
• 25,580 points
21 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 5 days ago in Data Analytics by Cherukuri
• 25,580 points
12 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 in Data Analytics by anonymous
• 25,580 points
118 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
53 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
33 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
• 40,420 points
40 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,040 points
31 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,040 points
77 views