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.
507,920
questions
0
votes
0
answers
12
views
R, summarize dataframe based on certain columns and put 1 column values into list [duplicate]
I have a large dataframe and I need to summarize based on 3 columns (source, source_detail, information) and values in column year will be put into list, like in Table 2.
My first code is
data %>% ...
0
votes
0
answers
17
views
Extracting matched data using overlap weights
I have generated overlap weights on R using weightit package, I generally fo regression using weights directly.
But I want to extract the matched data according to overlap weights for demographic ...
0
votes
0
answers
14
views
clmm function gives me an error "Error in x$code == 0L || action == "silent" : Error 'length = 2' in coercion to 'logical(1)'"
The following commands regarding the two types of models are executed in R
model_4_clmm <- clmm(v27_3 ~ SEX_2 + AGE + PARTLIV_2 + EDULEVEL_2 + WORK_2 + ISCO08_2 + PARTY_LR_2 + v4_3 + gdp_per_capita....
1
vote
1
answer
24
views
How to read CSV file with all variables in character using `vroom`?
How to read 'myfile.csv' with all variables in character using vroom ?
library(vroom)
'Below code can't work
input_file_2<- vroom('myfile.csv',colClasses = 'character')
1
vote
0
answers
23
views
Convert ordinal word string to ordinal number string? [duplicate]
Suppose I have a vector containing ordinal number words as strings in R:
ordinal_words<-c("FIRST COMPANY", "BAKERY FIFTH AVENUE", "WEST FORTIETH WAY")
I would like ...
0
votes
0
answers
31
views
How do I order a barchart, but not by ascending or descending order?
I am making a bar chart breaking down time spent at each activity level(high, medium, low, and total active times) for individuals recorded to be in different fitness levels. here is the code I am ...
0
votes
1
answer
17
views
NA values when using avg_predictions() from marginaleffects with a flexsurv model
I'm unsure why I do not get standard errors or confidence intervals when I fit parametric survival models and compute the predicted mean survival times using the avg_predictions(). I tried using ...
0
votes
0
answers
18
views
Embedding a GGPlotly into Gatsby page
THE INTRO: I am trying to embed ggplotly graphs into a Gatsby webpage I am learning to create. After arguing back and forth with ChatGPT for a couple hours, I'm seeking out your knowledge.
Here is at ...
0
votes
0
answers
16
views
How do I make sure my huxtable list maintains formatting when writing to docx in R/Quarto?
I am using huxtable in Quarto in R for a pretty complicated table, and I need to make sure I have running headers when I knit to word. The headers will have their own formatting that needs to be ...
0
votes
3
answers
63
views
Add values across dataframe columns
I have a dataframe where missingness in indicated by "Z" (there may also be some "z" and NA entries present in the data), and values are entered as characters ("0", "...
1
vote
1
answer
44
views
Confused about lists in R?
I come from a Python background but have to learn R for a job, and I am confused about lists.
I understand named lists can be (roughly) equivalent to Python dictionaries, and I can look up elements ...
0
votes
0
answers
9
views
structure of multinomial model in mgcv
I am trying to model the proportions of a variable with four categories through time and at four different sites. Most sites have all four categories of the variable, but some sites only have three ...
0
votes
0
answers
19
views
Using alpha in library psych [closed]
library(psych)
set.seed(42)
r4 <- sim.congeneric()
alpha(r4)
Am using the example from this page https://www.rdocumentation.org/packages/psych/versions/2.4.6.26/topics/alpha
for convenience. In ...
0
votes
0
answers
21
views
Downloading data from AESO in R
I had some help with this a while ago, but the site has been updated and my R scraper no longer works. I am unable to figure out how to populate and download a csv for the data here:
https://itc.aeso....
0
votes
0
answers
13
views
Calculating Trapezoidal Integration for different locations with two different size classes at each depth in r [closed]
I am trying to get the integrated chlorophyll level across depths from 0-50 of 2 different size classes at different stages, but having a hard time figuring out how to code for it using r.
My data ...