summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant S2019-07-17 19:18:06 +0530
committerGitHub2019-07-17 19:18:06 +0530
commit98a99c1ba6bc7661e71db43e9918a7192a3b0b86 (patch)
tree02b415c2c3c2d90cb71ecb3de66a6041d8cb149f
parentd1335755b5c72d6c49d26248fa947dbaabbf9bb1 (diff)
parent5ca1083b17c445ee599802db8106c52a2fbadeaf (diff)
downloadR_on_Cloud_Web_API-98a99c1ba6bc7661e71db43e9918a7192a3b0b86.tar.gz
R_on_Cloud_Web_API-98a99c1ba6bc7661e71db43e9918a7192a3b0b86.tar.bz2
R_on_Cloud_Web_API-98a99c1ba6bc7661e71db43e9918a7192a3b0b86.zip
Merge pull request #3 from prashantsinalkar/masterHEADmaster
added install pacakge shell script and requirement file
-rw-r--r--README.md29
-rwxr-xr-xpackageinstall.sh20
-rw-r--r--requirements.txt6
-rw-r--r--run.R4
4 files changed, 50 insertions, 9 deletions
diff --git a/README.md b/README.md
index 2954027..7d8bea8 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,29 @@
# R_on_Cloud_Web_API
+Run following Steps :
+1) Install R on machine.
+2) $ chmod +X packageinstall.sh
+3) $ ./packageinstall.sh
+4) $ Rscript run.R
+5) Check in browser http://127.0.0.1:8001/__swagger__/
+
+**----------------------------------------------------------------------------**
**Run on local R console:**
R version 3.4.4
-
+
**Requirements preinstalled R packages:**
-
- install.packages("plumber")
- install.packages("jsonlite")
- install.packages("readr")
- install.packages("futile.logger")
- install.packages("tryCatchLog")
- install.packages("ggplot2")
- ------------------------------------------
+
+ 1) install.packages("plumber")
+ 2) install.packages("jsonlite")
+ 3) install.packages("readr")
+ 4) install.packages("futile.logger")
+ 5) install.packages("tryCatchLog")
+ 6) install.packages("ggplot2")
+**----------------------------------------------------------------------------**
+
+ #run.R
> library(plumber)
> r <- plumb("plumber.R") # Where 'plumber.R' is the location of the file shown above
> r$run(port=8001)
@@ -28,3 +38,4 @@ R version 3.4.4
+
diff --git a/packageinstall.sh b/packageinstall.sh
new file mode 100755
index 0000000..d99af8d
--- /dev/null
+++ b/packageinstall.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/bash
+while IFS=" " read -r pkg;
+do
+
+
+ [ -z ${pkg} ] && help
+
+ REXEC=$(which R)
+
+ if [ -z ${REXEC} ]; then
+ echo "R not found, please ensure R is available and try again."
+ exit 1
+ fi
+
+ echo "install.packages(\"${pkg}\", repos=\"https://cran.rstudio.com/\")" | R --no-save
+done < requirements.txt
+
+
+
+
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..65f77c2
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,6 @@
+plumber
+jsonlite
+readr
+futile.logger
+tryCatchLog
+ggplot2 \ No newline at end of file
diff --git a/run.R b/run.R
new file mode 100644
index 0000000..6733c2e
--- /dev/null
+++ b/run.R
@@ -0,0 +1,4 @@
+
+library(plumber)
+r <- plumb("plumber.R") # Where 'plumber.R' is the location of the file shown above
+r$run(host="0.0.0.0", port=8001, swagger=TRUE) \ No newline at end of file