Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 18514

R is a free, open source programming language and software environment for statistical computing and graphics.

4 votes
Accepted

Find the minimum value that data could have had before it was rounded

You can firstly change by difference != 0 and then use na.locf to replace NAs by last available value recursively. minimum_new <- function(data) { answer <- rep(NA, length(data)) difference <- c( …
m0nhawk's user avatar
  • 366
5 votes
Accepted

Row-wise mean imputation in R

You can use rowMeans with indexing. k <- which(is.na(cancer1), arr.ind=TRUE) cancer1[k] <- rowMeans(cancer1, na.rm=TRUE)[k[,1]] Where k is an indices of the rows with NA values.
m0nhawk's user avatar
  • 366
3 votes
Accepted

Predict new ratings for each user based on their pearson correlation with other users

You have incorrect indexing in the loop. Better version with mapply and correct indexing: df <- mapply(function(i, j) { sim_user = which(cor_mat[i,] >= lower & cor_mat[i,] < upper) final_x[j, i] …
m0nhawk's user avatar
  • 366