R: Vlookup for a 'for' loop
i'm new to R and trying to use it in place of Excel (where i have more experience). I'm still working out the full 'for' logic, but not having the values to determine if it's working how i think it...
View ArticleHow to retrieve current number of leafs (or other info about tree structure)...
I need to write my custom splitting function using rpart package and I found basic official guide: https://cran.r-project.org/web/packages/rpart/vignettes/usercode.pdfIt is shown how to write splitting...
View ArticleHow to pipe SQL into R's dplyr?
I can use the following code in R to select distinct rows in any generic SQL database. I'd use dplyr::distinct() but it's not supported in SQL syntax. Anyways, this does indeed...
View ArticleSet.seed in monte Carlo
#year 2022 R.100<-runif(n=100, min = 40, max = 65) R.100 summary(R.100) R.norm.100<-rnorm(length(R.100), mean = 50, sd=7) R.norm.100` summary(R.norm.100) a=0.6 C=100 f<-seq(from=1.10, to=1.18,...
View ArticleOverlay points on magick image
I have a shiny app where you can upload an image. When you click on the image it adds the x and y coordinates to a reactive dataframe. What I'd like to do is use this dataframe to lay points onto the...
View ArticleWhy does fabletools::model() throw an error with this synthetic data?
[2019-01-02 Update]Removed tsibble development and installed tsibble_0.8.5 from CRAN.Session InfoR version 3.6.2 (2019-12-12) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 19.10...
View ArticleData frame and reactivity in R
I am trying to modify the stockVis app in the shiny tutorial series to plot data using ggplot. The original app also has xts data with daily open, high, low, close (OHLC) data. I am only trying to plot...
View ArticleIn R, how do I create individual time series (to loop trough and run a...
I am starting to automate our Mann-Kendall tests used for time series data of water quality data. It was done in Excel before, but was too much copying and pasting. I want to create an R script to run...
View ArticleGenerate list of all possible combinations of elements of vector
I am trying to generate all possible combinations of 0 and 1's in a vector of length 14. Is there an easy way of getting that output as a list of vectors, or even better, a dataframe?To demonstrate...
View ArticleglmmLasso R Error:Error in grad.lasso[b.is.0]
I am trying to use glmmLasso to run a multilevel logistic regression model, as I believe I am getting some wonky results due to sparse data bias. My outcome variable is a binary (0, 1) variable and my...
View ArticleR not finding package even after package installation
I have always worked with the zoo package, that I have installed a long time ago. Today, I created a new R script, and ran library(zoo) and got the following error:> library(zoo) Error in...
View ArticleIs there a way in R to sumcolumns with different pattern of missing...
I have some variables that I wanted to add together but there are missing observations in some of them and when adding together, it will make the whole row with one or more missing as missing. For...
View ArticleGenerate data from linear model- R
I want to generate data from the following linear model:#y i = 0.5 + 2.5*x i + error, with X˜N(0;0.5) and error ˜N(0;0.25) This is what I have done until now:N <- 1000 sigma2 <- 0.5 sigma2err...
View Articlewhat is the meaning of tilde in cbind in r? [duplicate]
This question already has an answer here:Use of ~ (tilde) in R programming Language 2 answersI saw a cbind command in R:f <- cbind (Web, Facebook, Reading) ~ 1What is the meaning of "~ 1"?Thanks.
View Articlehow to get the column names in pheatmap in shiny?
i want to create a heatmap from user csv file in shiny, so far i have succeeded in reading the table in Shiny and also got the heatmap. however, the row names from the input csv file are not shown in...
View ArticleShiny - todaybutton won't work in airdatepickerinput
I'm having some trouble getting the todaybutton in the shinywidget airdatepickerinput to work.Below you will find a simple example. Ideally the value of the airdatepicker will be set to Sys.time() when...
View ArticleIs there an R package to parse geophysical "Log Ascii Standard" Files (.las...
Is there an R package that can read .las files, i.e. Schlumberger Log Ascii standard files? It should be capable of reading las 2.0 files.Please note:I am not talking about LIDAR .las files here. I am...
View ArticleHow to iterate pushing ActiveX command button in Excel?
I have been given a spreadsheet with an ActiveX control button to execute a complex macro that I can't see the VBA code for because it is password protected. I need to loop through 1000 input values...
View ArticleRemove all duplicates based on different columns and rows in R
I have this condition: ID N1 N2 1 6387 6187 2 6290 6386 3 6295 6295 4 6043 6392 5 6042 6043 6 6050 6031 7 6050 6036 8 6321 6434 9 6440 6397 with duplicates in different columns and...
View ArticleIterating over multiple regression models and data subsets in R
I am trying to learn how to automate running 3 or more regression models over subsets of a dataset using the purrr and broom packages in R. I am doing this with the nest %>% mutate(map()) %>%...
View Article