[R] truncate/overwrite a data frame
herodote@oreka.com
herodote at oreka.com
Thu Dec 8 10:40:25 CET 2005
hi all,
I've got a data frame, this data frame have 76 columns and 22600 rows.
The data inside can be redundant because the data can be captured simultaneously and overlap each other.
My aim is to supress these overlaps
I've test some solutions to do that but they all give a big cpu load and eat all of the memory then swap a lot, then killall R because it don't end.
actually i've tested this (it don't works but seems to be correct for me...):
My first try (i was trying to overwrite the table on the overlap):
tab[(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])):length(TotalFillTimeHours),1:length(tab)]<-tab[(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])):length(TotalFillTimeHours),1:length(tab)];
My second idea was to make 2 tab without the overlap, then put them together:
tab_tmp<-tab[1:(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])),1:length(tab)];
tab_tmp1<-tab[(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])):length(TotalFillTimeHours),1:length(tab)];
tab<-as.data.frame(c(tab_tmp, tab_tmp1));
attach(tab);
In these 2 case it didn't succeed, by the lack of comprehension that i have in R programming ...(it isn't R fault :).
thks all
guillaume.
More information about the R-help
mailing list