Skip to main content

R Language Collective

Questions

Browse questions with relevant R Language tags

6,312 questions

Has recommended answer
1 vote
1 answer
45 views

Create a string from data in a dataframe column in R

I have a dataset which I am trying to validate. I created a column that contains the written rules for what to check for each row and would like to use paste0 to concatenate the data in that column ...
user30397791's user avatar
Answer Accepted

The documentation might be a little misleading. It says Usage: validator(..., .file, .data) Arguments: ...: A comma-separated list of validating expressions .file: (optional) A ...

View answer
r2evans's user avatar
  • 163k
0 votes
1 answer
64 views

Why does `tapply` give a different result depending on the parameter of FUN

I am working on data analysis and came across the following. Given a triplet data frame, consisting of indices i, j and value v, create a matrix m[i, j] = v. A matrix element can have multiple values. ...
clp's user avatar
  • 1,592
Answer Accepted

When FUN= returns a scalar for all calls, then the default of simplify=TRUE means that it is turned into a vector, non-indexed positions are assigned NA as an indicator of missingness, and this vector ...

View answer
r2evans's user avatar
  • 163k
4 votes
1 answer
57 views

How can I set "cr" as the default basis type in mgcv::gam instead of "tp"?

I'm using the mgcv package in R to build generalized additive models (GAMs), and I often use cubic regression splines (cr) instead of the default thin plate regression splines (tp) (mainly because cr ...
Tripartio's user avatar
  • 2,373
Answer

The function s is defined with bs = "tp" as a default argument. There aren't any settings anywhere that can change this. Furthermore, you can't even define a wrapper of s because of how gam ...

View answer
Allan Cameron's user avatar
2 votes
4 answers
87 views

How to functionalize base R function like `with()`?

I am trying to write a function that operates similarly to with() where the function has a data argument, and two other arguments that I would like evaluated in the context of the data frame. I ...
Daniel D. Sjoberg's user avatar
Answer Accepted

You are on the right track with rlang::inject(). But note that the documentation states that You can use {{ arg }} with functions documented to support quosures. Otherwise, use !!enexpr(arg). So let’...

View answer
Konrad Rudolph's user avatar
0 votes
1 answer
40 views

re-order factors on y axis of a gantt chart

