Download leaflet map as a png when shiny app is deployed
I have a shiny app where users create maps and then can download them. Locally, this works, but when I have deployed it to shinyapps.io, the download feature no longer works and it indicates it is...
View ArticleCalculate date of birth given age
I have the data below.ID = 201 Age = 40 How do I calculate the Date of birth using this info and the Sys.Date() function?!
View ArticleHow to apply function over a list by taking list of list elements as function...
Reproduce-able data set- set.seed(55) data <- rnorm(8) dates <- as.POSIXct("2019-03-18 10:30:00", tz = "CET") + 0:7*60 dataset <- xts(x = data, order.by = dates) colnames(dataset) <- "R"...
View ArticleKendall's tau for two binary variables
I have to calculate many correlations with mostly ordinal variables and I use Kendall's tau for this. In some cases there is one binary and one ordinal variable and in some cases there are two binary...
View ArticleHow can I create RMarkdown files that render good in PDF and HTML which also...
I have been working on some documents that should render in both HTML and PDF. For referencing in Latex I have used the \ref{fig:fig1}style and giving figures a numbered caption.For referencing in HTML...
View ArticleStore dataframe to Google Cloud Plateform (GCP) in R
I am learning programming in R language and want to learn storage basics. I have created an R script that gets data from Google Analytics API and stores it in a local dataframe (on my own computer) to...
View ArticleHow to perform a one-sample t-test for each row in just one column in R?
In my dataset I have 14 columnes and originally 48 rows. I reduced row size to 2, because working on problems on R is much easier for me, like this. The first column consists of a participants number,...
View Articlereusing ouputs$xxx across tabs in navbarPage
Im fairly new to Shiny - especially how to make thecode compact and avoid duplication. To simplify my problem (code below): I want to make use of the navbarPage, because i like the overview it gives.In...
View ArticleMinimising objective function problem using lpsolve in R
I'm tackling a simple linear optimisation problem. I have a bunch of crops with have their associated land requirements per tonne and their water footprints per tonne. I want to know how many tonnes of...
View ArticleRule tables to avoiding nested ifelse statements
Idea is to have manageable approach to define rules from some table:library(data.table) a <- data.table(rule = c("rule1", "rule2", "rule3"), bool = c(T,T,F)) a # rule bool # 1: rule1 TRUE # 2: rule2...
View ArticleInterdependent Network visualisation
I've come across some questions when using muxViz (the package developed by Manlio De Domenico with R and GNU Octave -- thanks for developing this!).I was trying to create and visualise an...
View ArticleHow to apply wilcox test on the predicted data in R?
We use the following code for k-fold cross validation training data when we have one data file,set.seed(308) rand_search <- train( Effort ~ ., data = d, method = "svmRadial", ##Create 20 random...
View ArticleHow can I do a break or white space in line plot in R
I want to know how can I do a break or white space in a line plot in r using only the function plot, cause I have a big project and I can't change for ggplot. For example I have data of temperature all...
View Articleequivalent to R's `do.call` in python
Is there an equivalent to R's do.call in python?do.call(what = 'sum', args = list(1:10)) #[1] 55 do.call(what = 'mean', args = list(1:10)) #[1] 5.5 ?do.call # Description # do.call constructs and...
View Article2 by 2 table (Class*Sex) using Titanic data from R package "titanic"
I am working on R system data from the R package titanic install.packages("titanic"). The name of the dataset is titanic. I want to conduct a Chi-square test between Class and Sex. I think before doing...
View ArticleConvert a factor column with numbers in k format into numeric without losing...
I have a factor column which has numbers in it. Some numbers are written in k format, for ex. 99k, 9.25k, 91.9k, etc. while others are written in whole like 998, 575, etc. Two things I want to do-:I...
View ArticleImport and transform multiple xml files into DF
I am trying to create a routine for importing numerous xml files from a given directory. Possibly I will have to import over a thousand xml files at one time and turn them into dataframe. I have...
View ArticleIn geom_sf_text, how to nudge x and y in aesthetics?
I would like to nudge the x and y position of text in ggplot2, using sf. The justification of text can be modified in aesthetics, which then requires nudging to be also modified similarly, but nudge_x...
View ArticleRead multiple csv files (and skip 2 columns in each csv file) into one...
I have a folder of about 100 csv files and I want to read them into one dataframe in R. I kind of know how to do this but I have to skip the first two columns in every csv file and that is the part I...
View ArticleWhere is Tidyverse dev version source code located?
The dev version of dplyr introduces a new across() function that applies functions to a selection of columns. I can install the dev version of dplyr in R like this:# install.packages("devtools")...
View Article