r

Dealing with nested selectizeInputs and modules

99封情书 提交于 2021-02-11 11:26:03
问题 I am having trouble with nested selectizeInputs, i.e. a group of select inputs where the selection in the first determines the choices in the second, which control the choices in the third, and so on. Let's say I have an select1 that lets you choose a dataset, and select2 which lets you pick a variable in the dataset. Obviously the choices in select2 depend on the selection in select1. I find that if a user selects a variable from select2, and then changes select1, it doesn't immediately wipe

Searching Columns in R shiny Datatable that has Multiple Entries

老子叫甜甜 提交于 2021-02-11 11:24:16
问题 I have a datatable in R Shiny, and one of the columns, Keywords, contains multiple entries for some rows, separated by a comma. I would like these multiple entries to be individually searchable. The default search feature for datatable treats these entries as one, long, single item. For example, row 2's value for the column Keywords is "Keyword1, Keyword2". I would like the user to be able to search for either "Keyword1" OR "Keyword2" and find row 2. Currently, the default search bar in

Meteorological Data from XML to Dataframe in R

时光怂恿深爱的人放手 提交于 2021-02-11 10:36:47
问题 I´m trying to analize meteorological data, importing directly to R from it´s native structure in XML. But it seems to be a very complicated XML format not corresponding to the commonly used standard of "one observation per row". The provider of the data has grouped the variables by every ten minutes intervals registered. Here is a piece of the XML code: <?xml version= "1.0" encoding="ISO-8859-1" ?> <mes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C069

Move labels in ggplot2 pie graph

守給你的承諾、 提交于 2021-02-11 10:33:48
问题 I know from How to avoid label overlap in pie chart that I can use ggrepel to make labels not overlap in a pie graph. I would like percentages less than 7% moved to the outside and numbers 7% or more on top of their slice of the pie. Any ideas? library( ggrepel ) library( ggplot2) library( dplyr) library( scales ) library( reshape ) y <- data.frame( state = c( "AR" ) , ac = c( 0.43 ) , man = c( 0.26 ) , ltc = c( 0.25 ) , care = c( 0.05 ) , dsh = c( 0.01 ) ) y2 <- melt( y , id.var="state" )

Move labels in ggplot2 pie graph

怎甘沉沦 提交于 2021-02-11 10:31:27
问题 I know from How to avoid label overlap in pie chart that I can use ggrepel to make labels not overlap in a pie graph. I would like percentages less than 7% moved to the outside and numbers 7% or more on top of their slice of the pie. Any ideas? library( ggrepel ) library( ggplot2) library( dplyr) library( scales ) library( reshape ) y <- data.frame( state = c( "AR" ) , ac = c( 0.43 ) , man = c( 0.26 ) , ltc = c( 0.25 ) , care = c( 0.05 ) , dsh = c( 0.01 ) ) y2 <- melt( y , id.var="state" )

Passing multiple arguments to data.table inside a function

回眸只為那壹抹淺笑 提交于 2021-02-11 10:30:07
问题 Here is the output that I want from data.table . library(data.table) dt_mtcars <- as.data.table(mtcars) ## desired output ---- dt_mtcars[mpg >20 , .(mean_mpg = mean(mpg) ,median_mpg = median(mpg)) , .(cyl, gear)] cyl gear mean_mpg median_mpg 1: 6 4 21.000 21.00 2: 4 4 26.925 25.85 3: 6 3 21.400 21.40 4: 4 3 21.500 21.50 5: 4 5 28.200 28.20 I want to get the output by passing arguments to a function. processFUN <- function(dt, where, select, group){ out <- dt[i=eval(parse(text = where)) ,j

SplitRatio results with sample.split (caTools)

南楼画角 提交于 2021-02-11 10:00:05
问题 The SplitRatio argument does not behave like I would expect it to. For example, if the SplitRatio is 0.5 , I would expect 50% TRUE and 50% FALSE assignments. However, when running the code below on a vector of length 20 I would expect 10 TRUE assignment but I frequently get results like 13 or 14. Why is that? vec <- sample(1:10, 20, replace = TRUE) length(vec) split <- sample.split(vec, SplitRatio = 0.5) vec.split <- subset(vec, split == TRUE) length(vec.split) [1] 13 来源: https:/

SplitRatio results with sample.split (caTools)

江枫思渺然 提交于 2021-02-11 09:59:48
问题 The SplitRatio argument does not behave like I would expect it to. For example, if the SplitRatio is 0.5 , I would expect 50% TRUE and 50% FALSE assignments. However, when running the code below on a vector of length 20 I would expect 10 TRUE assignment but I frequently get results like 13 or 14. Why is that? vec <- sample(1:10, 20, replace = TRUE) length(vec) split <- sample.split(vec, SplitRatio = 0.5) vec.split <- subset(vec, split == TRUE) length(vec.split) [1] 13 来源: https:/

SplitRatio results with sample.split (caTools)

我的未来我决定 提交于 2021-02-11 09:59:19
问题 The SplitRatio argument does not behave like I would expect it to. For example, if the SplitRatio is 0.5 , I would expect 50% TRUE and 50% FALSE assignments. However, when running the code below on a vector of length 20 I would expect 10 TRUE assignment but I frequently get results like 13 or 14. Why is that? vec <- sample(1:10, 20, replace = TRUE) length(vec) split <- sample.split(vec, SplitRatio = 0.5) vec.split <- subset(vec, split == TRUE) length(vec.split) [1] 13 来源: https:/

How to authenticate in Google Big Query using Bigrquery without user input using a service account

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-11 09:52:32
问题 I need to run an R script using windows task scheduler, however the script includes an authentication to Big Query using Bigrquery. I have the service account authentication. When I run the script I'm asked for user input which doesn't let me run the script as scheduled. I get: The bigrquery package is requesting access to your Google account. Select a pre-authorised account or enter '0' to obtain a new token. Press Esc/Ctrl + C to abort 1. ("Account I've used to authenticate") Here my code: