Hi,
I noticed the following behaviour with toJSON:
cat(toJSON(data.frame(logical(0)), byrow=TRUE), '\n')
[
[
null
],
[]
]
When I would instead expect [] (?)
I believe the problem comes from this line
if(byrow) {
tmp = lapply(1:nrow(x), function(i) { row = as.list(x[i, ])
if(colNames)
row
else
unname(row)
})
where 1:nrow(x) should be replaced by seq_len(nrow(x)) (because 1:0 is actually the vector c(1,0)).
Hi,
I noticed the following behaviour with
toJSON:When I would instead expect
[](?)I believe the problem comes from this line
where
1:nrow(x)should be replaced byseq_len(nrow(x))(because1:0is actually the vectorc(1,0)).