Filtering a ‘R’ data frame

This is an example showing how to strip a data frame of rows based on a ‘Time’
column. I have removed rows where the ‘Time’ column has hour as ’00’.

This is one row.

               147769 	264640 	00:36:35

input <- read.table(textConnection("

    PermGenAfterFullGC     X9     Time
                12862  	25984 	19:36:16
                39212  	69504 	19:36:26
               182327 	331456 	20:36:27
               147729 	293504 	21:36:29
               147743 	286336 	22:36:31
               147760 	276096 	23:36:33
               147769 	264640 	00:36:35
               147748 	252224 	01:36:36
               147758 	240320 	02:36:38"),header=T)
			   
input <- data.frame(input)
print(input$Time)
print( subset(input,as.POSIXlt(strptime(input$Time,"%H:%M:%S"))$hour != 0) )

I have a plan to convert some of this code to Java using the Java lambda API.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: