Automatically reclassify small SpatialPolygons inserted into large...
I would like to assign small polygons nested in larger polygons the same values as those of larger polygons. In figure 1 you can see the small polygons in raster format:and in figure 2 in...
View ArticleIntegration in R with integrate function
library(pbivnorm) rho <- 0.5 f1 <- function(x, y) { pbivnorm(log(x)-10, log(y)-10, rho)*(exp(-(log(x)-10)^2/2)/(sqrt(2*pi)*x))*(exp(-(log(y)-10)^2/2)/(sqrt(2*pi)*y)) } integration1 <-...
View ArticleHow to get multiple updatePickerInput logic correct in Shiny
K Y'all, I'd really appreciate some help here. I'm having trouble getting the logic for the multiple shinyWidgets::updatePickerInput correct.The example below WORKS...but, you'll notice, you can only...
View ArticleHow can I use the `td` command from the `tempdisagg` package to disaggregate...
I have a monthly frequency data which I am trying to disaggregate into a daily frequency data. So I use the td command from the tempdisagg package in R using the code below: dat=ts(data[,2])...
View ArticleFinding start and end time index conditionally for xts dataset
I am trying to extract the start and end time index separately for all the labels and store them separately. EDITAs suggested in the comment I prepared an example datasetdata <- rnorm(11) dates1...
View ArticleRecoding NAs conditional on multiple columns in r
I have a lot of survey data where respondents were asked many different multiple-choice questions for which they could choose multiple answers. The survey software coded each question as multiple...
View ArticleHow to implement read.zoo function correctly on my data frame
I have a data frame of apple stock prices YTD as below file name appl.csvDate Close.Last Volume Open High Low 1 12/20/2019 279.44 68972090 282.23 282.65 278.56 2 12/19/2019 280.02 24626950 279.50...
View ArticleFlexdashboard in R with Shiny
I am trying to create an interactive dashboard in R with help of flexdashboard and shiny.I have this table where are seven columns (translated to English): region, year, age, age2, ageMean, jobPosition...
View ArticleReturning bunch of matrices using RCPP in C++ in an efficient way using a list
I am trying to return a bunch of matrices using RCPP. My code below is extremely inefficient. I would like to know if the following code can be efficient.#include <RcppArmadillo.h> //...
View ArticleR code to assign a sequence based off of multiple variables [duplicate]
This question already has an answer here:Recode dates to study day within subject 2 answersI have data structured as below:ID Day Desired Output 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 3 3 2 4 1 2 4 1 2 5 2 3...
View ArticleTwo Reactives Error Invalid Argument to Unary Operator
I am trying to build an app that displays a .csv file in table format. The user can choose with radio buttons one of two ways to display the table. I have defined those two ways with the filedata() and...
View ArticleR function for FFT in different frequencies?
The FFT in R is defined for k = 0, ..., N - 1.What if you wanted the frequencies for different values of k?I've seen definitions of FFT that use k = - (N - 1), ..., 0, ..., N - 1.How would you get...
View ArticleR: error when doing backward feature selection with rms::fastbw
I want to perform backward feature selection using the function fastbw from the rms package. I use a sample dataset PimaIndiansDiabetes as below:library(mlbench) data(PimaIndiansDiabetes)...
View ArticleCalculating a nested sum
I would like to compute in R something of the following kind:It is important that the summand could be any function f(y,x).My approach so far is with nested for loops:n <- 5 fun <-...
View ArticleHow can I dynamically create new variables/columns in R using dplyr?
I am new to Stackoverflow and quite new to R. I would really appreciate your help.I am using dplyr's mutate() function to create a set new columns based on one initial column. For an a priori known...
View ArticleCalculate Retention Rate on one column in R
I would need your advice as I am struggling to find out the right command in R.Basically I would like to calculate the retention rate for the specific customers. The customer_math is the snapshot of...
View ArticleHow can I load CSV data points onto a shapefile in R?
I am trying to plot Starbucks locations from CSV data onto a city shapefile that I've loaded in. I want to essentially create a heat map or simple scatter plot with the Starbucks locations on the city...
View Articleusing dateInput as the date component of a url to scrape from
My goal is an app that scrapes and plots html table data, by user-selected date. Each day of data has one url ending in yyyymmdd ,...
View ArticleR Shiny Handsontable automatically updating function after changing a single...
I am trying to get familiar with the rhandsontable package. So I tried something I thought should be pretty easy but I can't find a solution. Here is the idea: I am creating a dataframe with random...
View ArticleCreate dropdowns and Area chart in R shiny
I am new to R .I am creating a dashboard with date ranges and I have one dropdown for column names of the data table and I need to create another dropdown of column commenttype(i.e., good or bad) that...
View Article