Posts Tagged ‘ Dataframe ’

Converting vectors to numeric in mixed-type dataframe

May 19, 2011
By

Coercing variables of character and numeric type into a single dataframe yields all vectors to be defined as factors all <- data.frame(cbind(site, year, model, x, y, z)) The following converts selected variables from “factor” back to “numeric” all$x <- as.numeric(x) … Continue reading →

Read more »

Remove all rows of an R dataframe

January 13, 2011
By
Remove all rows of an R dataframe

I should have probably figured this out a long time ago, but as I get deeper into programming with R, I am finding the need to remove all rows from a dataframe.  I was making this alot harder than it had to be. your.df<- your.df Replace your.df with, your dataframe and you are good

Read more »