All Questions
869
questions
1
vote
2
answers
78
views
Filtering specific sequences in R
I am trying to filter a dataset I have obtained after RNASeq Analysis. I have "Sequence Name" assigned to "topological domain" and "transmembrane region". I would like to ...
0
votes
2
answers
45
views
Filter rows with time period that falls within another row timeperiod
I have a dataset that resembles the following minimal example:
Category date_in date_out
KA 2018-09-05 2018-10-08
KA 2018-09-05 ...
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 ...
0
votes
1
answer
76
views
R and dplyr it's not recognizing a variable and realizing the condition
I have one data frame about animal sightings (more than 300), with species of whales, dolphins, pinipedes and penguins.
And I want to create a new column reino, which would be misticeto for whales, ...
0
votes
2
answers
64
views
R filter out rows based on value in different row
Here's an example df:
df <- data.frame(
id= c(1,1,1,1,2,2,2,2),
admit_dt = c("2022-01-01", "" ,"2022-05-05","", "", "2022-09-03", &...
1
vote
3
answers
46
views
Finding rows in a data.frame that are the same on one variable but different on another variable in R
In my DATA below, how could I filter the rows where the Nm values are the same but Descr values are different to achieve my Desired_out below?
DATA <- read.table(header=T, text ="
Cd Nm ...
1
vote
1
answer
48
views
How to remove associated observation from 2 datasets in r
I have a complex filter I am trying to implement but not sure how to make it work.
I have two datasets:
data_1 <- data.frame(
ID = c(1, 1, 1, 1, 2, 2, 3, 3, 4, 4),
speciale = c(80003, 80003, 80003, ...
0
votes
4
answers
84
views
Subject-level filtering within a date range across two dataframes using dplyr
I'm looking to filter the data in one dataframe (Target) based of whether or not a value in another dataframe (Reference) falls between two dates in the Target dataframe.
For example, this would be my ...
1
vote
2
answers
45
views
Grouping consecutive time series days by category
I have a dataframe that consists of daily categorical values for multiple locations. I'm trying to create a new dataframe that groups the consecutive days and standalone days for each categorical ...
0
votes
2
answers
57
views
Subsetting dataframe so as to retain combinations that contain all values for a certain variable in R [closed]
Let us generate the dataframe we want to subset
vDates =
seq(
from = as.Date("2024-01-01"),
to = as.Date("2024-01-5"),
by = 1
)
vToy = c(1, 2, 3)
vColors = c("...
2
votes
3
answers
69
views
Extracting entries in a dataframe corresponding to n smallest positive values and n largest negative values of a certain variable in r
Imagine I have a table like the following one.
set.seed(12)
table =
data.frame(
value = rnorm(n = 10),
par = runif(n = 10, min = - 1, max = 1)
)
How can I extract the entries of value ...
2
votes
4
answers
69
views
Remove rows with dplyr based on two conditions of two variables in R
I have a dataframe
day<-c(155, 155, 155, 155, 155, 155, 155, 155, 155, 156, 156, 156, 156, 156, 156, 156, 156,
156, 157, 157, 157, 157, 157, 157, 157, 157, 157)
id<-c(149, 188, 206, 224, ...
1
vote
1
answer
20
views
How to apply conditional filtering based on group size?
I would like conditional filtering, based on the group size.
Suppose I have a dataframe, which looks like:
data1 <- data.frame(
ID = c(1, 1, 1, 3, 3, 5, 6),
town = c("Town A", "...
-1
votes
2
answers
48
views
Filtering out rows if a start date lies between a start and end date in another row
I have one dataframe with a grouping ID ('Site location') where different events have happened between a 'start date_time' and an 'end date_time'. I want to figure out how I can remove rows where an ...
0
votes
1
answer
37
views
How can be difference when using variable directly for filtering? [duplicate]
R makes this strange behaviour:
country=2
> Polity_data %>% filter(as.integer(ccode) == country) %>% head()
# A tibble: 0 × 37
# ℹ 37 variables: p5 <dbl>, cyear <dbl>, ccode <...