[R] Time intervals in a datframe

Allaisone 1 All@i@one1 @ending from hotm@il@com
Tue Apr 17 19:10:24 CEST 2018


Hi all

I have a list of multiple datframes with the same column headers. The last column in each datframe contains a vector of "Interval" class after I have produced this column using "lubridate" package. I needed to convert my list of dataframes to be in a single dataframe for further analysis. I did this using the following syntax :

SingleDataframe <- ldply (MylistofDFs,data.frame)

The problem is that after this conversion, the the column with time intervals has been converted into numeric type with number of seconds during the time interval instead of the interval itself as follows :

The column Before conversion looks like this:

TimeInterval (class 'interval')
2012-12-13 UTC--2016-02-16 UTC

but after conversion the list into dataframe,
This column becomes number of seconds as follows :

TimeInterval (class : numeric)
100224000

Is there any method to convert my list into a a single dataframe without affecting the types of
vectors in my dataframes?. i.e. I want to keep the interval column as it with avoidance its conversion into numeric when I convert my list of dataframes into a single dataframe... Or at least keep the same format of the interval even if this has been changed to "character" type vector even though I prefer to be in "interval" class.

Any suggestions would be very appreciated.

Regards

	[[alternative HTML version deleted]]




More information about the R-help mailing list