Re: [R] Problem in R code

2023-11-09 Thread Ivan Krylov
В Wed, 8 Nov 2023 16:03:15 +0530 Crown Flame пишет: > for(i in 1:8) > { > LST_city <- extract(LST, c(lon[i],lat[i]), fun = mean, buffer = > 1, na.rm = TRUE) #error > } Three things you might need to change: 1. You are trying to assign the output of extract() to the same variable

[R] Problem in R code

2023-11-09 Thread Crown Flame
Good afternoon, I have been working on my thesis project on the topic "Urban Heat Island Pattern in India". To achieve the results I am applying a* two-dimensional Gaussian fit* on an LST raster of 1 km spatial resolution but I am facing two errors in the following code. library(raster) LST <-

Re: [R] problem in R-code

2015-11-04 Thread thanoon younis
Dear R-Users After correct some errors in the code below i have only this error "Error in if (BZ[i] < 0.25) { : missing value where TRUE/FALSE needed" how can i solve this problem please? N<-200;P<-9 #Sample size BZ=matrix(NA, nrow=N, ncol=1) W=matrix(NA, nrow=N,

Re: [R] problem in R-code

2015-11-04 Thread Jim Lemon
Hi thanoon, Well, you have generated a one column matrix of missing values (NA) and then tried to use those values in a logical test... Jim On Wed, Nov 4, 2015 at 8:02 PM, thanoon younis wrote: > Dear R-Users > > After correct some errors in the code below i have

Re: [R] problem in R-code

2015-11-03 Thread Boris Steipe
Why don't you just multiply by four, round, and add one? B. On Nov 3, 2015, at 10:02 PM, thanoon younis wrote: > Dear R-users > > I have a problem in the code below, the problem is because i want to change > the variable BZ which is a vector with 200x1 dimension

[R] problem in R-code

2015-11-03 Thread thanoon younis
Dear R-users I have a problem in the code below, the problem is because i want to change the variable BZ which is a vector with 200x1 dimension to the var. W which is categorical variable with same dimension of BZ but with categorical values with 4 categories but i got on only zero values in w

Re: [R] problem in R-code

2015-11-03 Thread Boris Steipe
Are you telling me it contains only zeros? Or is it a vector of length zero? B. On Nov 3, 2015, at 11:07 PM, thanoon younis wrote: > BZ is hidden variable with zero values. > > On 4 November 2015 at 07:02, Boris Steipe wrote: > Your

Re: [R] problem in R-code

2015-11-03 Thread Jim Lemon
Hi thanoon, The problem may lie in your definition of BZ (which I see Boris has also noticed). Given your code, it will be a vector containing 200 zeros. Your code will generate 200 ones as zero is less than 0.25. Try defining BZ as follows: BZ<-runif(200) You should get something more

Re: [R] problem in R-code

2015-11-03 Thread thanoon younis
Thank you for your response I have a vector of unknown values BZ which is defined already BZ=numeric(N) and i want to transfer BZ to ordered categorical variable with 4 categories W but when i write this code for(j in 1:1){ if(BZ[j] < 0.25){ W[j] = 1 }else if(BZ[j] >=0.25

Re: [R] problem in R-code

2015-11-03 Thread Boris Steipe
Your approach does not make sense. If you initialize a vector as say ... BZ <- numeric(5) ... what do you _expect BZ contains? Also: if you run a loop like you do for (j in 1:1) { print(j) } ... what do you _expect_ will happen? B. On Nov 3, 2015, at 10:43 PM, thanoon younis

Re: [R] problem in R-code

2015-11-03 Thread Boris Steipe
Sorry, not round. floor() B. On Nov 3, 2015, at 10:35 PM, Boris Steipe wrote: > Why don't you just multiply by four, round, and add one? > > > > B. > On Nov 3, 2015, at 10:02 PM, thanoon younis > wrote: > >> Dear R-users >> >> I

Re: [R] problem in R-code

2015-11-03 Thread Boris Steipe
Whatever - just type: W <- floor(BZ * 4) + 1 B. On Nov 3, 2015, at 11:09 PM, Boris Steipe wrote: > Are you telling me it contains only zeros? Or is it a vector of length zero? > > B. > > > On Nov 3, 2015, at 11:07 PM, thanoon younis

Re: [R] problem in r-code

2014-05-09 Thread Suzen, Mehmet
Wrong list. This is an R list not Bugs. You may want to consult Bugs materials: http://www2.mrc-bsu.cam.ac.uk/bugs/weblinks/webresource.shtml On 8 May 2014 11:36, thanoon younis thanoon.youni...@gmail.com wrote: dear all members is there anyone explain to me the code below and how can i

[R] problem in r-code

2014-05-08 Thread thanoon younis
dear all members is there anyone explain to me the code below and how can i transfer this code to winbugs program. q[i,1]=qnorm(runif(1,min=.5,max=1),0,1) thanks in advance thanoon [[alternative HTML version deleted]] __