xts - Delete rows based on certain criterias





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I need to delete xts rows based on certain criterias in column [code]. It is fine that by deleting there will be time-gaps in the xts time series.



Question: How do I solve step1/step3/step4.





The criterias are as following:



Step-1: Value [3] in [code]: If xts starts with [code] [3] delete that row.



Step-2: Value [0] in [code]: Delete the complete row.



Step-3: Value [2] in [code]: a) Keep only [2] that starts the xts, all lines above the first [2] should be removed.
b) Keep [2] that has a [3] above itself.



Step-4: Value [3] in [code]: Keep only [3] that has a [2] above itself.



My solution for step-2:



Finds and keeps, all [2] and [3], thus removing all [0]:



xts3 <- xts3[grep("[2]|[3]", xts3$code), ] 


My R-file:



dates <- as.POSIXct( # Construct the dates to be used.
c(
"2013-07-24 09:01:00",
"2013-07-24 09:02:00",
"2013-07-24 09:03:00",
"2013-07-24 09:04:00",
"2013-07-24 09:05:00",
"2013-07-24 09:06:00",
"2013-07-24 09:07:00",
"2013-07-24 09:08:00",
"2013-07-24 09:09:00"
)
)

code <- c(3, 2, 0, 2, 2, 2, 3, 3, 3) # Criterias for delete/keep rows.

data <- data.frame(code) # Create a dataframe.

xts3 <- xts(x=data, order.by=dates) # Create xts based on dataframe.


The result of the R-file (prior to deleting rows based on criterias):



                    code
2013-07-24 09:01:00 3
2013-07-24 09:02:00 2
2013-07-24 09:03:00 0
2013-07-24 09:04:00 2
2013-07-24 09:05:00 2
2013-07-24 09:06:00 2
2013-07-24 09:07:00 3
2013-07-24 09:08:00 3
2013-07-24 09:09:00 3


Explanation: What should trigger delete of rows (based on criterias):



                    code
2013-07-24 09:01:00 3 # To be removed due to step-1.
2013-07-24 09:02:00 2 # To be kept due to step-3a.
2013-07-24 09:03:00 0 # To be removed due to step-2
2013-07-24 09:04:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:05:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:06:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:07:00 3 # The kept due to step-4
2013-07-24 09:08:00 3 # To be removed due to not fulfilling step4.
2013-07-24 09:09:00 3 # To be removed due to not fulfilling step4.


Expected outcome after deleting rows has been done:



                    code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3









share|improve this question




















  • 1





    Interesting homework (guess), solution 2a you could do xts3[which(xts3$code == 2)[1]:nrow(xts3), ].

    – jay.sf
    Nov 22 '18 at 9:00











  • @jay.sf It is actually not a homework. I am building a system that requires cleaning the xts.

    – Toolbox
    Nov 22 '18 at 9:23






  • 1





    Based on your example, please add an expected output. And do you need to use xts or can dplyr / data.table or something else be used as well? Also does rule 4 need to be implemented first or after rule 1-3 have been executed?

    – phiver
    Nov 22 '18 at 9:48











  • @phiver: I updated the question with expected outcome. I prefer to stay with xts but an alternative would be moving xts to dataframe thus loosing though the timestamp functionality from xts. I want to keep amount of loaded R package to its minimum. I re-ordered the steps so they make more sense in sequence.

    – Toolbox
    Nov 22 '18 at 10:06













  • @jay.sf I was asked to clarify the order of the steps, so your answer is solving step 3a.

    – Toolbox
    Nov 22 '18 at 10:07


















0















I need to delete xts rows based on certain criterias in column [code]. It is fine that by deleting there will be time-gaps in the xts time series.



Question: How do I solve step1/step3/step4.





The criterias are as following:



Step-1: Value [3] in [code]: If xts starts with [code] [3] delete that row.



Step-2: Value [0] in [code]: Delete the complete row.



Step-3: Value [2] in [code]: a) Keep only [2] that starts the xts, all lines above the first [2] should be removed.
b) Keep [2] that has a [3] above itself.



Step-4: Value [3] in [code]: Keep only [3] that has a [2] above itself.



My solution for step-2:



Finds and keeps, all [2] and [3], thus removing all [0]:



xts3 <- xts3[grep("[2]|[3]", xts3$code), ] 


My R-file:



dates <- as.POSIXct( # Construct the dates to be used.
c(
"2013-07-24 09:01:00",
"2013-07-24 09:02:00",
"2013-07-24 09:03:00",
"2013-07-24 09:04:00",
"2013-07-24 09:05:00",
"2013-07-24 09:06:00",
"2013-07-24 09:07:00",
"2013-07-24 09:08:00",
"2013-07-24 09:09:00"
)
)

code <- c(3, 2, 0, 2, 2, 2, 3, 3, 3) # Criterias for delete/keep rows.

data <- data.frame(code) # Create a dataframe.

xts3 <- xts(x=data, order.by=dates) # Create xts based on dataframe.


The result of the R-file (prior to deleting rows based on criterias):



                    code
2013-07-24 09:01:00 3
2013-07-24 09:02:00 2
2013-07-24 09:03:00 0
2013-07-24 09:04:00 2
2013-07-24 09:05:00 2
2013-07-24 09:06:00 2
2013-07-24 09:07:00 3
2013-07-24 09:08:00 3
2013-07-24 09:09:00 3


Explanation: What should trigger delete of rows (based on criterias):



                    code
2013-07-24 09:01:00 3 # To be removed due to step-1.
2013-07-24 09:02:00 2 # To be kept due to step-3a.
2013-07-24 09:03:00 0 # To be removed due to step-2
2013-07-24 09:04:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:05:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:06:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:07:00 3 # The kept due to step-4
2013-07-24 09:08:00 3 # To be removed due to not fulfilling step4.
2013-07-24 09:09:00 3 # To be removed due to not fulfilling step4.


Expected outcome after deleting rows has been done:



                    code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3









share|improve this question




















  • 1





    Interesting homework (guess), solution 2a you could do xts3[which(xts3$code == 2)[1]:nrow(xts3), ].

    – jay.sf
    Nov 22 '18 at 9:00











  • @jay.sf It is actually not a homework. I am building a system that requires cleaning the xts.

    – Toolbox
    Nov 22 '18 at 9:23






  • 1





    Based on your example, please add an expected output. And do you need to use xts or can dplyr / data.table or something else be used as well? Also does rule 4 need to be implemented first or after rule 1-3 have been executed?

    – phiver
    Nov 22 '18 at 9:48











  • @phiver: I updated the question with expected outcome. I prefer to stay with xts but an alternative would be moving xts to dataframe thus loosing though the timestamp functionality from xts. I want to keep amount of loaded R package to its minimum. I re-ordered the steps so they make more sense in sequence.

    – Toolbox
    Nov 22 '18 at 10:06













  • @jay.sf I was asked to clarify the order of the steps, so your answer is solving step 3a.

    – Toolbox
    Nov 22 '18 at 10:07














0












0








0








I need to delete xts rows based on certain criterias in column [code]. It is fine that by deleting there will be time-gaps in the xts time series.



Question: How do I solve step1/step3/step4.





The criterias are as following:



Step-1: Value [3] in [code]: If xts starts with [code] [3] delete that row.



Step-2: Value [0] in [code]: Delete the complete row.



Step-3: Value [2] in [code]: a) Keep only [2] that starts the xts, all lines above the first [2] should be removed.
b) Keep [2] that has a [3] above itself.



Step-4: Value [3] in [code]: Keep only [3] that has a [2] above itself.



My solution for step-2:



Finds and keeps, all [2] and [3], thus removing all [0]:



xts3 <- xts3[grep("[2]|[3]", xts3$code), ] 


My R-file:



dates <- as.POSIXct( # Construct the dates to be used.
c(
"2013-07-24 09:01:00",
"2013-07-24 09:02:00",
"2013-07-24 09:03:00",
"2013-07-24 09:04:00",
"2013-07-24 09:05:00",
"2013-07-24 09:06:00",
"2013-07-24 09:07:00",
"2013-07-24 09:08:00",
"2013-07-24 09:09:00"
)
)

code <- c(3, 2, 0, 2, 2, 2, 3, 3, 3) # Criterias for delete/keep rows.

data <- data.frame(code) # Create a dataframe.

xts3 <- xts(x=data, order.by=dates) # Create xts based on dataframe.


The result of the R-file (prior to deleting rows based on criterias):



                    code
2013-07-24 09:01:00 3
2013-07-24 09:02:00 2
2013-07-24 09:03:00 0
2013-07-24 09:04:00 2
2013-07-24 09:05:00 2
2013-07-24 09:06:00 2
2013-07-24 09:07:00 3
2013-07-24 09:08:00 3
2013-07-24 09:09:00 3


Explanation: What should trigger delete of rows (based on criterias):



                    code
2013-07-24 09:01:00 3 # To be removed due to step-1.
2013-07-24 09:02:00 2 # To be kept due to step-3a.
2013-07-24 09:03:00 0 # To be removed due to step-2
2013-07-24 09:04:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:05:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:06:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:07:00 3 # The kept due to step-4
2013-07-24 09:08:00 3 # To be removed due to not fulfilling step4.
2013-07-24 09:09:00 3 # To be removed due to not fulfilling step4.


Expected outcome after deleting rows has been done:



                    code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3









share|improve this question
















I need to delete xts rows based on certain criterias in column [code]. It is fine that by deleting there will be time-gaps in the xts time series.



Question: How do I solve step1/step3/step4.





The criterias are as following:



Step-1: Value [3] in [code]: If xts starts with [code] [3] delete that row.



Step-2: Value [0] in [code]: Delete the complete row.



Step-3: Value [2] in [code]: a) Keep only [2] that starts the xts, all lines above the first [2] should be removed.
b) Keep [2] that has a [3] above itself.



Step-4: Value [3] in [code]: Keep only [3] that has a [2] above itself.



My solution for step-2:



Finds and keeps, all [2] and [3], thus removing all [0]:



xts3 <- xts3[grep("[2]|[3]", xts3$code), ] 


My R-file:



dates <- as.POSIXct( # Construct the dates to be used.
c(
"2013-07-24 09:01:00",
"2013-07-24 09:02:00",
"2013-07-24 09:03:00",
"2013-07-24 09:04:00",
"2013-07-24 09:05:00",
"2013-07-24 09:06:00",
"2013-07-24 09:07:00",
"2013-07-24 09:08:00",
"2013-07-24 09:09:00"
)
)

code <- c(3, 2, 0, 2, 2, 2, 3, 3, 3) # Criterias for delete/keep rows.

data <- data.frame(code) # Create a dataframe.

xts3 <- xts(x=data, order.by=dates) # Create xts based on dataframe.


The result of the R-file (prior to deleting rows based on criterias):



                    code
2013-07-24 09:01:00 3
2013-07-24 09:02:00 2
2013-07-24 09:03:00 0
2013-07-24 09:04:00 2
2013-07-24 09:05:00 2
2013-07-24 09:06:00 2
2013-07-24 09:07:00 3
2013-07-24 09:08:00 3
2013-07-24 09:09:00 3


Explanation: What should trigger delete of rows (based on criterias):



                    code
2013-07-24 09:01:00 3 # To be removed due to step-1.
2013-07-24 09:02:00 2 # To be kept due to step-3a.
2013-07-24 09:03:00 0 # To be removed due to step-2
2013-07-24 09:04:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:05:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:06:00 2 # To be removed due to not fulfilling step-3b
2013-07-24 09:07:00 3 # The kept due to step-4
2013-07-24 09:08:00 3 # To be removed due to not fulfilling step4.
2013-07-24 09:09:00 3 # To be removed due to not fulfilling step4.


Expected outcome after deleting rows has been done:



                    code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3






r xts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 11:10







Toolbox

















asked Nov 22 '18 at 8:39









ToolboxToolbox

662312




