@@ -130,36 +130,35 @@ For more help, see https://plot.ly/R or contact <
[email protected] >.")
130
130
}
131
131
}
132
132
pub $ get_figure <- function (file_owner , file_id ) {
133
- headers = c(" plotly-username" = pub $ username ,
134
- " plotly-apikey" = pub $ key ,
135
- " plotly-version" = pub $ version ,
136
- " plotly-platform" = " R" )
137
- response_handler = basicTextGatherer()
138
- header_handler = basicTextGatherer()
139
- curlPerform(url = paste(" https://plot.ly/apigetfile" , file_owner , file_id , sep = " /" ),
133
+ headers <- c(" plotly-username" = pub $ username ,
134
+ " plotly-apikey" = pub $ key ,
135
+ " plotly-version" = pub $ version ,
136
+ " plotly-platform" = " R" )
137
+ response_handler <- basicTextGatherer()
138
+ header_handler <- basicTextGatherer()
139
+ curlPerform(url = paste(" https://plot.ly/apigetfile" , file_owner , file_id ,
140
+ sep = " /" ),
140
141
httpheader = headers ,
141
142
writefunction = response_handler $ update ,
142
- headerfunction = header_handler $ update )
143
- resp_header = as.list(parseHTTPHeader(header_handler $ value()))
144
-
143
+ headerfunction = header_handler $ update )
144
+ resp_header <- as.list(parseHTTPHeader(header_handler $ value()))
145
+
145
146
# Parse status
146
147
if (resp_header $ status != " 200" ) {
147
- print (resp_header $ statusMsg )
148
- stop(resp_header $ status )
148
+ cat (resp_header $ statusMsg )
149
+ stop(resp_header $ status )
149
150
}
150
-
151
- body_string = response_handler $ value()
152
- resp = RJSONIO :: fromJSON(body_string )
151
+
152
+ body_string <- response_handler $ value()
153
+ resp <- RJSONIO :: fromJSON(body_string )
153
154
if (! is.null(resp $ error ) && resp $ error != " " )
154
155
stop(resp $ err )
155
156
if (! is.null(resp $ warning ) && resp $ error != " " )
156
157
cat(resp $ warning )
157
158
if (! is.null(resp $ message ) && resp $ error != " " )
158
159
cat(resp $ message )
159
-
160
- fig = resp $ payload $ figure
161
-
162
- return (fig )
160
+
161
+ fig <- resp $ payload $ figure
163
162
}
164
163
pub $ iplot <- function (... , kwargs = list (filename = NULL , fileopt = NULL )) {
165
164
# Embed plotly graphs as iframes for knitr documents
0 commit comments