Skip to content

Commit

Permalink
Fix 'xl_write' for R version <=3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gdemin committed Dec 11, 2018
1 parent 56b66b1 commit 219d947
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/xl_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ xl_write.etable = function(obj,
...){
if(NCOL(obj)==0) return(invisible(c(NROW(obj), 0)))
recode(obj) = is.nan ~ NA
obj = type.convert(obj, as.is = TRUE)
if(getRversion()>="3.5.0"){
obj = type.convert(obj, as.is = TRUE)
} else {
for(i in seq_along(obj)){
if(is.character(obj[[i]])) obj[[i]] = type.convert(obj[[i]], as.is = TRUE)
}
}
remove_repeated = match.arg(remove_repeated)

header = t(split_labels(colnames(obj), remove_repeated = remove_repeated %in% c("all", "columns")))[,-1, drop = FALSE]
Expand Down

0 comments on commit 219d947

Please sign in to comment.