Skip to main content

Questions tagged [r]

R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible examples others can run using copy & paste. Show desired output entirely. Use dput() for data & specify all non-base packages with library(). Don't embed pictures for data or code, use indented code blocks instead. For statistics questions, use https://stats.stackexchange.com.

r
1 vote
3 answers
33 views

how to strip certain patterns in column headers and rename them all in one go

I have given my students two assessments and each has about 40 items long. Each assessment was given twice, once at pre-assessment and once again at post-assessment. The vocabulary column headers ...
Anita's user avatar
  • 11
0 votes
1 answer
34 views

R: sumifs with a criteria

Here is my data. iris.dt<-as.data.table(iris); And this is exactly what I want, and it works fine. iris.dt[,Sum.Petal.Width := c(sum(Petal.Width),rep(0, .N - 1)), by = Species]; Output to verify: ...
Mohit's user avatar
  • 389
0 votes
0 answers
31 views

Is there a way to build a 360* plot in r?

This is all i have so far: data2 <- data.frame(time = c(ts_nodates), bearing = c(T6PO_Clean$bearing)) ggplot(data2, aes(x = bearing, y = time, fill = factor(bearing))) + geom_col(width = 5) ...
user26467970's user avatar
0 votes
0 answers
29 views

how to get a list of adjusted p values from ggplot code [closed]

I am a beginner in rstudio and interested to obtain the adjusted p values and save it as .csv file for a set of manually selected genes from single cell RNA seq data using the below code. tumor.plot = ...
SSIL's user avatar
  • 1
1 vote
1 answer
18 views

Plot of predicted probabilities of interaction term with sjPlot - CI level does not change

I am trying to create a plot of predicted probabilities from a generalised multilevel linear model (random intercept) using sjPlot package. I want to plot the effect of an interaction term. I am ...
kris's user avatar
  • 131
2 votes
1 answer
26 views

Remove gap in line plot in R [duplicate]

Please help me plot a single line that changes from solid (measured) to dashed (estimate) after year 2008 and has a legend respectively. My code: date<-as.POSIXct(c("1981-01-01","...
DAY's user avatar
  • 111
0 votes
0 answers
29 views

Create a radarchart with dynamic grouping which is based on shiny widget

This is a shiny app in which first I need to select 3 or more columns from the selectinput() named Variable and then 1 from the Group selectInput().The first works as with this I set which variables ...
firmo23's user avatar
  • 8,306
0 votes
0 answers
49 views

Complex lon/lat format manipulation

I originally developed a model to work with a df as df1_ref. Now, I found more data I need in a different format as df2. df1_ref: id country point_id lon lat value_A ...
dmoyaec's user avatar
  • 63
0 votes
1 answer
20 views

How to plot two separate pairs of points and connect them using ggplot?

I would like to plot two separate pairs of points on a ggplot and then connect them by a line. I know I could create two ggplots and then combine them together, but then no line would be connecting ...
Loons22's user avatar
  • 373
0 votes
6 answers
48 views

Create a new column with averages for time intervals

I have a dataset that begins in year 1988 and ends in year 2020. I want to create averages for certain time intervals. For example, 5 years: 1988-1992, 1993-1997 and so on. But I want a new column ...
Pedro Cardoso's user avatar
0 votes
0 answers
37 views

Applying weights instead of matching [migrated]

I want to conduct a Difference-in-Differences (DiD) design study. I have two groups (which you can see in the sector_eu_without variable) that I want to keep equal regarding certain variables: sex, ...
Ronald's user avatar
  • 1
1 vote
2 answers
31 views

bslib theme toggle not working in R Shiny app

I'm trying to better grok Shiny so I can make some neat little apps or visualisations, but I am getting a confusing error when I try to add a dark-light mode toggle switch. I pretty much copied the ...
nos codemos's user avatar
0 votes
3 answers
45 views

If ... else : the condition has length > 1

I am trying to classify variants according to their type (polymorphisms, insertion or deletion). Here is a snippet of my input : A T G C T AG C T TT C AT CC Here is the dput output, if you need ...
user25420086's user avatar
1 vote
1 answer
32 views

ggplot are all the same when yaml parameter is passed and quarto_render is used in loop

I want to render multiple html documents using quarto_render I have a main.qmd containing: library(quarto) library(glue) # List of IDs of interest ids <- c("A", "B", "C&...
Kuehlschrank's user avatar
0 votes
0 answers
27 views

How to add count labels to clustered stacked bar chart in ggplot? (R) [closed]

I have a bar chart that looks like this: I am happy with how it looks except that I am trying to add labels to my bars showing the count of each bar. ##Current Code library(ggplot2) typeXsize <- ...
sionnach's user avatar

15 30 50 per page