19 3:33 PM
To: Steinmann, Kimberly@CDPR ; r-help mailing
list
Subject: Re: [R] help with if statement with two conditions
EXTERNAL:
Hi Kimberley,
Since you are using a loop and therefore testing one value of v_trends_lbs at a
time, the "&" in the "if" statement should be "&a
Hi Kimberley,
Given the number of posts that read "I have a problem, please advise",
your concern for our mental welfare is a great Xmas present.
Jim
On Tue, Dec 24, 2019 at 10:38 AM Steinmann, Kimberly@CDPR
wrote:
>
> I am not sure how to close the thread - I hate to waste anyone's time on a
>
Hi Kimberley,
Since you are using a loop and therefore testing one value of
v_trends_lbs at a time, the "&" in the "if" statement should be "&&".
Pinching Bert's example but using a for loop instead of ifelse:
x <- seq(-2,2,.25)
v_lbs<-rep("",length(x))
for(i in 1:length(x)) {
if(is.na(x[i])) v_l
WITHOUT going through your code carefully (but where is v_lbs first
defined?), maybe something like this is what you want:
> x <- seq(-2,2,.25)
> x
[1] -2.00 -1.75 -1.50 -1.25 -1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50
0.75 1.00
[14] 1.25 1.50 1.75 2.00
> x <- ifelse(x>0 & x<1, '<1', format(
What does the error message say?
On Mon, Dec 23, 2019, 3:33 PM Steinmann, Kimberly@CDPR <
kimberly.steinm...@cdpr.ca.gov> wrote:
> Hi - i am not super familiar with R, but need to modify my predecessor's R
> code so that if a variable is >0 and < 0.5, it will be replaced with <1. I
> have looked
Hi - i am not super familiar with R, but need to modify my predecessor's R code
so that if a variable is >0 and < 0.5, it will be replaced with <1. I have
looked at a bunch of forum threads on the subject, but cannot seem to get
anything to work Any help at what i might be doing wrong much appre
6 matches
Mail list logo