[R] truncate/overwrite a data frame

From: <herodote_at_oreka.com>
Date: Thu 08 Dec 2005 - 20:40:25 EST


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.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 08 21:02:24 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:34 EST