I have 4 columns consisting of the following: stock identification number, date, price, and market cap. Is there a way for me to delete any stock in R (based on their identification number) if the value of their prices at any point in time is zero? Thank you very much.
I tried to write the following loop in R to filter out all of the assets with zero prices using this code:
for (i in 1:length(data$price)) {
if (data$price[i]=0) {
data <- filter(!row_number() %in% i)
}
}
but it doesn't work.