All Questions
4,696
questions
0
votes
2
answers
32
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", "...
1
vote
5
answers
99
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
48
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(...
0
votes
1
answer
23
views
How to group aggregate data based of latitude and longitude
I have 2 dataframes in R that both have this type of structure:
Lon
Lat
Measurement
5
7
15
5
8
20
The numbers in the actual dataframes are different from this example but I don't think that should ...
3
votes
5
answers
77
views
Order columns based on suffix with dplyr and stringr
I have a dataframe that has columns that are separated out by suffix see ex_df. Each time I run the code there may be varying column amounts based on database entries so I am trying to find a way to ...
1
vote
2
answers
48
views
data frame breakdown by year, rounding up by duration of each period
I have a data frame of county executives and the first and last years they served.
I am running a panel study with county-year as the unit of analysis. The date range is 2000 to 2009.
I will like to ...
2
votes
3
answers
73
views
Complete and fill missing rows with groups of uneven length
I have a dataframe of county executives and the year they were inaugurated. I am running a panel study with county-year as the unit of analysis. The date range is 2000 to 2004.
I will like to expand ...
0
votes
1
answer
61
views
How to find if an ID appears in each group? [closed]
I have a dataset that includes variables such as recordID (e.g. 1104, 4406), deposit (e.g. 100, 124), and month (e.g. 01, 02, 03, etc.). I want to find out how many of these recordIDs are making ...
0
votes
0
answers
13
views
Filter rows with same values for two specific columns in R? [duplicate]
I have a tibble in R like:
df1<-tibble(student=c("John", "John", "John", "Mark", "June"),
grade=c("A", "A", "A&...
0
votes
1
answer
42
views
Load files in bulk and create new column with file name
I have a folder with 3000+ xlsx files that I need to upload in bulk. The catch? I need to create a new column with the value equal to the file name.
Let's say my files are named id1, id2, id3, and so ...
2
votes
4
answers
87
views
Convert a dataframe of nearest neighbors to onehot coding
Let's say we took the mtcars data and ran a PCA. Then, we want to know which brands of cars are most similar in PC space, i.e. the nearest neighbors. So someone ran a nearest neighbors analysis and ...
1
vote
1
answer
87
views
How to Create a Data Frame or Table Summarizing Multiple Question Types?
I am trying to create a summarized data frame or table that encompasses different descriptive information for different categories of questions.
For example, here is some of the raw data:
What I ...
0
votes
1
answer
38
views
Percentage Change over multiple columns in R
I have an R dataframe where I'm trying to calculate % change across a number of columns, yet I can't seem to work out the correct syntax for it.
Basically I'm trying to calculate % change from a base ...
0
votes
2
answers
24
views
Convert a dataframe where each row has categorical data into a new dataframe with each category represented as a separate column
The following dataframe has one row per each patient (the rowids correspond to the patients), and one single column.
df <- data.frame(
mutations = c('A497T', NA, 'C320T', 'A497T', NA, 'G621C', '...
1
vote
1
answer
59
views
Conditional filtering of dataframe in R
I wonder how to dplyr::filter() my DATA to catch the rows for IDs whose Language value when 'Type!=5F' and when 'Type==5F' changes from other languages to "English"?
For example, ID==1 has ...