Skip to content

Commit

Permalink
preserve integers
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 20, 2023
1 parent f83e823 commit 04a31f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,12 @@ convert_chunk_header = function(
x
},
# use character with verbatim for no quotes
# so that numeric as kept unchanged (without changing precision)
# so that integers as kept unchanged (without changing precision)
# fig.width = 10, should not be fig-width: 10.0
numeric = function(x) {
x = as.character(x)
class(x) = 'verbatim'
x
if (length(x) != 1) return(x)
x2 = as.integer(x)
if (x2 == x) x2 else x
}), line.sep = '\n'), '\n')[[1]]
params3 = paste0(prefix, params3)
}
Expand Down

0 comments on commit 04a31f2

Please sign in to comment.