Skip to main content

All Questions

Tagged with
1 vote
2 answers
44 views

How to select the row with specific condition and the row just above? [closed]

Here is how I defined my condition , but I need the row just above as well. There are many observations per ID. data2<- data2 %>% group_by (ID_number) %>% filter(time_diff_hour > 8....
Asma's user avatar
  • 11
1 vote
2 answers
40 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 ...
DN98024's user avatar
  • 19
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 ...
Luigi's user avatar
  • 11
1 vote
2 answers
42 views

How to get column-wise summary statistics with missing codes?

I have written a custom function ord_table() to extract summary statistics from a series of databases. To get those summary statistics, I have to filter out missing data codes (all codes are large ...
Suzanne Segerstrom's user avatar
1 vote
2 answers
53 views

How to filter data with sequences missing sections of a specified size or greater?

I have a data frame with a sequence (Slice) of observations for each group. Many of the sequences are incomplete. This is a simplified version of the data: Slice GroupID Observation 1 A 1 2 A 6 3 ...
user21008368's user avatar
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 ...
ForEverNewbie's user avatar
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 ...
Simon Harmel's user avatar
  • 1,449
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, ...
Érika Soares Coelho's user avatar
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", &...
lemnbalm's user avatar
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 ...
Simon Harmel's user avatar
  • 1,449
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, ...
user13069688's user avatar
2 votes
7 answers
110 views

How to count observations after each filter in tidyverse R?

I often apply filters in R, e.g. when selecting a particular sample or feature or excluding implausible values. Is there a fast and easy way to keep track on how many units were deleted after every ...
Marco's user avatar
  • 2,727
1 vote
3 answers
82 views

Remove elements with same prefix from a string in a column

and thank you for being part of an awesome community of learners and explorers! :) I have an issue with removing elements from a character column. This answer pointed me in a correct direction (split ...
ferallOut's user avatar
1 vote
5 answers
79 views

How to filter out the top Nth value of each row in a R dataframe?

There is a R dataframe, I want to filter out the top Nth value of each row with the rest values being set to 0. For example, suppose the dataframe looks like the following table: 0.5 0.3 0.2 0.15 0.9 ...
Li Ma's user avatar
  • 31
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 ...
TDeramus's user avatar
  • 160

15 30 50 per page
1
2 3 4 5
151