Displaying 1 result from an estimated 1 matches for "sdrow".
Did you mean:
drow
2002 May 11
1
deleting invariant rows and cols in a matrix
...# Store data in temp name and keep original
clean <- item.dat
# Initialize the stop variable
stp <- 0
# Start cleanup process for both cols and rows
while (stp != 1){
stp.row <- rep(0,nrow(clean))
stp.col <- rep(0,ncol(clean))
# Start with rows
for (i in 1:nrow(clean)){
sdrow <- sd(clean[i,])
if (sdrow==0) clean <- clean[i * -1,]
if (sdrow==0) stp.row[i] <- 1
}
# Next check columns
for (j in 1:ncol(clean)){
sdcol <- sd(clean[,j])
if (sdcol==0) clean <- clean[,j * -1]
if (sdcol==0) stp.col[j] <- 1
}
# Do we need to continue...