Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 207

Creating a custom filter [duplicate]

$
0
0

I am wanting some help with inputting a value into a filter line. The variable in the raw dataset changes it's name each year to the corresponding year and I don't want to replace it in all the code locations it comes up. Is there a way to paste in a value into a filter?

year <- 2024

all_people_31DEC_CurrentYr <- paste0("all_people_31DEC",year-1,"_filter") ###this results in all_people_31DEC2023_filter

CleanData <- RawData %>% filter(all_people_31DEC_CurrentYr == "1")

But I get zero observations and when I do the same thing with

CleanData <- RawData %>% filter(all_people_31DEC2023_filter== "1") I get 6,000 values.


Viewing all articles
Browse latest Browse all 207

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>