[R] Error in data.frame

MacQueen, Don macqueen1 at llnl.gov
Thu Jan 22 00:35:04 CET 2015

Since neither of the objects named in the error message, dates and
spi.plot, show up in your script, it's pretty much impossible to guess.

You will probably find that if you do
you will get different numbers. Perhaps 30 for one of them and 52559 for
the other. (This assumes that "dates" is a vector, which can't be verified
from what you provided.) Try looking at

It would help if you could do as suggested at the bottom of every message
on R-help:

"PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code."

Also, try not to send html formatted email.


Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550

On 1/21/15, 9:54 AM, "John Wasige" <johnwasige at gmail.com> wrote:

>Kindly help me out on this error  from running SPI package. I am trying to
>run SPI package with 30 years rainfall data but I get this error:
>Error in data.frame(dates = dates, spi.plot[, 1:ncolumn]) :
>  arguments imply differing number of rows: 30, 52559
>#### script
>prec1 <- open.ncdf('D:/Lund2015/CRU1982_2011/
>###prec <-get.var.ncdf(prec1,"pre")
>### get values
>prec <-get.var.ncdf(prec1,"pre")
>lons <-get.var.ncdf(prec1,"lon")
>lats <-get.var.ncdf(prec1,"lat")
>time <-get.var.ncdf(prec1,"time")
>prec.dim <- dim(prec)
>Nx <- prec.dim[1]
>Ny <- prec.dim[2]
>Nt <- prec.dim[3]
>write.table(prec,file="spi1.txt", append = FALSE, na ="NA", dec = ".",
>row.names = TRUE, col.names = TRUE)
> str(prec)
>num [1:167, 1:146, 1:360]
>Thanks for your help
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list