我尝试从Google电子表格中访问数据并将其显示为Shiny应用中的表格。确认访问电子表格后,应用程序继续运行而不显示任何内容。但是,将数据打印到控制台可以正常工作。
server.R
library(shiny)
library(googlesheets)
shinyServer(function(input, output) {
sheet <- gs_title("Google Sheet")
data <- gs_read_csv(sheet)
output$table <- renderTable{
data
}
})
ui.R
library(shiny)
shinyUI(pageWithSidebar(
mainPanel(
dataTableOutput('table')
)
))
答案 0 :(得分:3)
如果您使用renderDataTable({})
dataTableOutput()
使用library(shiny)
library(googlesheets)
server <- function(input, output) {
sheet <- gs_title("Google Sheet")
data <- gs_read_csv(sheet)
output$table <- renderDataTable({
data
})
}
ui <- fluidPage(sidebarLayout(sidebarPanel("Test"),
mainPanel(dataTableOutput('table'))
)
)
shinyApp(ui = ui, server = server)
此代码有效:
require_once 'vendor/autoload.php';
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\ServiceException;
use WindowsAzure\Blob\Models\CreateBlobOptions;
$image_string = 'base64 encoded string, not begin with `data:image/jpeg;base64,...`';
$imgdata = base64_decode($image_string);
//get file type from decoded content
$f = finfo_open();
$mime_type = finfo_buffer($f, $imgdata, FILEINFO_MIME_TYPE);
$connectionString = "your_storage_account_connection_string";
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
$blob_name = 'base64image';
$container_name = 'container_name';
$option = new CreateBlobOptions();
$option->setContentType($mime_type);
try{
$blobRestProxy->createBlockBlob($container_name, $blob_name, $imgdata,$option);
}
catch(Exception $e){
echo "Error <br />";
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code.": ".$error_message."<br />";
echo "content " . $imgdata."<br />";
}