Category "r"

R: Does fixest package support panel data analysis?

I am working with fixest package. Great results so far. My data could be set as a panel. Is there any way for fixest to run run panel data analysis. My model lo

Is there a way to initialize or modify a list that allows to reference previous values?

I want to store non-rectangular data in a structure, e.g. in a list. Referencing previous data works using a tibble, e.g. like this: dat <- tibble(a = 2,

How to read many lidar files (.las) at once and combine them into one dataframe in R

I have folder where many lidar(.las) files. It looks like library(rgdal) library(raster) library(tmaptools) library(tmap) library(lidR) library(RStoolbox) las=

Web scraping returns empty character

I am attempting to put together a real estate dataset, however when I try and extract the text from the website, for example the names of the places, it returns

Read .csv file in R

I am a beginner to R, I have a file like below. state population Alabama 4779736 Alaska 710231 Arizona 6392017

What does the specified number 1 in this code mean?

for (i in 1:25) { pid.means[,i] = apply(get(paste("pid.tf",i,sep="")), 1, mean, na.rm = TRUE) } I understand the function of this for loop, but i can't fin

How to split legend of a plotly chart when using to two y axes

I am creating a grouped bar plot using plotly. As level of my values differ I am using two y axes. I would like to split a legend (idea presented on a picture

R replace string in df with partial match in a list

I have a dataframe (df) in R and I want to create a new column (city1_n) that contains a line stored in the list key whenever there is a partial match between c

Shell using path pulled from cell in workbook using VBA

My code runs a model in R directly from Excel. I want to simplify installation so instead of: path = """C:\Program Files\R\R-4.1.1\bin\Rscript.exe"" C:\Users\di

R Studio Fatal error: 'R_TempDir'contains space

I tried to download the latest version (4.2.0) of R on my windows computer and received this error message upon trying to open the program. "Fatal error: 'R_Te

How can I make one plot from multiple variables in ggplot?

I'm trying to make a pre-post change plot for three groups. In my data frame, pre data and post data are stored as two different variables like this. pre_treat

Tried scale_linetype_manual to add legend but not successful

Following the thread from Tried p + scale_fill_discrete(name = "New Legend Title") but legend title still not changing, I now only want to generate line plot wi

How to create a dummy variable corresponding to a change in a value in R

I have the following data: week <- c(1,2,3,4,1,2,3,4,1,2,3,4) product <- c("A", "A", "A", "A", "B", "B", "B", "B", "C", "C", "C", "C") price <- c(5,5,6

gridtext::element_markdown doesn't apply margin with css selector

I'm trying to define different margins for x-axis labels in ggplot2 using css syntax, as allowed by ggtext package. I created an object with the CSS selector an

Multiples rows to one row in R [closed]

In R, I have a data frame with several values. I would like to have a data frame that transforms the data frame into a data frame with just on

Error in deployment of shinyapps Error accessing GitHub repository nstrayer/shinysense. HTTP 401: Unauthorized

I am trying to publish a shiny app, you can see the source code here, it was being deployed correctly until I tried using the shinysense package This is the err

How to extract the coefficients of a linear model and store in a variable in R?

I have a data frame and I did a linear model. I want to extract the coefficients and store each coefficient into a variable using R. This is my data frame df &l

Split comma-separated strings in a column into separate rows

I have a data frame, like so: data.frame(director = c("Aaron Blaise,Bob Walker", "Akira Kurosawa", "Alan J. Pakula", "Alan Parker", "A

Summarize two dataframes in r

I have two dataframes df1 # var1 var2 # 1 X01 Red # 2 X02 Green # 3 X03 Red # 4 X04 Yellow # 5 X05 Red # 6 X06 Green df2 # X01 X02

Rmarkdown: include plot height in resulting html <img> tag

I am working on a larger RMarkdown-site. Due to the size of images on the pages I implemented lazy loading for images using the loading="lazy"attribute of the &