Displaying 1 result from an estimated 1 matches for "medianx".
Did you mean:
median
2011 Mar 18
1
help please: put output into dataframe
...rnorm(500, 10,4)
var2 <- rnorm(500, 20, 8)
var3 <- rnorm(500, 30, 18)
var4 <- rnorm(500, 40, 20)
datafr1 <- data.frame(var1, var2, var3, var4)
# my unsuccessful codes
nvar <- ncol(datafr1)
for (i in 1:nvar) {
out1 <- NULL
out2 <- NULL
medianx <- median(getdata[,i], na.rm = TRUE)
show(madx <- mad(getdata[,i], na.rm = TRUE))
MD1 <- c(medianx + 2*madx)
MD2 <- c(medianx - 2*madx)
out1[i] <- which(getdata[,i] > MD1) # store data that are
greater than median + 2 mad...