0

In the following code, I got the "target of assignment expands to non-language object" error:

> rho=c(0,0,0)
> if (rho[1]>1 || rho[1] <-1 || rho[2]>1 || rho[2] <-1 || rho[3]>1 || rho[3] <-1){
+ cat("Correlation must be within [-1,1]!\n");
+ retMCx = NULL; retMCy = NULL; retMCz =NULL;
+ } 
Error in 1 || rho[3] > 1 || rho[3] <- 1 :    target of assignment expands to non-language object

Any idea why? Thanks!

Tim
  • 88,294
  • 128
  • 338
  • 543

1 Answers1

4

I'd start by adding spaces: rho[1] <-1 presumably was meant to be rho[1] < -1 but what you got here is rho[1] <- 1.

Dirk Eddelbuettel
  • 347,098
  • 55
  • 623
  • 708