Category "r"

dplyr get linear regression coefficients

I'm wondering if there is a better way is to get linear regression coefficients as columns in dplyr. Here is some sample data. mydata <- data.frame( S

Error when trying to download species models in R with ebirdst::ebirdst_download()

I've requested an access key and set it. Sys.getenv("EBIRDST_KEY") returns the correct key. ebirdst_download(species = "Sharp-tailed Grouse") returns an error

Keep libraries in memory even when all browsers are closed

I have a shiny app on RStudio's free shiny server that uses a fair number of libraries which results in a slow calculation time. The time for the UI to load is

Find a probability of Poisson distribution in R

Can somebody help me how can I calculate a probability p from the Poisson equation (programming in R)? I know that there is the ppois function, but I'm not sure

How to calculate correlation(r) between two raster datasets in R?

I have two (NPP_BEGA and ENACT_BEGA) stacked raster dataset. They have the same spatial resolution, extent and dimension. I want to run and map the correlation(

How to change a raster to a specific spatial resolution?

I would like to change the resolution of a raster. For example, let’s take this Landsat 7 images at ~ 30m resolution. library(terra) #> terra 1.5.21 f

Matching colours with column values in gt

I have a simple piece of code that tries to publish a table which colours columns according to the colour listed in the contents using the package gt. df <-

How do obtain max and mean values from different columns with a Date column condition in R?

I am trying to get the daily mean and maximum values for each pollutant. For each of the monitoring stations, the daily mean and maximum values of each pollutan

the function display_html not working in Jupyter Lab

This "R code" works fine in Jupyter but not in lab: library(IRdisplay) display_html( ' <script> code_show=true; function code_toggle() { if (code_s

Display a projected raster on a projected basemap in R/leaflet?

Is it possible to display a projected raster on a projected basemap in R/leaflet? The addRasterImage() functions says that the projection needs to be in EPSG:38

Add MC Holdout layers to trained model in Keras

I am looking for a solution for a problem that has arisen when building a generic ANN for image classification in R. What I want to do is either: Design and com

rewriting `summarise_all` without deprecated `funs`, using Simple list and Auto-named list

I'm trying to count the number of NA values in each of 2 columns. The code below works. temp2 %>% select(c18basic, c18ipug) %>% summarise_all(funs(sum

Asterisks in the output of R describe function

What does it mean the asterisk next to some item names in the descriptive statistics table given by describe function (package psych) in R ?

How to project a new data row onto PCA space using dudi.mix in R?

I have a mixed dataset (comprising continuous, ordinal and nominal variables) that is high-dimensional (with more variables than rows). I want to perform a mixe

Having Problems Plotting a 3D Map in R

I am having problems plotting a 3D map in Rstudio. Here is the code I used; plot_ly(myLocalClean, x = ~date, y = ~median, z = ~sales, opacity=0.5) #3D my resul

Extra learners in mlr3 [closed]

I cannot use models in mlr3 other than random forest, part, knn, svm, gbm etc. I am using mlr3extralearners package but still it seems there a

R table function not showing zeroes

I'm kind of ignorant on the topic so it might be a simple mistake, but I have used cutpoints and then i'm trying to print a table with the sum of elements in ea

How to add fileInputs into DT

I need to add a fileInputs to each row of a table. Unfortunately, this widget does not work correctly, unlike regular actionButtons and other elements. The wind

Compute and display mean of dependent variable in modelsummary output tables in R

I am using the feols command from the fixest package in R to estimate fixed effect regressions, in most cases with weights. In order to output my results, I am

I am having issue running this r code. I am trying to use ANN classification model to classify one variable using the other variables

this dataframe is about Farmers Risk attitude. I want to classify Risk Attitude, using Risk drought in Artificial Neural Network model. x=data.frame(x$Riskdroug