Displaying 2 results from an estimated 2 matches for "badrow".
Did you mean:
barrow
2017 Sep 26
2
Cleaning data
Hi
I want to clean my data frame, based on the age column, whereas i want to delete the rows that the difference between its elements (i+1)-i= integer. i used
a <- diff(df$age)
for(i in a){if(is.integer(a) == true){df <- df[-a,]
}}
but, it doesn?t work, any ideas
Thanks in advance
Bayan
2008 Mar 31
1
APPLY as alternate to FOR loop?
Dear list,
Below I've written a clunky for loop that counts NA's in a row, replacing all with NA if there are
more than 3 missing values, or keeping the values if 4 or more are present. This is sample code from a very large
dataframe I'm trying to clean up.
I know there are many simpler more elegant solutions to this little problem.
Would someone be willing to show me how to