Skip to content
Prev 246818 / 398506 Next

Error: unexpected string constant

On Fri, 2011-01-07 at 12:17 -0800, paogeomat wrote:
Space you code out! The it is easy to spot what is wrong:

danta = ppp(Datos$x, Datos$y, c(min(Datos$x)1177842, max(Datos
$x)1180213), c(min(Datos$y)1013581, max(Datos$y)1015575))

You have lots of the following:

c(min(Datos$y)1013581, max(Datos$y)1015575)
             ^^^                  ^^^

you can't do this! Why are you including the numbers here? These are the
min and max values, so either use c(1177842, 1180213), or c(min(x),
max(x)), or range(x), but not a combination of the numbers and the
function output. Wouldn't this:

c(min(Datos$y), max(Datos$y))

or even

range(Datos$y)

be better?

Also, if we drop the syntax errors for the numbers you keep typing in,
you could write this more cleanly by using `with()`:

danta <- with(Datos, ppp(x, y, c(min(x), max(x)), c(min(y), max(y))))

or using range

danta <- with(Datos, ppp(x, y, range(x), range(y)))

Those two are far easier to read than your code.

HTH

G