KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
We want to set all values in an array zero that are negative. I tried out a a lot of stuff but did not yet achieve a working solution. I thought about a for loop with condition, however this seems not to work. #pred_precipitation is our array pred_precipitation <-rnorm(25,2,4) for (i in nrow(pred_precipitation)) { if (pred_precipitation[i]<0) {pred_precipitation[i] = 0} else{pred_precipitation[i] = pred_precipitation[i]} }
Tags (comma-separated)
Save Edits
Cancel