アプリの作成/デバッグ中に、ページをすばやくテストする必要があります。使っているだけ
install()
opencpu$browser("mypage.html")
ページが更新されていないように見えるので、十分ではありません。
実際には、インストール後にサーバーを再起動する必要があります。そうしないと、ページが更新されない可能性があります。
私はここ数ヶ月、楽しく取り組んできた次の関数を書きました。
testApp <- function(page="",port="",pkg=gsub("^.*\\/","",getwd())){
require("opencpu")
require("devtools")
document();
# install the package
install();
# restart the server (or it will display cached things)
opencpu$stop();
if(port==""){
opencpu$start();
}else{
opencpu$start(port);
}
# visualize
opencpu$browse(paste0("/library/",pkg,"/www/",page));
}
その後、次のことができます。
testApp()
テストしindex.html
たり
testApp("mypage.html")
特定のページをテストします。