All Questions
36,897
questions
0
votes
1
answer
13
views
Find average temperature from a range of datetime for each day in dataframe
This is a subset of the dataframe I have:
structure(list(name = c("waldorf", "waldorf", "waldorf", "waldorf",
"waldorf", "waldorf", "...
-4
votes
0
answers
23
views
Dplyr ( count for total number/treatment) [closed]
I have data frame with two columns the first column is the number of children under the age of five that receive a treatment and the second column classifies the type of the treatment. I would like to ...
0
votes
0
answers
40
views
Conditional variable for COMPLETE DATA [duplicate]
Attached data :
id = c (2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
vm = c("12", "13", "14", "15", "16", "17", "18" "19", &...
1
vote
2
answers
26
views
Change the absolute value of elements in a dataframe without changing their sign (+ / -)
I have a dataframe of cumulative changes, which I am trying to convert into (multiplicative) factor values.
If all values were positive, I could simply add 1: e.g. a 25% increase would be 0.25, adding ...
0
votes
0
answers
51
views
aggregation based upon multiple criteria and time range (R)
Ultimately, I want to aggregate the amount column in my data over modular groups that do not yet exist but that are the composite of two existing groups and a time difference dimension.
I have a ...
0
votes
2
answers
38
views
Why is this part of my code not adding the new columns to my data frame?
I have 13 datasets that are in .XPT format called data2010, data2011, data2012.. data2022. These are the BRFSS datasets from the CDC website. I have been trying to add three new columns to each of my ...
1
vote
1
answer
62
views
How can I append duplicated groups of a dataset with changes to existing data in R efficiently?
I have data like this:
key_data <- data.frame(orig_letter=c("A","A","A","A","C","C","F","B","B","B&...
1
vote
5
answers
95
views
How to count the total entries by group when they are comma-separated
I'm working with the League of Legends Champions dataset
name
tags
Aatrox
Fighter
Ahri
Mage,Assassin
Akali
Assassin
Akshan
Marksman,Assassin
Alistar
Tank,Support
And I was wondering how to ...
1
vote
1
answer
44
views
Creating a large number of columns in R tidyverse based on a comparison with a specific column
I have a dataset in R tidyverse and I want to create 192 columns based on comparison with the sp column, just like the mp_comp_1 column. How can I do this for 192 columns in tidyverse?
library(...
1
vote
2
answers
53
views
Pattern matching in a dataframe
I am having some trouble conducting pattern matching within a data frame. I am working with grepl function in R.
I have a data frame of 5 local districts in two years (2001 and 2002). I want to check ...
0
votes
0
answers
57
views
Dealing with duplicate rows when creating a visit column, cartesian multiplication
I'm having trouble with data transformation.
What I want to do is go from a data table that created Cartesian multiplications to one that is sorted by column of visit number.
The logic:
this is a ...
0
votes
1
answer
31
views
R - Filter to only include grouped rows that contain all values in a vector
Goal: Find all dates where the only color present is blue or yellow
If there are 2 colors then they BOTH need to be blue and yellow
If there's one color then it can be either one
In the example ...
1
vote
1
answer
68
views
Create a conditional variable for incomplete data
Attached data:
id = c (2, 2, 2, 2, 2, 2, 2, 2, 2, 2)
vm = c("13", "14", "15", "16", "17", "19", "20", "21", "22&...
3
votes
2
answers
39
views
Remove only the rows failed a test inside a group where a row passed the test
Background: I am using R to help me figure out which entries in file A (expected names) map to which entries in file B (possible names). Unfortunately, file B has multiple entries with the same ID ...
1
vote
1
answer
38
views
Why do case_when() and if_else() appear to evaluate the wrong expression?
I am trying to process some messy date data from a .xlsx file. Some of the dates are pre-1900 because of typos during user entry. This results in Excel storing 1900 and onward dates as numbers and pre-...