r

Converting `dttm` to `date` formatting with as.Date and as_date give different results in R

*爱你&永不变心* 提交于 2021-02-18 12:51:14
问题 I have a large data set with individual columns for event times and dates. I ended up creating a master dttm object with both the times and dates together, but have had trouble when I try to filter based on the date. Here is a sample data set that reflects my own: library(tidyverse) d<- structure(list(date = structure(c(1530921600, 1531008000, 1530403200, 1530489600, 1530576000, 1530489600, 1530576000, 1531008000, 1530921600, 1530662400, 1530748800, 1531180800, 1530748800, 1531526400,

Converting `dttm` to `date` formatting with as.Date and as_date give different results in R

时光怂恿深爱的人放手 提交于 2021-02-18 12:51:13
问题 I have a large data set with individual columns for event times and dates. I ended up creating a master dttm object with both the times and dates together, but have had trouble when I try to filter based on the date. Here is a sample data set that reflects my own: library(tidyverse) d<- structure(list(date = structure(c(1530921600, 1531008000, 1530403200, 1530489600, 1530576000, 1530489600, 1530576000, 1531008000, 1530921600, 1530662400, 1530748800, 1531180800, 1530748800, 1531526400,

R Shiny Dashboard Scroll to Top on Button Click

北战南征 提交于 2021-02-18 12:46:11
问题 Is there any way to scroll to the top of the page in ShinyDashboard on a button click? I've added the following lines in ui.R under dashboardSidebar( : useShinyjs(), extendShinyjs(text = "shinyjs.button = function() {document.body.scrollTop = 0;}"), and the following in server.R under observeEvent(input$button, { : js$button() This seems to work in the app preview in RStudio, but not in browser. 回答1: Using the first Google hit for "javascript scroll to top", the most upvoted answer is window

How do I plot time (HH:MM:SS) in X axis in R

这一生的挚爱 提交于 2021-02-18 12:43:05
问题 I have tried to read through stackoverflow, blogs, books etc but have been unable to find the answer on plotting time in the x-axis in the following format(HH:MM:SS.000) in R and another quantity on the y-axis. I have the following dataset: Time EcNo 12:54:09.000 -14.47 12:54:10.000 -17.96 12:54:11.000 -15.97 12:54:12.000 -14.61 12:54:13.000 -12.68 12:54:14.000 -10.73 12:54:15.000 -10.54 12:54:16.000 -11.62 12:54:17.000 -12.49 12:54:18.000 -11.12 How would I plot EcNo on Yaxis vs Time(x axis)

Keep formatting when exporting table with DT (DataTables buttons extension)

扶醉桌前 提交于 2021-02-18 12:37:26
问题 I made a shiny app where someone uploads a file, some ratios are computed, and those ratios can be formatted using sliders for thresholds. I use DT::formatStyle for this and it is working really fine. As far as I understand this function, it creates a callback to handle the conditional formatting. Then, I want to export the data, using the buttons extension in DT . I want to keep the formatting when exporting to pdf or printing. It turns out that this doesn't work: the data is exported

Change font size for all inline equations R markdown

六月ゝ 毕业季﹏ 提交于 2021-02-18 12:37:05
问题 I am creating a r-markdown file and using knitr to convert to HTML. When I inline an equation such as X_1,...,X_n \sim N(0,1) it gets converted to HTML output as this . The math text is oversized relative to the plain text font. I can correct this for a single equation with \small X_1,...,X_n \sim N(0,1) . However, I would prefer not to type \small hundreds of times throughout a document. Does anyone know how to correct this with a single settings change or modification so it's applied to all

Change font size for all inline equations R markdown

折月煮酒 提交于 2021-02-18 12:37:01
问题 I am creating a r-markdown file and using knitr to convert to HTML. When I inline an equation such as X_1,...,X_n \sim N(0,1) it gets converted to HTML output as this . The math text is oversized relative to the plain text font. I can correct this for a single equation with \small X_1,...,X_n \sim N(0,1) . However, I would prefer not to type \small hundreds of times throughout a document. Does anyone know how to correct this with a single settings change or modification so it's applied to all

Transforming a table in a 3D array in R

余生长醉 提交于 2021-02-18 12:34:07
问题 I have a matrix: R> pippo.m [,1] [,2] [,3] [,4] [1,] 1 2 3 4 [2,] 5 6 7 8 [3,] 9 10 11 12 [4,] 13 14 15 16 [5,] 17 18 19 20 [6,] 21 22 23 24 and I would like to transform this matrix in a 3D array with dim=(2,4,3). Passing through the transponse of pippo.m I am able to obtain a similar result but with columns and rows rotated. > pippo.t <- t(pippo.m) > pippo.vec <- as.vector(pippo.t) > pippo.arr <- array(pippo.vec,dim=c(4,2,3),dimnames=NULL) > pippo.arr , , 1 [,1] [,2] [1,] 1 5 [2,] 2 6 [3,]

R DT Horizontal scroll bar at top of the table

◇◆丶佛笑我妖孽 提交于 2021-02-18 12:32:14
问题 I have a wide and lengthy DT in shiny. By default I would like to show the horizontal scroll bar on top of the table. Is there a way to do this? My current DT definition looks like below: DT::datatable(dt, rownames = FALSE, filter = fbox, style = "bootstrap", options = list( dom = dom, scrollX = TRUE, columnDefs = list(list(orderSequence = c('desc', 'asc'), targets = "_all")), processing = FALSE, pageLength = 500, lengthMenu = list(c(500, 1000, 5000), c("500","1000","5000")) ), callback = DT:

R DT Horizontal scroll bar at top of the table

ぐ巨炮叔叔 提交于 2021-02-18 12:31:44
问题 I have a wide and lengthy DT in shiny. By default I would like to show the horizontal scroll bar on top of the table. Is there a way to do this? My current DT definition looks like below: DT::datatable(dt, rownames = FALSE, filter = fbox, style = "bootstrap", options = list( dom = dom, scrollX = TRUE, columnDefs = list(list(orderSequence = c('desc', 'asc'), targets = "_all")), processing = FALSE, pageLength = 500, lengthMenu = list(c(500, 1000, 5000), c("500","1000","5000")) ), callback = DT: