R program Filter and re-arrange data based on multiple conditions

0 votes

I have a data in which I need to filter and re-arrange columns and add a new column based on multiple conditions. Couldn't figure it out how to be done. Kindly support. I was able to sort two columns and then I'm stuck how to produce the code and logic. Alm id has multiple occurances. Now I need to re-arrange in such a way that those alm ids that has Action as "Insert" with Occur_time, should be consider as first_occur_time. Those alm ids whose action is Update with latest Occur_time should be consider as last_occur_time and those alm id with actions as delete with occur time, should be consider as Cleared_time (If delete is not available, then we should replace it with its first_occur_date  23:59:59 -- Colored below in light brown). Below is the df - almdata) and output required. Kindly share the logic and R code through which this can be achieved.

Table data (almdata):

enter image description here

Required Output

enter image description here

Thanks, 

Raj.

Jun 30, 2020 in Data Analytics by Rajhesh
• 120 points

recategorized Jun 30, 2020 by Gitika 1,490 views

1 answer to this question.

0 votes

Hi,

You need to create your own customized scripts. R language has lots of predefined keywords like insert, sort, drop, etc. Using these keywords first sort your dataset with respect to time and then drop the same value.

answered Jul 27, 2020 by MD
• 95,460 points

Related Questions In Data Analytics

0 votes
1 answer

Any filter based on conditional criteria in r?

Consider a data frame like this: #Create DF ...READ MORE

answered May 11, 2018 in Data Analytics by Sahiti
• 6,370 points
2,224 views
0 votes
1 answer

How to filter a data frame with dplyr and tidy evaluation in R?

Requires the use of map_df to run each model, ...READ MORE

answered May 17, 2018 in Data Analytics by DataKing99
• 8,250 points
1,915 views
0 votes
2 answers

How to arrange a data set in ascending order based on a variable?

In your case it'll be, orderedviews = arrange(movie_views, ...READ MORE

answered Nov 27, 2018 in Data Analytics by Kalgi
• 52,350 points
1,109 views
0 votes
2 answers

What is difference between Distributed search head and Search head cluster?

 A distributed environment describes the separation of ...READ MORE

answered Dec 4, 2018 in Data Analytics by Ali
• 11,360 points
2,497 views
+2 votes
3 answers

Problem with installation of Wordcloud in anaconda

Using Anaconda Python 3.6 version For Windows ...READ MORE

answered Aug 7, 2018 in Data Analytics by Priyaj
• 58,020 points
18,716 views
0 votes
7 answers
0 votes
3 answers

How can I add YAML current date in rmarkdown ?

<$today:MM/dd/yyyy> READ MORE

answered Mar 25, 2019 in Data Analytics by Anupam Das
15,807 views
+1 vote
3 answers

Filtering R data-frame with multiple conditions

You can use the 'filter' function from ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
87,179 views
+3 votes
1 answer

R plot for train and test data on same graph

Hi, You can use the subplot function. It ...READ MORE

answered Jul 27, 2020 in Data Analytics by MD
• 95,460 points
3,283 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP