R-部署在Shinyapps.io中的闪亮应用程序中的仪表板日期

时间:2020-05-13 01:19:26

标签: r date shiny shinydashboard

我已经在Shiny中创建了一个仪表板,该仪表板每周有3次新数据,因此我试图使用命令“ today()显示我的数据在信用中的最后更新日期

当我发布它时,“ strong>”,但是当有人在Shinyapps.io中重新加载仪表板时,更新日期将更改为该当前日期。

有什么方法可以在发布日期后固定日期而不必手动写下日期?

这是我的代码:

while (scanner.hasNext()) {
        String s = scanner.nextLine();
        String[] arr = s.split(":");
        int level = Integer.parseInt(arr[0]);
        int point = Integer.parseInt(arr[1]);
        points[level] = point;
    }

2 个答案:

答案 0 :(得分:1)

我不确定您是否已经找到解决方案。这是我最近使用的。

您可以在UI中使用数据的修改日期。在全球范围内。 R,请使用以下命令获取数据的修改日期:

updateDate <- format(file.info("file path")$mtime, "%Y-%m-%d")

,然后使用updateDate代替today()

答案 1 :(得分:0)

发光的时间在服务器上是不稳定的,在外面是陈旧的

Option Explicit ' It is a good practice to use this to force the compiler to ask for
                ' Var declaration before use it

Sub importdata()
    Dim FileToOpen As Variant
    Dim OpenBook As Workbook
    Dim RngCopy As Range  ' Var to store the range you want to copy
    Dim RngPaste As Range ' Var to store the rante you want paste the txt file data
    Dim A As Worksheet    ' ActiveSheet of the open book stored in "OpenBook" var
    Dim B As Worksheet: Set B = ThisWorkbook.Worksheets("rawdata") '... Well RawData...
    Dim r
    Dim p
    Dim i
    FileToOpen = Application.GetOpenFilename( _
                        Title:="Select file extracted", _
                        FileFilter:="All Files (*.*),*.*", _
                        MultiSelect:=True)
    'As mention Ron Rosenfeld, you need to use Multiselect

    'Since you want several files, you need a LOOP, a For Loop!
    For Each i In FileToOpen ' no matter if is 1 or many files you take, will work
        If FileToOpen = "False" Then Exit Sub 'But if you take no files will exit with no error
    'If FileToOpen <> False Then
        Set OpenBook = Application.Workbooks.Open(FileToOpen) 'the macro open the file
        Set A = OpenBook.ActiveSheet 'Store the active sheet inside A
        r = A.Range("A1").SpecialCells(xlCellTypeLastCell).Row 'Here look for the last cell, this is like
                                                               ' press the CTRL+END keys in the keyboard
                                                               'I asume your data in only en column A
                                                               'goto to the last cell and take the number of the row
        Set RngCopy = A.Range(Cells(1, 1), Cells(r, 1)) 'Take the whole range, and I asume you want to take
                                                        'From A1 to the last row, A1000 ej.
        'OpenBook.Sheets(1).Range("A:A").Copy
        B.Activate 'Go to rawdata!
        p = B.Range("A1000000").End(xlUp).Row + 1 'Here! From the very last cell.
                                                  'Notice: if you have Excel 97 and before, you need to change to
                                                  '65000, if not, 1000000 will work.
                                                  'From the A1000000 to the top, tell the row + 1
                                                  'Mean... one row bellow the last row in your data.

        Set RngPaste = B.Range(Cells(p, 1), Cells(p + r, 1)) 'Look Here!
                                                             'The last cell (last row + 1 = p) of your data in rawData plus
                                                             'The data you want to insert bellow that data.
                                                             'p + the count of the rows in the new data (r)
                                                             'p + r
                                                             'all this just in column A
        RngPaste.Value = RngCopy.Value
        'We don't use COPY, only if is necesary!
        'We transfer data from here to there!
        'Now we can tell B = A
        'B.Range("A1").PasteSpecial xlPasteValues
        OpenBook.Close False 'Good Boy!!!

        'it is good practice to clean your vars/objects
        Set OpenBook = Nothing
        Set A = Nothing
        Set B = Nothing
        Set RngCopy = Nothing
        Set RngPaste = Nothing
     'End If
    Next i
End Sub