Re: [R] truncate/overwrite a data frame

From: P Ehlers <ehlers_at_math.ucalgary.ca>
Date: Thu 08 Dec 2005 - 21:54:17 EST

Guillaume,

Will functions unique() or duplicated() help you?

(Comment on trailing ";" withheld so as not to revive recent thread.)

Peter Ehlers

herodote@oreka.com wrote:
> 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



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 22:02:19 2005

This archive was generated by hypermail 2.1.8 : Thu 08 Dec 2005 - 23:37:54 EST