Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 205330 articles
Browse latest View live

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 Article


How 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 Article


How 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 Article

Set.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 Article

Overlay 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 Article


Why 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 Article

Data 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 Article

In 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 Article


Generate 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 Article


glmmLasso 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 Article

R 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 Article

Is 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 Article

Generate 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 Article


what 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 Article

how 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 Article


Shiny - 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 Article

Is 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 Article


How 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 Article

Remove 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 Article

Iterating 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
Browsing all 205330 articles
Browse latest View live