662312








  • 1





    Interesting homework (guess), solution 2a you could do xts3[which(xts3$code == 2)[1]:nrow(xts3), ].

    – jay.sf
    Nov 22 '18 at 9:00











  • @jay.sf It is actually not a homework. I am building a system that requires cleaning the xts.

    – Toolbox
    Nov 22 '18 at 9:23






  • 1





    Based on your example, please add an expected output. And do you need to use xts or can dplyr / data.table or something else be used as well? Also does rule 4 need to be implemented first or after rule 1-3 have been executed?

    – phiver
    Nov 22 '18 at 9:48











  • @phiver: I updated the question with expected outcome. I prefer to stay with xts but an alternative would be moving xts to dataframe thus loosing though the timestamp functionality from xts. I want to keep amount of loaded R package to its minimum. I re-ordered the steps so they make more sense in sequence.

    – Toolbox
    Nov 22 '18 at 10:06













  • @jay.sf I was asked to clarify the order of the steps, so your answer is solving step 3a.

    – Toolbox
    Nov 22 '18 at 10:07














  • 1





    Interesting homework (guess), solution 2a you could do xts3[which(xts3$code == 2)[1]:nrow(xts3), ].

    – jay.sf
    Nov 22 '18 at 9:00











  • @jay.sf It is actually not a homework. I am building a system that requires cleaning the xts.

    – Toolbox
    Nov 22 '18 at 9:23






  • 1





    Based on your example, please add an expected output. And do you need to use xts or can dplyr / data.table or something else be used as well? Also does rule 4 need to be implemented first or after rule 1-3 have been executed?

    – phiver
    Nov 22 '18 at 9:48











  • @phiver: I updated the question with expected outcome. I prefer to stay with xts but an alternative would be moving xts to dataframe thus loosing though the timestamp functionality from xts. I want to keep amount of loaded R package to its minimum. I re-ordered the steps so they make more sense in sequence.

    – Toolbox
    Nov 22 '18 at 10:06













  • @jay.sf I was asked to clarify the order of the steps, so your answer is solving step 3a.

    – Toolbox
    Nov 22 '18 at 10:07








1




1





Interesting homework (guess), solution 2a you could do xts3[which(xts3$code == 2)[1]:nrow(xts3), ].

– jay.sf
Nov 22 '18 at 9:00





Interesting homework (guess), solution 2a you could do xts3[which(xts3$code == 2)[1]:nrow(xts3), ].

– jay.sf
Nov 22 '18 at 9:00













@jay.sf It is actually not a homework. I am building a system that requires cleaning the xts.

– Toolbox
Nov 22 '18 at 9:23





@jay.sf It is actually not a homework. I am building a system that requires cleaning the xts.

– Toolbox
Nov 22 '18 at 9:23




1




1





Based on your example, please add an expected output. And do you need to use xts or can dplyr / data.table or something else be used as well? Also does rule 4 need to be implemented first or after rule 1-3 have been executed?

– phiver
Nov 22 '18 at 9:48





Based on your example, please add an expected output. And do you need to use xts or can dplyr / data.table or something else be used as well? Also does rule 4 need to be implemented first or after rule 1-3 have been executed?

– phiver
Nov 22 '18 at 9:48













@phiver: I updated the question with expected outcome. I prefer to stay with xts but an alternative would be moving xts to dataframe thus loosing though the timestamp functionality from xts. I want to keep amount of loaded R package to its minimum. I re-ordered the steps so they make more sense in sequence.

– Toolbox
Nov 22 '18 at 10:06







@phiver: I updated the question with expected outcome. I prefer to stay with xts but an alternative would be moving xts to dataframe thus loosing though the timestamp functionality from xts. I want to keep amount of loaded R package to its minimum. I re-ordered the steps so they make more sense in sequence.

– Toolbox
Nov 22 '18 at 10:06















@jay.sf I was asked to clarify the order of the steps, so your answer is solving step 3a.

– Toolbox
Nov 22 '18 at 10:07





@jay.sf I was asked to clarify the order of the steps, so your answer is solving step 3a.

– Toolbox
Nov 22 '18 at 10:07












1 Answer
1






active

oldest

votes


















1














If you only have 0, 2, and 3 as values you can use diff to get most of the rules in 1 go. Only those records are needed where the difference is 1 (2 above 3) or -1 (3 above 2). So the absolute value of diff will be what we need. And we need the first row where the value is 2. Those we combine to get the result xts3_filtered.
xts3_filtered <- c(xts3[first(which(xts3$code == 2))], xts3[abs(diff(xts3$code)) == 1])



                    code
