6

ggplot を使用して棒グラフをプロットしていましたが、R の配管工パッケージを使用してこの関数を Web API として作成しました。

 library(plumber)
 library(ggplot2)
#' @get /histogram_test
#' @png
  histogram_test <- function(){
  mtcars=mtcars
  b=ggplot(mtcars,aes(mtcars$cyl))
  b+geom_bar()
}

次に実行します:

r <- plumb("plum_api.R")
r$run(port=8000)

しかし、これはブラウザーにプロットを返しません。

4

1 に答える 1