I am trying to produce a Gantt chart with the locations on the y axis in alphabetical order but nothing I tried worked out. Here is the code: gantt <- read_excel("2025-05-07_gantt_chart.xlsx&...
Fiona's user avatar
  • 25
Answer Accepted

The y axis is in alphabetical order, but factor ordering is such that earlier letters in the alphabet get the lowest values, so when these are plotted they are lower on the y axis. Therefore the order ...

View answer
Allan Cameron's user avatar
1 vote
1 answer
39 views

How to write multiple named sheets to excel workbook using openxlsx

I need to use the openxlsx library due to java issues at my institution. I have a list of dataframes called data_list that are simply named 1, 2, 3, etc. > data_list $`1` Count TaxID ...
aminards's user avatar
  • 457
Answer Accepted

You said you needed to use openxlsx because of issues with java, have you tried writexl? Perhaps something like this: strsplit(file_list, "_") |> sapply(function(st) paste(st[1:4], ...

View answer
r2evans's user avatar
  • 163k
1 vote
1 answer
74 views

Adding custom HTML before <div class="main-container">

I am using the includes options in R Markdown to add custom CSS and HTML to my document. My main goal is to add a banner to the top and a pretty background (not the one in the example) to the body of ...
Sobo's user avatar
  • 125
Answer Accepted

I think we can fix this with a little more css: body { background: url(https://linesteppers.com/tutorials/RMarkdown/img/BannerImage_TreeBlossoms_4470x3024.jpg); /* remove margin and padding */ ...

View answer
M--'s user avatar
  • 29.8k
1 vote
1 answer
37 views

Color edge links in ggraph based on specific nodes

I am trying to generate a bipartite graph where I color specific links based on certain nodes (i.e., plant species names). So far, I have been able to color the nodes of interest, but not their ...
J. Lan's user avatar
  • 63
Answer Accepted

The original data passed to ggraph gets transformed by geom_edge_link, i.e. by default get_edges() is called to extract the edges data from the graph object or the data frame in your case. As a result ...

View answer
stefan's user avatar
  • 128k
-4 votes
1 answer
59 views

Facet wrap in R for gglikert plot

i have a data frame in R with likert scale responses . Some questions are part of a broader theme. The partial data frame : df # A tibble: 264 × 3 Theme Question ...
Homer Jay Simpson's user avatar
Answer Accepted

The issue are the missings in the transformed data created by gglikert (most likely due to the wide format of the input data), i.e. even if there are no answers or responses the questions are not ...

View answer
stefan's user avatar
  • 128k
3 votes
2 answers
103 views

Concatenate values depending on variable value [closed]

I want to merge the information from 18 different databases providing information on the status of many species in different locations of the world. However, I only want to merge the rows where ...
msug's user avatar
  • 155
Answer Accepted

Assuming that df1's row 4 should really be retained in the results, here's a dplyr pipe: library(dplyr) df1 |> mutate(.by = c(taxonID, locationID), g = (establishmentMeans %in% c("introduced&...

View answer
r2evans's user avatar
  • 163k
2 votes
4 answers
110 views

More efficient way to compare if a DateTime is in between any of two columns of DateTimes in R? [duplicate]

I have a ~38,000 observation dataframe (hr_clean) that has a POSIXct value for each row, this is fitbit data that tracks average Heart Rate over every minute for the duration of a month. I want to ...
Evan N.'s user avatar
  • 31
Answer

data.table::inrange library(data.table) as.data.table(hr_clean) |> _[, is_sleeping := inrange(dateTime, sleep_ranges$startTime, sleep_ranges$endTime)] # dateTime is_sleeping # ...

View answer
r2evans's user avatar
  • 163k
2 votes
1 answer
56 views

X-axis scale over night

I have data collected over night with timestamps. I would like to plot this so that the x-axis runs from 9pm to 5am, but I can't figure out how to do it. Here is some dummy data: library(tidyverse)...
AnneA's user avatar
  • 47
Answer Accepted

Recognizing that your use of geom_bar is just a placeholder for real data and other plot needs, I think your main concern is how to adjust time and the x-axis so that it does just what you want. For ...

View answer
r2evans's user avatar
  • 163k
1 vote
1 answer
36 views

iteratively decrease values in observations for a grouped dataset without changing observations in the first rows using group_map and return a tibble

I am attempting to decrease the values of the value column by 0.000001 for observations that are not in the first row into a new column called lagged.values. I then want to fill the NAs resulting from ...
Shaq's user avatar
  • 65
Answer Accepted

Up Front: I should note that assuming perfect equality for grouping by value will be subject to floating-point issues as discussed in Why are these numbers not equal?, Is floating-point math broken?, ...

View answer
r2evans's user avatar
  • 163k
4 votes
3 answers
104 views

Only update value when pushbar closes

I have a simple app rendering the value from a switch input inside a pushbar. I'd like it so the values only update when the pushbar closes. Note for the full app, there are multiple inputs that ...
D.sen's user avatar
  • 964
Answer

We can detect the pushbar's state, save the switch value to a temporary variable, and only write it to the value that will be rendered upon closing the pushbar. I checked the class of pushbar, and it ...

View answer
M--'s user avatar
  • 29.8k
4 votes
1 answer
72 views

How to use a dominant fill color in geom_col_pattern when 2 colors are used?

In the following example, I want the "#1E466E" color to take about 90% of bar length. So, I tried using pattern_gravity as "right" or "left" but that does not make any ...
umair durrani's user avatar
Answer Accepted

Since R v4.1.0, you don't need to use ggpattern to create a gradient fill in ggplot2. You can do it directly by passing a grid::linearGradient as the fill colour of the bars. Furthermore, it gives a ...

View answer
Allan Cameron's user avatar
2 votes
1 answer
65 views

How to position the north arrow using tmap r package?

I want to position north arrow at the center of the scalebar. I am using the following code: library(tmap) library(terra) library(sf) r <- rast(system.file("ex/elev.tif", package="...
UseR10085's user avatar
  • 8,282
Answer Accepted

We can use tm_pos_in(..) to get closer: tm_shape(r, bbox = bbox_new) + tm_raster(col.scale = tm_scale_continuous( values = "viridis"), # color palette; col.legend = tm_legend(...

View answer
r2evans's user avatar
  • 163k
4 votes
4 answers
113 views

How to change y axis individually in facet plots

I have this data containing 3 components and the total of all components put together and I am trying to plot everything in one figure, so I decided to use a facet plot but I would like to plot the ...
Gabriel's user avatar
  • 73
Answer

Surprised that no one has offered ggh4x::facetted_pos_scales which personally is my first choice when it comes to setting the scales individually for each panel, i.e. instead of using patchwork or @...

View answer
stefan's user avatar
  • 128k
3 votes
2 answers
102 views

Superimpose one ggplot on another

I have two ggplot objects as below. library(ggplot2) set.seed(1) dat1 = data.frame(x = rnorm(1000), y = rnorm(1000)) dat2 = data.frame(x = rt(5000, 2)) Plot1 = ggplot(data = dat1, aes(x = x, y = y)) ...
Daniel Lobo's user avatar
Answer

As partially suggested in a since-deleted answer, we can use patchwork::inset_element() for this. library(patchwork) Plot2 = ggplot(dat2) + geom_histogram(aes(x = x)) + theme_bw() + theme( ...

View answer
r2evans's user avatar
  • 163k
2 votes
1 answer
63 views

Using officer in R to hyperlink to a heading within Word documents

I would like to generate Word documents with officer that contain links to other locations in the same document, e.g. if there is a figure that gets referred to in text elsewhere. Here's a simple ...
js4032's user avatar
  • 340
Answer Accepted

In general hyperlink_ftext would be the way to go. But after a look at the docs, the source code and some experimenting I think at present only external links are supported. However, with some ...

View answer
stefan's user avatar
  • 128k
2 votes
1 answer
49 views

How to Scale ggplot2 Line Chart X-Axis (Time) to Reflect Proportional Time Differences in R

I am creating a line chart in R using ggplot2 where the x-axis represents a time variable (factor format including minutes, hours, days). My current plot displays equal spacing between time points on ...
Md. Sahidul Islam's user avatar
Answer

If we start with a simple frame of data, and try to plot it, dat <- data.frame(time=c("15m","45m","90m","3h","6h","9h","24h",&...

View answer
r2evans's user avatar
  • 163k
3 votes
2 answers
42 views

How to format the title of a facet_wrap plot to match the facet strips style?

I'm trying to format the title of a facet_wrap plot to match the style of the facet strips. In the plot below, I added a title "len", but its formatting doesn't look like that of the facet ...
tassones's user avatar
  • 1,826
Answer

Personally I would go for facet_grid but another, more laborious option would be to use ggtext::element_textbox: ToothGrowth |> ggplot(aes(x = dose, y = len)) + geom_boxplot(aes(fill = supp)) + ...

View answer
stefan's user avatar
  • 128k
4 votes
3 answers
161 views

data.table two‐dot pronoun (..) in i or tidyverse bang bang !! equivalent in data.table

I'm trying to filter a data.table by comparing a column to an external R variable using the "two‐dot" pronoun (..), but I keep getting Error in `[.data.table`(dt, reg == ..reg) : object '.....
Macosso's user avatar
  • 1,491
Answer Accepted

If you are locked into using data.table_1.14.8, I think a clear path is to use get(.) with a specific environment, as in library(data.table) packageVersion("data.table") # [1] ‘1.14.8’ reg &...

View answer
r2evans's user avatar
  • 163k
4 votes
2 answers
73 views

Two subtitles, one left-aligned, one right-aligned, on the same line

Using ggplot2, I'd like to have two subtitles on the same line, under the title, but one left-aligned and one right-aligned for a facetted plot like the one below. I can have a subtitle left-aligned: ...
Edward's user avatar
  • 21k
Answer Accepted

Hacky and spooky, but works. You can pass a vector to subtitle= and set the alignment for each element by passing a vector to hjust= (which of course is not officially supported): library(ggplot2) p &...

View answer
stefan's user avatar
  • 128k
1 vote
1 answer
71 views

Concatenate cells into a text list for output in R

I have a table of academic courses and professional competencies such that each course is marked as meeting specific competencies. E.g.: CourseNumber CourseName Competency 1 Competency 2 101 Intro X ...
Luis Morales Knight's user avatar
Answer Accepted

The issue is that you are using an inline code chunk with a function which returns a vector of length > 1. Instead you can use a code chunk with results="asis" and use cat as already ...

View answer
stefan's user avatar
  • 128k
5 votes
7 answers
145 views

Label Encoding on multiple columns in R

I have a dataframe that contains columns that have categorical responses. I'd like to perform label enconding of the observations on all the columns at a go Gender <- c("Male", "...
andrew's user avatar
  • 2,129
Answer

Base R: cbind( DF, lapply(setNames(DF, paste0(names(DF), "_num")), function(z) as.numeric(factor(z))) ) # Gender School Town Gender_num School_num Town_num # 1 Male Primary HA ...

View answer
r2evans's user avatar
  • 163k
1 vote
1 answer
46 views

Changing alignment of a tick label in ggplot

I have below ggplot library(dplyr) library(ggplot2) dat = data.frame(name=c("apple", "orange", "plum"), value=c(3,8,2), outlier=c(FALSE,TRUE,FALSE)) ggplot(dat, aes(x = ...
Bogaso's user avatar
  • 3,482
Answer Accepted

Besides the option to add the label via an annotation another more recent option would be the legendry package which allows for stacked axes, i.e. in the code below I use compose_stack to add the ...

View answer
stefan's user avatar
  • 128k
3 votes
1 answer
71 views

How can I add a risk table with cumulative events and number at risk using ggplot2

I have been trying to plot a cumulative incidence function (CIF) for death and epilepsy events in R. My code is like: library(survminer) library(cmprsk) library(ggplot2) library(purrr) set.seed(123) ...
ted's user avatar
  • 31
Answer

TBMK all out-of-the-box options which build on ggplot2 create the risk tables as a separate ggplot which is then combined with the chart of the survival curves using patchwork. But of course you can ...

View answer
stefan's user avatar
  • 128k
1 vote
1 answer
62 views

Quarto PowerPoint slide with two plots side by side and descriptive text at the bottom of the slide?

How can I create a PowerPoint presentation with quarto, with two plots side by side, and include descriptive text at the bottom of each slide (like the one shown in screenshot)? The issue I have is ...
Bachi Shashikadze's user avatar
Answer Accepted

The issue is that quarto or more precisely pandoc supports only a limited number of slide layouts (For an overview of the supported layouts see the docs), i.e. to display two charts side by side there ...

View answer
stefan's user avatar
  • 128k
1 vote
2 answers
98 views

Create plot with variable height in facet_wrap

I want to reproduce this graph: From the following paper: https://www.journals.uchicago.edu/doi/10.1086/730711 I have used facet wrap, but it does not have variable heights. Facet grid would not work ...
Victor Hartman's user avatar
Answer

You can find the relevant code around line 660 of this file: https://dataverse.harvard.edu/file.xhtml?fileId=7522202&version=1.0 We can then manipulate that code for your data. However, there are ...

View answer
M--'s user avatar
  • 29.8k
1 vote
2 answers
55 views

In ggplot2 how can I display in single legend the line color and point shape mapped to vector of single-character strings?

Haven't found any post that address this issue specifically. In the following chart I'd like to use a column of single-character strings as the shapes for geom_point(). The help vignette ggplot2-specs ...
MCornejo's user avatar
  • 371
Answer Accepted

We can map the shape to cyl_word and force manual shapes: ggplot(mtcars2, aes(mpg, wt, color=cyl_word)) + geom_line() + geom_point(aes(shape=cyl_word), size=3) + scale_shape_manual(values = ...

View answer
r2evans's user avatar
  • 163k
5 votes
4 answers
154 views

Efficient method to estimate the group membership

I have below code to estimate the group membership of each element of a large vector Interval = data.frame(lowerLimit = c(0, c(13.31, 14.1, 14.52, 15.9, 17.88, 20.85, 22.14, 22.6, 23.49, 24.31, 26.54,...
Bogaso's user avatar
  • 3,482
Answer

If efficiency is at stakes, and the Interval is not necessarily contiguous, then we can write our own {Rcpp} function: library(Rcpp) library(inline) findIntervalGroup <- cxxfunction( signature(...

View answer
M--'s user avatar
  • 29.8k
1 vote
1 answer
40 views

Change colour of text that labels a tile in ggplot2

This question follows on from this one (Warning message: Removed 2 rows containing missing values (`geom_tile()`)). Some of the days are weekend days and I would like to communicate this in the chart. ...
Stephen Clark's user avatar
Answer Accepted

I think your second code block ("Answer:") is a good approach, though you may run into problems when a fill is light enough that white lettering on the weekends will be washed out. An ...

View answer
r2evans's user avatar
  • 163k
-1 votes
3 answers
145 views

Drop rows with missing values in all columns [duplicate]

It looks like tidyr's drop_na will drop rows if any of the specified columns contain missing values. Example: > library(tidyverse) > df <- data.frame(a=c(1,NA,2,NA), b=c(3,4,NA,NA)) > df ...
robertspierre's user avatar
Answer

I usually recommend collapse::na_omit for that. The oddly-specific prop argument will remove rows with a proportion of missing values >= prop. It's the fastest and most flexible option: collapse::...

View answer
Maël's user avatar
  • 52.6k
2 votes
2 answers
82 views

Why does spec() return NULL after subsetting a tibble? (And how do I avoid that?)

After reading in my data using read_csv() from readr, the command spec() returns "full column specification" for the resulting tibble: > spec(steps) cols( duration = col_double(), ...
Ben's user avatar
  • 775
Answer

The data for spec() is populated when the data is read-in or imported, and held in an attribute of the frame. Because of this, you won't see it on the console unless you look specifically for it: ...

View answer
r2evans's user avatar
  • 163k
3 votes
1 answer
84 views

Plot the best fit linear regression with the slope set to a fixed value (m=1)

Currently using R 4.4.3 on Windows 11. I'm plotting the following data set with ggplot2 and performing a linear regression with geom_smooth: df <- data.frame(A= c(1.313, 1.3118, 1.3132, 1.3122, 1....
jeffgoblue's user avatar
Answer Accepted

library(ggplot2) library(dplyr) set.seed(3) ## adding a type column to showcase facets df %>% mutate(type = rnorm(n()) < 0, A = A + abs(rnorm(n())), B = B + abs(rnorm(n())))...

View answer
M--'s user avatar
  • 29.8k
1 vote
2 answers
63 views

Irregular tick-lines when I add extra tick

Below is my ggplot library(ggplot2) dat = structure(list(x = c(0.038362636053748, 0.0350340127781965, 0.0170342545048334, 0.0456167190917768, 0.0246753886074293, 0.015978419353487, 0.02345346731483, ...
Bogaso's user avatar
  • 3,482
Answer Accepted

You can explicitly set the positions for the minor breaks and grid lines using the minor_breaks= argument: library(ggplot2) ggplot(dat, aes(x, y)) + geom_point() + scale_x_continuous( limit = ...

View answer
stefan's user avatar
  • 128k
0 votes
1 answer
53 views

How can I order y-axis (facet plot) by year correctly in ggplot2? [duplicate]

I'm working with a dataset showing the residuals of each studies. My data as follow: data <- data.frame( Study = c("Philpott et al.1989, 1990", "Philpott et al.1989, 1990", &...
Hala's user avatar
  • 41
Answer

You are explicitly controlling the order of the y-axis with your call to factor(.) without controlling the order of the levels. Change that and it works. I need to fix some gaps in the data to get the ...

View answer
r2evans's user avatar
  • 163k
0 votes
2 answers
61 views

Expand existing table into a "versioned up-to-date statues" table [closed]

I want to generate a "tracked history" or "growing history" table, based on a source table. Consider this example: library(tibble) df_source <- tibble::tribble( ~user_id, ~...
Emman's user avatar
  • 4,253
Answer

I'll Reduce over the unique iteration values, accumulating the results and combining at the end: library(dplyr) library(glue) Reduce( f = function(prev, iter) { full_join( filter(df_source,...

View answer
r2evans's user avatar
  • 163k
0 votes
1 answer
113 views

Manual change the color of the circles using sf package in R

I would like to create a Venn Diagram with sf + ggplot2 packages. How to manually change the colors of the circles and the intersection regions of the two inner circles? Changing the scale fill in {...
Homer Jay Simpson's user avatar
Answer Accepted

Two options, plot all circles, with alpha and custom fill colours, overlaps will get different fill because of alpha. Or plot the 1st circle, then overlaps, manually setting the colours without alpha, ...

View answer
zx8754's user avatar
  • 56.4k
0 votes
1 answer
62 views

Legend not aligning under the graph using ggplot2

This is a follow up to my earlier question, elegantly answered by the community. I am using the same dataset as in the earlier question, given below: topclones<- structure(list(CTaa_beta = c("...
Zoya Qaiyum's user avatar
Answer

The issue is the setup of your shape (and color) palettes which prevent that the fill and shape legends get merged. In the code below I fix this by using named vectors of colors and shapes. ...

View answer
stefan's user avatar
  • 128k
0 votes
1 answer
38 views

R reactome.db install failed

I'm running R and trying to install reactome.db with BiocManager (required for ReactomePA). For some reason it fails, but when I try installing in a different folder on the same server it works. When ...
shishkebab's user avatar
Answer

TL;DR -- go down to resolution. Troubleshooting In your case, when you try to install a package and there is an installation failure, there are a few things I normally check. Often there are OS-...

View answer
r2evans's user avatar
  • 163k
0 votes
2 answers
126 views

How to check if every data frame in the R environment has data

I have imported over 40 excel sheets into R. I would like to write a function to return the names of data frames that have no data (have 0 observations). I know that I could use nrow(dataframe) to ...
h09812349's user avatar
  • 153
Answer

Here is solution using purrr: library(purrr) empty_dfs <- ls() %>% keep(~ is.data.frame(get(.x))) %>% keep(~ nrow(get(.x)) == 0) empty_dfs

View answer
TarJae's user avatar
  • 79.8k
1 vote
2 answers
71 views

Exclude column in sapply(dat_clean, FUN = function(x){x / sum(x)}) in R

I'm working on a piece of R code to calculate the diversity in a dataset of fungal taxonomies. The tutorial I'm following has a piece of code meant to sum each row, which isn't working because the ...
DudeBro231's user avatar
Answer

Before calling rowSums, just select the numeric columns. Using @Friede's sample data, dat_clean <- data.frame(V1=letters[1:5], V2=1:5, V3=6:10) rowSums(dat_clean) # Error in rowSums(dat_clean) : 'x'...

View answer
r2evans's user avatar
  • 163k
2 votes
2 answers
78 views

column percentages with missings values on tbl_summary

How to make tbl_summary() percentages use total N (including missing) as denominator? I'm using gtsummary::tbl_summary() to describe a dataset with categorical variables that contain missing values. I ...
Thomas Husson's user avatar
Answer

Some alternatives: if you want to keep the "dichotomous" (yes/no, true/false) nature of the table where it only shows the "Yes" values, then it doesn't matter the number of "...

View answer
r2evans's user avatar
  • 163k
2 votes
1 answer
82 views

ggplot2 geom_textpath spiral with datetime axis

I'm trying to replicate the spiral example for geom_textpath() shown at the top here: https://allancameron.github.io/geomtextpath/ My y-axis is numeric, so that part works out fine, but my x-axis is a ...
user25090379's user avatar
Answer Accepted

Internally, POSIXct is just numeric with a class: dput(Sys.time()) # structure(1745060382.54419, class = c("POSIXct", "POSIXt")) So while sin(Sys.time()) isn't going to work, we ...

View answer
r2evans's user avatar
  • 163k
3 votes
2 answers
126 views

How can I reorder and filter a range of time-formatted data in ggplot?

I have data from recordings made each evening from 21:00:00 to 5:59:59. I'm trying to make a bar plot of the compiled data, with time on the x-axis. However, I'm having trouble displaying only the ...
Cedar's user avatar
  • 33
Answer Accepted

You can shift the times that are between 9 PM and midnight a day back, so they appear before and adjacent to the rest of your data with no gap. Note that in the example below, I don't have all of your ...

View answer
M--'s user avatar
  • 29.8k
0 votes
1 answer
64 views

Comparing dates within a group but between variables (within a site but between record types)

I am working with invasive species data for an analysis that compares pre- and post-treatment data to determine treatment effectiveness. For each site, I have data on presences (records of the ...
FateSigh's user avatar
Answer

Perhaps this? dplyr library(dplyr) dat |> arrange(date) |> mutate( .by = Site_ID, has_presence = cumany(grepl("presence", layer_type)) ) |> filter(has_presence, ...

View answer
r2evans's user avatar
  • 163k
0 votes
1 answer
110 views

Trying to download pdfs in R

I am trying to get a links of pdfs from a site in R but the rvest read_html() function just sites there, seemingly making no progress. Here is my code: # Load required libraries library(tidyverse) ...
MCP_infiltrator's user avatar
Answer Accepted

An alternative approach for this URL: Open a web browser (I'm using FF, but others should work), open the dev-console (perhaps F-12 or some other method, browser-specific), and go to its "...

View answer
r2evans's user avatar
  • 163k
1 vote
1 answer
62 views

plotly_hover does not match data in shiny when using color aesthetic in the plot

I'm having an issue with plotly_hover option when trying to display information from the hover in another output in a shiny app. I'm working with a plotly made from a ggplot that uses color aesthetic. ...
Honestiore's user avatar
Answer Accepted

Simply add a key to aes() which points to rownames(df). Then use that to subset and get df_select. server <- function(input, output, session) { df <- data.frame(x = 1:10, y =...

View answer
M--'s user avatar
  • 29.8k
1 vote
1 answer
116 views

R-4.5.0 wininet not working to download packages

I use R on a PC with Windows 11 inside the company network. To download the packages I have to use the proxy with a system configuration and for this I use the wininet method even if it has been ...
user2509571's user avatar
Answer

Up front, it appears that options(download.file.method="wininet") # in .Rprofile R> getOption("download.file.method") # inferred from comments # [1] "wininet" R>...

View answer
r2evans's user avatar
  • 163k


15 30 50 per page
1
2 3 4 5
127