Calculate matrix means and compile across matrices
I've only been using R for about a week (converting long-time SAS user). I'm running a model that generates multiple identical matrices (representing different parameter scenarios) similarly to the simplified example below:
library(matrixStats)
len<-50
wid<-10
mat1 <- matrix(nrow=len, ncol=wid)
mat2 <- matrix(nrow=len, ncol=wid)
mat3 <- matrix(nrow=len, ncol=wid)
set.seed(123)
for (i in 1:wid){
for (n in 1:len){
mat1[n,i] <- runif(1)
mat2[n,i] <- runif(1)
mat3[n,i] <- runif(1)
}}
I want to calculate the mean and standard deviation of the column sums for each matrix independently, similar to:
a <- colSums(mat1)
mean(a)
sd(a)
repeated for each matrix and then compile those values into a single dataset with a matrix identifier, mean, and standard deviation, similar to:
mat1_ID 24.42858 2.198454
mat2_ID 25.67452 1.677669
mat3_ID 24.31933 1.572029
I have no idea how to do this in R. Any help would be greatly appreciated.
r matrix
add a comment |
I've only been using R for about a week (converting long-time SAS user). I'm running a model that generates multiple identical matrices (representing different parameter scenarios) similarly to the simplified example below:
library(matrixStats)
len<-50
wid<-10
mat1 <- matrix(nrow=len, ncol=wid)
mat2 <- matrix(nrow=len, ncol=wid)
mat3 <- matrix(nrow=len, ncol=wid)
set.seed(123)
for (i in 1:wid){
for (n in 1:len){
mat1[n,i] <- runif(1)
mat2[n,i] <- runif(1)
mat3[n,i] <- runif(1)
}}
I want to calculate the mean and standard deviation of the column sums for each matrix independently, similar to:
a <- colSums(mat1)
mean(a)
sd(a)
repeated for each matrix and then compile those values into a single dataset with a matrix identifier, mean, and standard deviation, similar to:
mat1_ID 24.42858 2.198454
mat2_ID 25.67452 1.677669
mat3_ID 24.31933 1.572029
I have no idea how to do this in R. Any help would be greatly appreciated.
r matrix
FYI, the code displayed here does not make use of the 'matrixStats' package, so no need to uselibrary(matrixStats)
here. ThecolSums()
function comes from the 'base' package.
– HenrikB
yesterday
add a comment |
I've only been using R for about a week (converting long-time SAS user). I'm running a model that generates multiple identical matrices (representing different parameter scenarios) similarly to the simplified example below:
library(matrixStats)
len<-50
wid<-10
mat1 <- matrix(nrow=len, ncol=wid)
mat2 <- matrix(nrow=len, ncol=wid)
mat3 <- matrix(nrow=len, ncol=wid)
set.seed(123)
for (i in 1:wid){
for (n in 1:len){
mat1[n,i] <- runif(1)
mat2[n,i] <- runif(1)
mat3[n,i] <- runif(1)
}}
I want to calculate the mean and standard deviation of the column sums for each matrix independently, similar to:
a <- colSums(mat1)
mean(a)
sd(a)
repeated for each matrix and then compile those values into a single dataset with a matrix identifier, mean, and standard deviation, similar to:
mat1_ID 24.42858 2.198454
mat2_ID 25.67452 1.677669
mat3_ID 24.31933 1.572029
I have no idea how to do this in R. Any help would be greatly appreciated.
r matrix
I've only been using R for about a week (converting long-time SAS user). I'm running a model that generates multiple identical matrices (representing different parameter scenarios) similarly to the simplified example below:
library(matrixStats)
len<-50
wid<-10
mat1 <- matrix(nrow=len, ncol=wid)
mat2 <- matrix(nrow=len, ncol=wid)
mat3 <- matrix(nrow=len, ncol=wid)
set.seed(123)
for (i in 1:wid){
for (n in 1:len){
mat1[n,i] <- runif(1)
mat2[n,i] <- runif(1)
mat3[n,i] <- runif(1)
}}
I want to calculate the mean and standard deviation of the column sums for each matrix independently, similar to:
a <- colSums(mat1)
mean(a)
sd(a)
repeated for each matrix and then compile those values into a single dataset with a matrix identifier, mean, and standard deviation, similar to:
mat1_ID 24.42858 2.198454
mat2_ID 25.67452 1.677669
mat3_ID 24.31933 1.572029
I have no idea how to do this in R. Any help would be greatly appreciated.
r matrix
r matrix
edited Nov 21 '18 at 16:01
Jack Handy
asked Nov 21 '18 at 15:55
Jack HandyJack Handy
32
32
FYI, the code displayed here does not make use of the 'matrixStats' package, so no need to uselibrary(matrixStats)
here. ThecolSums()
function comes from the 'base' package.
– HenrikB
yesterday
add a comment |
FYI, the code displayed here does not make use of the 'matrixStats' package, so no need to uselibrary(matrixStats)
here. ThecolSums()
function comes from the 'base' package.
– HenrikB
yesterday
FYI, the code displayed here does not make use of the 'matrixStats' package, so no need to use
library(matrixStats)
here. The colSums()
function comes from the 'base' package.– HenrikB
yesterday
FYI, the code displayed here does not make use of the 'matrixStats' package, so no need to use
library(matrixStats)
here. The colSums()
function comes from the 'base' package.– HenrikB
yesterday
add a comment |
2 Answers
2
active
oldest
votes
mats <- paste0("mat", 1:3)
t(sapply(mats, function(x) {
cs <- colSums(get(x))
c(mean(cs), sd(cs))
}))
[,1] [,2]
mat1 24.42858 2.198454
mat2 25.67452 1.677669
mat3 24.31933 1.572029
Another (possibly confusing) optionfuns <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
@JackHandy: Sure, for example:paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
add a comment |
If you want speed you can try my way. I will use package Rfast. Since you are new in R I will show step by step my example.
install.packages("Rfast") # download package Rfast
I will use the matrices from your example.
mats <- list(mat1=mat1,mat2=mat2,mat3=mat3) # "mat=mat" store matrix mat and add name
result <- sapply(mats,function(x){
s <- Rfast::colsums(x) # you can use also the parallel version using argument "parallel"
c(sd=Rfast::Var(s,std=TRUE),mean=mean(s))
})
result # this will print the matrix
mat1 mat2 mat3
sd 1.677669 1.677669 1.572029
mean 25.674519 25.674519 24.319328
You can transpose the matrix to get the result as you wish
t(result)
sd mean
mat1 1.677669 25.67452
mat2 1.677669 25.67452
mat3 1.572029 24.31933
1
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415885%2fcalculate-matrix-means-and-compile-across-matrices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
mats <- paste0("mat", 1:3)
t(sapply(mats, function(x) {
cs <- colSums(get(x))
c(mean(cs), sd(cs))
}))
[,1] [,2]
mat1 24.42858 2.198454
mat2 25.67452 1.677669
mat3 24.31933 1.572029
Another (possibly confusing) optionfuns <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
@JackHandy: Sure, for example:paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
add a comment |
mats <- paste0("mat", 1:3)
t(sapply(mats, function(x) {
cs <- colSums(get(x))
c(mean(cs), sd(cs))
}))
[,1] [,2]
mat1 24.42858 2.198454
mat2 25.67452 1.677669
mat3 24.31933 1.572029
Another (possibly confusing) optionfuns <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
@JackHandy: Sure, for example:paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
add a comment |
mats <- paste0("mat", 1:3)
t(sapply(mats, function(x) {
cs <- colSums(get(x))
c(mean(cs), sd(cs))
}))
[,1] [,2]
mat1 24.42858 2.198454
mat2 25.67452 1.677669
mat3 24.31933 1.572029
mats <- paste0("mat", 1:3)
t(sapply(mats, function(x) {
cs <- colSums(get(x))
c(mean(cs), sd(cs))
}))
[,1] [,2]
mat1 24.42858 2.198454
mat2 25.67452 1.677669
mat3 24.31933 1.572029
answered Nov 21 '18 at 16:06
snoramsnoram
6,399831
6,399831
Another (possibly confusing) optionfuns <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
@JackHandy: Sure, for example:paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
add a comment |
Another (possibly confusing) optionfuns <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
@JackHandy: Sure, for example:paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
Another (possibly confusing) option
funs <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Another (possibly confusing) option
funs <- list(sd=sd, mean=mean); sapply(funs, mapply, lapply(mget(paste0("mat", 1:3)), colSums))
– markus
Nov 21 '18 at 16:16
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
Thanks...this worked great! I particularly like the paste0 function, as I have many matrices with sequentially increasing file names and this will keep me from having to type them all individually. If I had sets of matrices with different file prefixes (e.g, mat1, mat2, mat3, test1, test2, test3) could I similarly combine them all using this function?
– Jack Handy
Nov 21 '18 at 17:50
@JackHandy: Sure, for example:
paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
@JackHandy: Sure, for example:
paste0(c("mat", "test"), rep(1:3, each = 2))
– snoram
Nov 22 '18 at 7:31
add a comment |
If you want speed you can try my way. I will use package Rfast. Since you are new in R I will show step by step my example.
install.packages("Rfast") # download package Rfast
I will use the matrices from your example.
mats <- list(mat1=mat1,mat2=mat2,mat3=mat3) # "mat=mat" store matrix mat and add name
result <- sapply(mats,function(x){
s <- Rfast::colsums(x) # you can use also the parallel version using argument "parallel"
c(sd=Rfast::Var(s,std=TRUE),mean=mean(s))
})
result # this will print the matrix
mat1 mat2 mat3
sd 1.677669 1.677669 1.572029
mean 25.674519 25.674519 24.319328
You can transpose the matrix to get the result as you wish
t(result)
sd mean
mat1 1.677669 25.67452
mat2 1.677669 25.67452
mat3 1.572029 24.31933
1
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
add a comment |
If you want speed you can try my way. I will use package Rfast. Since you are new in R I will show step by step my example.
install.packages("Rfast") # download package Rfast
I will use the matrices from your example.
mats <- list(mat1=mat1,mat2=mat2,mat3=mat3) # "mat=mat" store matrix mat and add name
result <- sapply(mats,function(x){
s <- Rfast::colsums(x) # you can use also the parallel version using argument "parallel"
c(sd=Rfast::Var(s,std=TRUE),mean=mean(s))
})
result # this will print the matrix
mat1 mat2 mat3
sd 1.677669 1.677669 1.572029
mean 25.674519 25.674519 24.319328
You can transpose the matrix to get the result as you wish
t(result)
sd mean
mat1 1.677669 25.67452
mat2 1.677669 25.67452
mat3 1.572029 24.31933
1
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
add a comment |
If you want speed you can try my way. I will use package Rfast. Since you are new in R I will show step by step my example.
install.packages("Rfast") # download package Rfast
I will use the matrices from your example.
mats <- list(mat1=mat1,mat2=mat2,mat3=mat3) # "mat=mat" store matrix mat and add name
result <- sapply(mats,function(x){
s <- Rfast::colsums(x) # you can use also the parallel version using argument "parallel"
c(sd=Rfast::Var(s,std=TRUE),mean=mean(s))
})
result # this will print the matrix
mat1 mat2 mat3
sd 1.677669 1.677669 1.572029
mean 25.674519 25.674519 24.319328
You can transpose the matrix to get the result as you wish
t(result)
sd mean
mat1 1.677669 25.67452
mat2 1.677669 25.67452
mat3 1.572029 24.31933
If you want speed you can try my way. I will use package Rfast. Since you are new in R I will show step by step my example.
install.packages("Rfast") # download package Rfast
I will use the matrices from your example.
mats <- list(mat1=mat1,mat2=mat2,mat3=mat3) # "mat=mat" store matrix mat and add name
result <- sapply(mats,function(x){
s <- Rfast::colsums(x) # you can use also the parallel version using argument "parallel"
c(sd=Rfast::Var(s,std=TRUE),mean=mean(s))
})
result # this will print the matrix
mat1 mat2 mat3
sd 1.677669 1.677669 1.572029
mean 25.674519 25.674519 24.319328
You can transpose the matrix to get the result as you wish
t(result)
sd mean
mat1 1.677669 25.67452
mat2 1.677669 25.67452
mat3 1.572029 24.31933
edited Nov 21 '18 at 19:28
answered Nov 21 '18 at 17:03
CsdCsd
29819
29819
1
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
add a comment |
1
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
1
1
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
The code wouldn't work for me. Is there something missing in the mean command?
– Jack Handy
Nov 21 '18 at 17:47
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Yes and sorry for that. There was a type but I have edited my answer and test again.
– Csd
Nov 21 '18 at 17:54
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Great...thanks! I found two other typos: in the list statement, it should be mat1=mat1 (which is why the mat1 and mat2 result values were identical in your example), and there's a right parentheses missing after the mean command (there should be 3). I'm not sure what the speed difference is between the two methods with this simple example, but I'll see what happens with my larger matrices.
– Jack Handy
Nov 21 '18 at 19:00
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
Thanks for you comments. I have edit again the answer. Yes, my answer is more for the speed part because you might need it if your matrices are large. Especially for var which might crash for large matrices.
– Csd
Nov 21 '18 at 19:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415885%2fcalculate-matrix-means-and-compile-across-matrices%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
FYI, the code displayed here does not make use of the 'matrixStats' package, so no need to use
library(matrixStats)
here. ThecolSums()
function comes from the 'base' package.– HenrikB
yesterday