All Questions
36,878
questions
1
vote
1
answer
42
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
85
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
140
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
21
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
75
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
45
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
71
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 ...
-1
votes
1
answer
34
views
Fill in missing rows
I have a data frame of county executives and the year they were inaugurated.
I am runnig a panel study with county-year as the unit of analyis. The date range is 2000 to 2004.
I will like to expand ...
0
votes
0
answers
36
views
Sum of previous years observations for unstructured data in R [closed]
I have very unstructured data for following variables:
Host Home Industry Value Year value_lag
A X I 1 2001 NA
B X I 2 2001 NA
C X I 3 2003 NA
A X I ...
0
votes
1
answer
57
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&...
1
vote
3
answers
51
views
Cell value breakdown and string split with uneven length
I need to breakdown the string values contained in a column. Some cells do not need any split at all. Others might required one, two, or more.
I would also like the split values to be stored in ...