Questions tagged [r]
R is a free, open-source programming language & software environment for statistical computing, bioinformatics, visualization & general computing. Please use minimal reproducible example(s) others can run using copy & paste. Show desired output. 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.
460,487
questions
0
votes
0
answers
3
views
How to avoid spread error in two-way repeated measures ANOVA in R?
I am trying to run a two-way repeated measures ANOVA using the rstatix package however, I keep getting the following error message that I don't know how to interpret.
Error in `spread()`:
! Each row ...
0
votes
0
answers
6
views
Remove some of the X axis labels in ggplot bar chart
I have the following code for a stacked bar graph for the period 1970-2020, which is the X-axis label.
The graph is generated from a dataframe with 3 columns and 51 rows representing various years.
...
0
votes
1
answer
12
views
Regex search until character in R - code working in example but not in full problem [duplicate]
I am trying to get data from a pdf. I am trying to use pdftools and then stringr to do this. I am running into a problem. My regex code in str_match() doesn't work to stop the search on a specific chr....
0
votes
0
answers
8
views
how it is possible to re-arrange data frame by comma separation of factors in one column by R?
I have a dataframe with to big columns data and one of them is the gene list, another is pathways name, but second columns was repeated many times because I have many involved genes in first column ...
-3
votes
0
answers
15
views
In (R) simulate a game of dice throwing where 6 players will participate, each of them will throw the dice for n rounds
Simulate a game of dice throwing where 6 players will participate, each of them will throw the dice for n rounds. The scores will be assigned taking into account the following table of equivalence
...
0
votes
0
answers
4
views
In R, how do I round down a decimal to the hundreth place? [duplicate]
I need the number 1.558 to round down to 1.55. round(1.558, 2) takes it to 1.56 and floor(1.558) would take it to 1, but is there a function that could take it down to 1.55? Obviously, I can find ...
0
votes
0
answers
8
views
Add a png and jpeg file to top of a geom_col
I have a geom_col with 13 football teams on it measuring average attendance on the y axis, team on the x axis. I want to add the logo of a team above the attendance of the red column. How would I do ...
1
vote
1
answer
16
views
Add horizontal lines outside plot area in ggplot2
I've tried finding an answer but nothing seems to work. The first image below is a scatterplot drawn in ggplot2, which has been post-processed by a specific LaTeX journal template on Overleaf. I would ...
0
votes
0
answers
15
views
What does my QQ Plot tell me if I have 4 variables?
I have a model:
Model <- lm(Offensive.Score ~ FirstDown+ThirdDownPct+RushYds+PassYds, data = NFL.Team)
I have done crazy research on QQ Plots and understand that they are standardized points.
I ...
0
votes
0
answers
11
views
How to exactly filter some delay date if it appears in my df or find the next ahead
I need to filter exact dates ranges delay in my df, but I don´t know how to solve this in R.
If the filter didn´t find some date (row) in my df then go to the next date delay.
library(dplyr)
library(...
0
votes
0
answers
13
views
R (data.table) computing mean after two merges with massive datasets
I have three datasets, two of which two are massive. Dataset 1 informs multiple values of y for a given x. Dataset 2 informs multiple values of w for a given y. Finally, dataset 3 informs a single z ...
1
vote
0
answers
22
views
R improve loop efficiency: Operating on columns that correspond to rows in a second dataframe
I have two data frames:
dat <- data.frame(Digits_Lower = 1:5,
Digits_Upper = 6:10,
random = 20:24)
dat
#> Digits_Lower Digits_Upper random
#> 1 ...
1
vote
1
answer
21
views
How can I stack labels vertically above ggplot2 bar graph?
I have generated a bar graph with labels on top of the bars and above the standard error bars. However, I would like to rotate the labels so that they stack vertically instead of horizontally. How can ...
0
votes
1
answer
14
views
Making multiple matrices for different run of simulation using for loops
I have a data from a simulation which has counts of interactions among 10 individuals, and there are 80 runs. I would like to make separate matrices for each run, and then use a function for ...
0
votes
0
answers
13
views
R : the role of instrumental variables in dynamic model with GMM estimator in first difference
I have a question about instrumental variable in a dynamic model using the GMM (Generalized method of moments) estimator in first differences proposed by Arellano & Bond
What is the role of the ...