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 in Data Analytics by Rajhesh
• 120 points

recategorized Jun 30 by Gitika 91 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 6 days ago by MD
• 40,740 points

Related Questions In Data Analytics

0 votes
2 answers

Filtering R data-frame with multiple conditions

librarry(dplyr) dataset >%> filter((a ==1,b>15 ) | (a==2,b&g ...READ MORE

answered Aug 8, 2019 in Data Analytics by anonymous
25,945 views
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,290 points
84 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 16, 2018 in Data Analytics by DataKing99
• 8,150 points
408 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
• 51,890 points
161 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 3, 2018 in Data Analytics by Ali
• 10,670 points
384 views
+1 vote
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
• 57,550 points
8,037 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
4,329 views
0 votes
1 answer

R plot for train and test data on same graph

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

answered 6 days ago in Data Analytics by MD
• 40,740 points
29 views