Quantcast
Channel: Active questions tagged r - Stack Overflow
↧

Automatically open multiple scripts in a detached source window

I'm working in RStudio and prefer having a full-window editor separate from the console. By default, when I run:file.edit(c("script1.R", "script2.R"))The files open as tabs in the docked Source pane of...

View Article


Changing code blocks style in bookdown chapters

I am trying to change the style of code blocks in bookdown for the html output. As instructed in the official documentation here I am doing the following:```{r class.source="bg-danger",...

View Article


Image may be NSFW.
Clik here to view.

gtsummary R package: how to render latex within a table cell when knitting to...

I am trying to use the gtsummary R package for making a table when knitting to PDF. Some of my cells need to use latex for properly displaying various math symbols (e.g. a greater than or equal to sign...

View Article

Problems downloading a dataset for Torch for R

I'm trying to load the MNIST dataset in Torch for R, following...

View Article

Can't publish an app on https://cloud.opencpu.org/ using Github Webhook

Two years ago, the Github webhook was working fine : a push to master was all that was needed.Today, I just couldn't update the package.All I am getting is a 400 reply, and "Currently only Github CI is...

View Article


Define anonymour variables elsewhere in the code R

I am trying to render my code a bit less "unique" in the sense that I want this to be able to run regardless of what kind of dataset I use.I'm essentially running different algorithms of classification...

View Article

Image may be NSFW.
Clik here to view.

Can you put labels on a geom_dotplot with gghighlight?

I would like to use the label_key argument of gghighlight::gghighlight to put a label on highlighted dots of a geom_dotplot(). Unfortunately the argument does not have any effect on geom_dotplot(),...

View Article

Is there a way to render plots from Data Explorer library on Shiny App

I'm trying to plot the outcomes of EDA on to Shiny App, I have been using DataExplorer library for the same and i'm able to perform operations on rmarkdown notebook. I was thinking to integrate the...

View Article


How to visually compress ggsurvplot axis break while skipping intermediate...

gg_survival_list <- ggsurvplot( km_fit_os, data = GBM_OS_valid, conf.int = TRUE, conf.int.alpha = 0.2, risk.table = TRUE, break.time.by = 6, censor.shape = "+", censor.size = 4, xlab = "Months...

View Article


combining multiple .csv files and retaining folder name

I know this has been done before but I'm struggling to get it to work with my code. I have multiple .csv files with different headings/number of columns. The columns are in the same order and I really...

View Article

Why can't I render any Quarto documents into pdfs?

I am able to render Quarto documents into html just fine, but whenever I try pdfs I get this error:compilation failed- no matching packages LaTeX Error: File scrartcl.cls' not found.Type X to quit or...

View Article

Image may be NSFW.
Clik here to view.

Financial application - Discretization [closed]

I'm currently trying to implement the following equations (in RStudio).'pi' corresponds to the proportion (of the funds 'F') which is invested in risky assets (parameters : delta, sigma). The remaining...

View Article

Subset NetCDF file by Longitude and Depth and Calculate Mean

I am working with a NetCDF file in R using the ncdf4 library. I want to subset the file based on specific conditions. The file contains oceanographic data (temperature) with dimensions for longitude,...

View Article


Dynamically change font_scale of bslib/shiny app

In my app, I want to enable the user to change the text size (similar to the wikipedia appearance).I thought the font_scale parameter of bs_theme would be a good place for that.However, changing...

View Article

How to extract data from leaflet-generated pages

Is it possible to scrape the polygon data from this interactive map in R?🔗https://fogocruzado.org.br/mapadosgruposarmadosThe map shows territories controlled by armed groups across different years. I'd...

View Article


how to download a zipped file from https://www2.census.gov within R

I'm curious if there's a straightforward way to download this data file within an R session? This zipped file downloads without any issues in both firefox and chrome for...

View Article

Pass data object inside the secondary axis

I have below ggplotlibrary(ggplot2)ggplot(faithfuld, aes(waiting, eruptions, z = density)) + geom_raster(aes(fill = density)) + geom_contour(colour = "white", binwidth = 0.002) +...

View Article


Warning: non-integer #successes in a binomial glm! (survey packages)

I am using the twang package to create propensity scores, which are used as weights in a binomial glm using survey::svyglm. The code looks something like this:pscore <- ps(ppci ~...

View Article

Image may be NSFW.
Clik here to view.

Why is the level not showing up on the graph itself? [closed]

ggplot(p, aes(x = Context, y = InFavor, ymin = lcl, ymax = ucl, shape = Level, color = Mode)) + geom_point( position = position_dodge(width = 0.5), size = 3) + geom_errorbar(aes(ymin = lcl, ymax =...

View Article

How to prevent row names when creating a data frame from a vector

What I do is like this:vec <- setNames(c(3,2,1), c("a", "b", "c"))df <- data.frame(my_var = vec)print(df)#Outputmy_vara 3b 2c 1Is there a way to prevent the newly created data frame from...

View Article

x=x as argument: what does it do?

E.g. in sort(x=x) or median(x=x) where x is a numeric vector.I have never seen this kind of notation in another language.What does the argument x=x mean, why is it used and is it called something...

View Article


Selecting multiple files with file.choose() on a MacBookAir not working

I am running the package 'pophelper' in RStudio on a MacBookAir where I need to choose multiple files using file.choose(). However, when the interactive window pops up I can only highlight one file and...

View Article


Using htmlwidgets in litedown

The R markdown package no longer supports htmlwidgets, and is no longer supported itself. It suggests that litedown has superseded it.Added to clarify: The markdown package is not the same as the...

View Article

Transposing data frames using the tidyverse

I've been trying to replicate the results from this blog post in R. I am looking for a method of transposing the data without using t, preferably using tidyr or reshape. In example below, metadata is...

View Article

Is there a way to auto format SQL in R?

I wrote a script that auto generates a lot SQL code. It works but it's all just one giant line. Is there an easy way to auto format it?I found ways to auto format SQL in Python and other tools, but not...

View Article


What is the difference between Stata's command xtregar and R's command gls...

I am running a panel regression with an AR(1) disturbance. That is, the error term of an individual firm has an autoregressive structure. I used Stata's xtregar in the following way:generate...

View Article

Weird Contour plot from ggplot

I have drawn a contour plot using ggplot2 package as belowlibrary(ggplot2)mydat = structure(list(Col1 = c(65L, 65L, 65L, 65L, 65L, 65L, 65L, 65L, 265L, 265L, 265L, 265L, 265L, 265L, 265L, 265L, 515L,...

View Article

How can I access the active tab in a Shiny Quarto dashboard?

I am building a Quarto dashboard with Shiny and would like to display the name or ID of the currently active tab inside the dashboard.Here's a minimal working example of my code:---title: "Tab-Aware...

View Article

How to rbind only the common columns of two data sets

I have 2 data frames with different number of columns each. Some of the columns are common between the 2 data frames. How can i rbind only the common columns of the two data frames to a new data frame?...

View Article



Image may be NSFW.
Clik here to view.

How to set the gt table so that it responds to theme changes in a Quarto...

In Quarto, it is possible to set a switch for display, which shows a switch button to control the theme of the website:_quarto.yml:project: type: websiteformat: html: theme: light: flatly dark:...

View Article


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>