Skip to content

Commit

Permalink
fixes #851: coerce any objects that are not data frames to data frames
Browse files Browse the repository at this point in the history
e.g. for dplyr objects, x[, j] later can be interpreted as x[, 'j'], which is wrong, even though x is also data frame
  • Loading branch information
yihui committed Oct 11, 2014
1 parent 85aeda4 commit e34c279
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/table.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ kable = function(
stop('table format not implemented yet!')
) else 'pandoc'
col.names # evaluate it now! no lazy evaluation because colnames(x) may change
if (!is.matrix(x) && !is.data.frame(x)) x = as.data.frame(x)
if (!is.matrix(x)) x = as.data.frame(x)
m = ncol(x)
# numeric columns
isn = if (is.matrix(x)) rep(is.numeric(x), m) else sapply(x, is.numeric)
Expand Down

0 comments on commit e34c279

Please sign in to comment.