3535# ' plotly_POST(p, filename = "mtcars-bar-plot")
3636# ' }
3737
38- plotly_POST <- function (x , filename , fileopt = " new " ,
38+ plotly_POST <- function (x , filename = NULL , fileopt = " overwrite " ,
3939 sharing = c(" public" , " private" , " secret" )) {
4040 x <- plotly_build(x )
41- x $ filename <- if (! missing(filename )) {
42- filename
43- } else {
44- # try our damndest to assign a sensible filename
45- x $ filename %|| % as.character(x $ layout $ title ) %|| %
41+ # try our damndest to assign a sensible filename
42+ x $ filename <- x $ filename %|| % as.character(x $ layout $ title ) %|| %
4643 paste(c(x $ layout $ xaxis $ title , x $ layout $ yaxis $ title , x $ layout $ zaxis $ title ),
47- collapse = " vs. " ) %|| % " plot from api"
48- }
44+ collapse = " vs. " ) %|| % paste(" Created at" , Sys.time())
4945 if (! is.null(x $ fileopt )) {
5046 warning(" fileopt was specified in the wrong place." ,
5147 " Please specify in plotly_POST()" )
@@ -68,8 +64,8 @@ plotly_POST <- function(x, filename, fileopt = "new",
6864 origin = " plot" ,
6965 platform = " R" ,
7066 version = as.character(packageVersion(" plotly" )),
71- args = to_JSON(x $ data ),
72- kwargs = to_JSON(x [get_kwargs()])
67+ args = to_JSON(compact( x $ data ) ),
68+ kwargs = to_JSON(compact( x [get_kwargs()]) )
7369 )
7470 base_url <- file.path(get_domain(), " clientresp" )
7571 resp <- httr :: POST(base_url , body = bod )
0 commit comments