Category "r"

Why does lm generate NA for each independent variable?

I tried to make a linear regression with the lm function, but the output is NA for every independent variable. The dataframe is numeric. I have already tried t

How to avoid margin references being placed on top of each other in quarto

Quarto is designed to supercede Rmarkdown. It supports many languages and offers new features. One new feature is the ability to place citations and other conte

Making neural network training reproducible using RStudio's Keras interface

I'm trying to make neural network training reproducible using RStudio's Keras interface. Setting a seed in the R script (set.seed(42)) doesn't seem to work. Is

R not attached in VS Code on Win10

I am recently switching from RStudio to VS Code. I have installed R extension in VS Code, but when I open VS Code and R terminal, R cannot be loaded. I followed

Scalable/Iterative Large Data Frame Dimensionality Reduction R

I often have truly large data frames (ie 10 to 40 columns, millions to hundreds of millions of rows) that I would like to perform dimensionality reduction on in

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