Thursday, July 18, 2013

Rows matching value.

Quick tip to select only rows that meet certain criteria in R.
df[df$age >= 50, ]

OR

#script or loop to detect all accounts with age >=50 
count = 0
for (i in 1:length(trend$x)){
  if (trend$x[i] >= 50 ){
    count = count +1
  }

}

No comments:

Post a Comment

Add any comments if it helped :)