Category "r"

How to permanently set fix my working dir?

Every time I restart R I issue the following command: setwd("C:/Users/avtarsingh/Downloads") How do make this my permanent working dir

Do not wipe out (user entered) values of reactive variables when changing input values

I want to collect individual information (name and age) as user input with the attached demo code. The initial number of individuals is 1, and when the user inc

R: Plotting panel model predictions using plm & pglm

I've created two regression models using a linear panel model with plm, and a generalized panel model using poisson with the pglm package. library(plm); librar

How to write raster to depreciated crs with terra?

I'm working with data that comes in a depreciated crs and want to avoid reprojection after converting the dataset to a SpatRaster. It seems that gdal is automat

Grouping items in certain intervals and multiplying them with their associated values under another column in R

df_final %>% mutate(Temp_Zones = cut(max_temp, c(0, 40, 60, 80, 100, 120))) %>% group_by(Temp_Zones) %>% summarize(X=n()) %>% save(df_f

Recognizing and Clicking Alert with RSelenium

I'm having some difficulty with an alert I receive during a for loop. Effectively, I can't figure out how to recognize the alert when it comes up and then close

R: unzipping large compressed .csv yields "zip file is corrupt" warning

I am downloading a 78MB zip file from the UN FAO, which contains a 2.66GB csv. I am able to unzip the the downloaded file from a folder using winzip, but have b

Install R packages using docker file

I have installed R using below line in my docker file. Please suggest how do I specify now packages to be installed in my docker file. RUN yum -y install R-cor

Is there an option type?

This language being multi-paradigm, I wonder if there exists an Option type in R (Some/None), natively or in a package. It would be similar to F#, or to C# null

Overlaying jittered points on boxplot conditioned by a factor using ggplot2

I am making a boxplot conditioned by a factor similar to this example: p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(am)))

Suddenly error 'Cannot create a RasterLayer object from this file.' in script that worked before

I have a script where I read a raster stored as .tif : f_treecover <- raster('Landcover_data/treecover_res_100_q.tif') The script used to run fine

replacing missing values in r

I need help in replacing missing values in the following dummy file. The following rule need to be followed when replacing a missing value. If the value is the

Adding directional indication to flow map in R

I'm just getting started on visualising data with R. I've been working on creating a flowmap based off lats and long data from origins and destination of vario

How to change text color in Quarto slides?

After adding CSS style colour as green The editor is making Heading 1 green but in the RStudio slide Preview, the text followed by Heading 1 is green but not th

RStudioServer - load/upgrade preferred set of packages to default sys path (/opt/R/4.2.0/lib/R/library) from R shell

Though an 'old guy' in unix world, I've little experience with RStudioServer and R, acting here as an 'admin' for a shared server for statisticians on a cancer

Creating a Leaflet map in code workbook in Foundry

Anyone created a leaflet map in Code Workbook using r-Leaflet? I have a functioning script that runs (also double checked in R) but how do I get it to visualise

R flextable - How to add a table-wide horizontal border under a merged cell

Is there a smart way to have a horizontal border table wide when you have merged cells? (In the example below, it is not yet table wide). Or should I write a f

R datatable rotate header not aligning

I am trying to rotate the header for a datatable. I was able to rotate the header but the rotated header is not aligning with the columns. This is what I have n

How do I change the directory displayed in the RStudio file pane / navigator using code?

I am writing an R package for a lab notebook. One function makes a new directoy with some Rmd files, opens the files with file.edit, and changes the current wor

R: Panel Data: calculating mean and median of variables based on date / dummy variable

So i am analysing fund panel data. I estimated a fixed effect model with double clustered error terms along the identification (ISIN) and (Date). Each fund has