0

I created a log file for saving a data frame using log4r package. The code i used is as follows:

library('log4r')
logger <- create.logger(logfile = "abc.log", level = log4r:::DEBUG)
values <- data.frame(a=c("ab","bc","df","sx","ss"),b=c(1,2,3,4,2),c=c("as","sd","ad","ad","ad"))
values$a = as.character(values$a)
values$c = as.character(values$c)

info(logger,message=as.data.frame(values))

This writes the dataframe values to that log file. But the content of the log file "abc.log" looks like this:

[ 2013-06-03 13:45:32 ] INFO c("ab", "bc", "df", "sx", "ss") 
 [ 2013-06-03 13:45:32 ] INFO c(1, 2, 3, 4, 2) 
 [ 2013-06-03 13:45:32 ] INFO c("as", "sd", "ad", "ad", "ad") 

I want to see the contents of the log file like a data frame as follows:

   a b  c
1 ab 1 as
2 bc 2 sd
3 df 3 ad
4 sx 4 ad
5 ss 2 ad

Is it possible using log4r package?

Dinoop Nair
  • 2,663
  • 6
  • 31
  • 51

1 Answers1

0

i could not find any solution for my actual question.So i used write.table(values,file=logger$logfile)

Dinoop Nair
  • 2,663
  • 6
  • 31
  • 51