2013-07-24 09:02:00 2
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3


Now we have a duplicate row because both rules select the record where the first 2 occurs. So we remove any duplicates with the following code



xts3_filtered[!duplicated(index(xts3_filtered))]
code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3





share|improve this answer
























  • - Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

    – Toolbox
    Nov 22 '18 at 21:32














Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426851%2fxts-delete-rows-based-on-certain-criterias%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














If you only have 0, 2, and 3 as values you can use diff to get most of the rules in 1 go. Only those records are needed where the difference is 1 (2 above 3) or -1 (3 above 2). So the absolute value of diff will be what we need. And we need the first row where the value is 2. Those we combine to get the result xts3_filtered.
xts3_filtered <- c(xts3[first(which(xts3$code == 2))], xts3[abs(diff(xts3$code)) == 1])



                    code
2013-07-24 09:02:00 2
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3


Now we have a duplicate row because both rules select the record where the first 2 occurs. So we remove any duplicates with the following code



xts3_filtered[!duplicated(index(xts3_filtered))]
code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3





share|improve this answer
























  • - Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

    – Toolbox
    Nov 22 '18 at 21:32


















1














If you only have 0, 2, and 3 as values you can use diff to get most of the rules in 1 go. Only those records are needed where the difference is 1 (2 above 3) or -1 (3 above 2). So the absolute value of diff will be what we need. And we need the first row where the value is 2. Those we combine to get the result xts3_filtered.
xts3_filtered <- c(xts3[first(which(xts3$code == 2))], xts3[abs(diff(xts3$code)) == 1])



                    code
2013-07-24 09:02:00 2
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3


Now we have a duplicate row because both rules select the record where the first 2 occurs. So we remove any duplicates with the following code



xts3_filtered[!duplicated(index(xts3_filtered))]
code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3





share|improve this answer
























  • - Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

    – Toolbox
    Nov 22 '18 at 21:32
















1












1








1







If you only have 0, 2, and 3 as values you can use diff to get most of the rules in 1 go. Only those records are needed where the difference is 1 (2 above 3) or -1 (3 above 2). So the absolute value of diff will be what we need. And we need the first row where the value is 2. Those we combine to get the result xts3_filtered.
xts3_filtered <- c(xts3[first(which(xts3$code == 2))], xts3[abs(diff(xts3$code)) == 1])



                    code
2013-07-24 09:02:00 2
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3


Now we have a duplicate row because both rules select the record where the first 2 occurs. So we remove any duplicates with the following code



xts3_filtered[!duplicated(index(xts3_filtered))]
code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3





share|improve this answer













If you only have 0, 2, and 3 as values you can use diff to get most of the rules in 1 go. Only those records are needed where the difference is 1 (2 above 3) or -1 (3 above 2). So the absolute value of diff will be what we need. And we need the first row where the value is 2. Those we combine to get the result xts3_filtered.
xts3_filtered <- c(xts3[first(which(xts3$code == 2))], xts3[abs(diff(xts3$code)) == 1])



                    code
2013-07-24 09:02:00 2
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3


Now we have a duplicate row because both rules select the record where the first 2 occurs. So we remove any duplicates with the following code



xts3_filtered[!duplicated(index(xts3_filtered))]
code
2013-07-24 09:02:00 2
2013-07-24 09:07:00 3






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 13:03









phiverphiver

13.9k92936




13.9k92936













  • - Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

    – Toolbox
    Nov 22 '18 at 21:32





















  • - Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

    – Toolbox
    Nov 22 '18 at 21:32



















- Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

– Toolbox
Nov 22 '18 at 21:32







- Phiver, The solution you provided work great on the minimized sample in the question. For some reason when running on my real R-file, the result is only showing the first found value [2], meaning only 1 line is visible. I will take my real file and strip it down both horizontal and vertical to run some tests and try to isolate what is the discrepancy between the test-file and real-file.

– Toolbox
Nov 22 '18 at 21:32






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426851%2fxts-delete-rows-based-on-certain-criterias%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?