All Questions
36,881
questions
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(...
4
votes
5
answers
49
views
How to transfer dataframe `raw_df` to `list` row by row?
How to transfer data frame raw_df to list row by row? Desired output: wished_list
raw_df <- data.frame(cat=c('a','b','c'),value=c('high','mid','low'))
wished_list <- list(a='high',b='mid',c='...
0
votes
1
answer
22
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 ...
2
votes
2
answers
51
views
How to convert data frame in R to a "character" data type?
The labeller function which I'm using for ggplot requires data of the type:
tempdat <- c(
"1" = "one",
"2" = "two"
)
If I use typeof(tempdat) it gives ...
1
vote
1
answer
44
views
R split 1 column into several columns based on regex value
I have dataframe like this
col_names
Aceh..........................................................66.29..........................56.49..........................64.01....................................
1
vote
5
answers
86
views
String Manipulation based on Char Length in a dataframe
I wanted to do some string manipulation based on Char length condition.
I have this table, let's called it sample table.
RiskCode
A01
A02.999
I want to transform the RiskCode column in sample ...
2
votes
3
answers
147
views
Interpolate dataframe in R subject to totals
I have the following dataset which has the number of A, B and C both in 2000 and 2005. I now need to inpolate the dataframe subject to the constraint that the sum of A, B and C must be consistent with ...
-1
votes
0
answers
24
views
`colorNumeric()`: ! Wasn't able to determine range of domain
I am trying to read a shapefile and assign colors using leaflet colorNumeric() to variable V4 which are numeric but discontinuous. It has values 1 to 16 and then 74 to 95 with some missing values in ...
2
votes
5
answers
49
views
How to get the first half of entries per group?
I want to get the first 50% of the time of the data per x.
For example,
the dataset is like this:
x Year
a 2000
a 2001
b 2002
b 2003
b 2004
b 2005
c 2010
c 2020
If a x appeared in Year 2000 & ...
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
42
views
How to keep the first appearance of a value while filtering everything else out in R?
This is the appearance of my dataset currently. I want to include patient 1 data until the first '1' occurs in 'test.result' then remove any information about patient 1 after that.
current dataset
...
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 ...
-1
votes
3
answers
49
views
Remove duplicate rows, keep first row [duplicate]
I am working with a dataframe on county executives. I want to run a panel study where the unit of analysis is the county-year.
The problem is that sometimes two or more county executives serve during ...