Category "r"

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

Plotting value from matching complete pairs in rows

I have data of drug concentrations (DV) that include a parent drug and its metabolite, coded DVID 1 and 2, respectively. They are provided to me as separate ro

download data from site

I am trying to download stock prices from yahoo of several shares at once using R loops. I tried the following code, and it produces results but I would like th

Randomize items in rmarkdown transparently

I have the following rmarkdown document: --- title: "Untitled" output: pdf_document date: '2022-04-28' --- ```{r setup, include=FALSE} knitr::opts_chunk$set(ec

If the number of rows in a group exceeds X number of observations, randomly sample X number of rows

I need to reduce the number of rows in a data set. To do this my strategy is to the number of rows in a group exceeds X number of observations, randomly sample

How to return the range of values shared between two data frames in R?

I have several data frames that have the same columns names, and ID , the following to are the start from and end to of a range and group label from each of the

How to plot a Sequential Bayes Factor as participants are added

I am currently analyzing eye-tracking data using the Sequential Bayes Factor method, and I would like to plot how the resulting Bayes Factor (BF; calculated fro

Plot percentage change figure with 95% CI and stats

I am planning to reproduce the attached figure, but I have no clue how to do so: Let´s say I would be using the CO2 example dataset, and I would like to

Rename several columns using start with in r

I want to rename multiple columns that starts with the same string. However, all the codes I tried did not change the columns. For example this: df %>% renam