log4r
我创建了一个日志文件,用于使用包保存数据框。我使用的代码如下:
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))
这会将数据帧写入该values
日志文件。但是日志文件的内容是"abc.log"
这样的:
[ 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")
我想像数据框一样查看日志文件的内容,如下所示:
a b c
1 ab 1 as
2 bc 2 sd
3 df 3 ad
4 sx 4 ad
5 ss 2 ad
可以使用log4r
包吗?