Category "r"

Printing regression coefficients from multiple models to a shared data frame

This is a little rudimentary, I know. Basically, I want to use the save data from the coef function to a shared data frame for models that all pull limited poss

Rolling Window Regression by group in R (with dates)

THIS IS MY DATA I have a panel data in R, so I want to create a rolling window linear regression by group. For instance, I have a lot of dates from 1 to 618. E

Shinydashboard isn't rendering the UI properly on AWS Shiny-Server

When I run the following app.R file everything works perfectly. library(shinydashboard) ui <- dashboardPage( dashboardHeader(title = "Basic dashboard"),

Sum over previous periods for each period for each subject - R

A MWE is as follows: library(dplyr) Period <- c(1, 1, 1, 2, 2, 2, 3, 3, 3) Subject <- c(1, 2, 3, 1, 2, 3, 1, 2, 3) set.seed(1) Values <- round(rnor

Why does this selectizeInput minimum values function not work correctly for 2 digit numbers even though it works fine for single digit numbers?

This one has me puzzled. The below code extract uses selectizeInput() to allow the user to choose to/from periods for purposes of data analysis (latter not show

Logarithmic scale for leaflet legend and color palette

I am plotting GIS data using leaflet in R and I am setting the colour of the plotted points to a value in the data set. The data values span a wide range and i

Limit row selection in DT Table in Shiny

I am currently trying to limit my selection in a DataTable in Shiny to just two rows - I want the table to not allow the user to click on more than rows (but al

Benford - Dataset with NA strings returns an error in extract.digits

I've a dataset of macroeconomic data like GDP, inflation, etc... where Rows=different macroeconomic indicators and columns=years Since some values are missing (

Cross comparison of columns of the same data.frame

I have a data.frame that looks like this: > DF1 A B C D E a x c h p c d q t w s e r p a w

R plotly - Plotting grouped lines

I am migrating over from ggplot2 to plotly, in order to take advantage of the interactive features they offer. I do realize that the plotly library has a ggplo

feature importance in mlr3 with iml for classification forests

I calculate feature importance for 2 different types of machine learning models (SVM and Classification Forest). I cannot post the data here, but I describe wha

XML data extraction where not all parent nodes contain the child node

I have an xml data file where user has opened an account and in some cases the account has been terminated. The data does not list the value when account has no

Plot on the next slide

I am preparing some slides in RMarkdown, and I need to plot the code on one slide and the plot on the next one, so I frequently find myself doing something on t

How to render output of stargazer in Rstudio's source pane?

First of all let me say that when I knit a full document that the output of stargazer is as expected. What I'd like to do is render it in my source pane under

(Cubic) spline interpolation

I want to perform a (cubic) spline interpolation for population data to "transform" yearly data into quarterly data. I know that there are a fair number of flaw

R CMD CHECK "Found the following assignments to the global environment:" [closed]

Running R CMD check on my package I'm receiving the following warning message: Found the following assignments to the global environment: Fil

How to use write.table to download a dataframe into a nice csv/Excel file?

I am trying to use the write.table() function, within Shiny downloadHandler(), to download the df reactive dataframe as a .csv file, per the reproducible code a

How to obtain RMSE out of lm result?

I know there is a small difference between $sigma and the concept of root mean squared error. So, i am wondering what is the easiest way to obtain RMSE out of l

Two methods of recovering fitted values from a Bayesian Structural Time Series model yield different results

Two conceptually plausible methods of retrieving in-sample predictions (or "conditional expectations") of y[t] given y[t-1] from a bsts model yield different re

Keyboard shortcut for code chunk in R Markdown for windows gives í

Using RStudio for windows. Help says keyboard shortcut for inserting code chunk is Ctrl + Alt + i, which should give me: ```{r} ``` Instead, I get í