Skip to content

Trouble with SPI package

2 messages · Miller Andres Ruiz Sanchez, Jeff Newmiller

#
Hello,

I write to ask you about an error that I have when I use the script below.
I'm working with monthly  precipitation  data for the period between 1990
and 1998.

I really thanks your help.

_______________________________________________________________
[1] "IndexScript.R"  "PradoCorre.txt" "spi.txt"
Error en data[i, ] : sub?ndice fuera de  los l?mites
Months X1990  X1991 X1992 X1993 X1994 X1995 X1996 X1997 X1998
1     Jan   0.0   0.00   0.0  22.3   0.0   0.0  15.4   0.0   0.0
2     Feb   0.0  11.00   0.0   0.0   0.0   0.0   0.0   2.5   0.0
3     Mar   0.0   8.70   0.0  13.1   0.3   0.4  34.3   0.0   3.8
4     Apr  52.0  32.20  96.8  70.0  61.4 251.0  21.0  31.0  18.0
5     May 130.0  34.11 249.1 348.4 211.0 141.5 144.8  36.3 314.3
6     Jun 102.0 142.20 188.5  70.6  24.1 116.9  90.6 159.4 126.9
7     Jul  86.0  98.00  80.6  89.0  39.9 228.0 234.0  26.2  27.8
8     Aug 135.0  82.78  76.3 173.5 245.9 370.9  44.2  51.8 162.4
9     Sep 132.0 103.30 216.4 214.3 120.0 177.7  84.3 132.3 403.9
10    Oct 432.0 245.60 180.6 253.2 101.2 356.1 241.9  92.8 117.8
11    Nov  42.6  24.03  48.3  64.3 155.1  15.0 120.0  14.2   0.0
12    Dec 109.3   1.60   0.0  26.0   0.0   9.3   0.0   0.0   0.0
________________________________________________________________




Cordialmente

*Miller Ruiz*
Ingeniero Agr?nomo
Auxiliar de Investigaci?n
?rea de Geom?tica
Cenipalma - Zona Norte
Cel: 3164807973
Fundaci?n - Magdalena

-- 
[image: Fedepalma] 
<http://www.google.com/url?q=http%3A%2F%2Fwww.fedepalma.org&sa=D&sntz=1&usg=AFrqEzcV3Ok1p8dfn_mAY_mbeKqx9TcBUA>
  
<http://www.google.com/url?q=http%3A%2F%2Fwww.cenipalma.org%2F&sa=D&sntz=1&usg=AFrqEzfg7qal8zogbo9Aq6drmj-iPne9eQ>
El presente mensaje de datos como sus archivos adjuntos se consideran 
informaci?n confidencial y de valor estrat?gico para la Federaci?n; motivo 
por el cual s?lo podr?  ser empleada por su exclusivo destinatario, seg?n 
las indicaciones impartidas por el remitente y dada la naturaleza de la 
misma. En consecuencia, cualquier uso, explotaci?n, reproducci?n,
modificaci?n, distribuci?n, puesta a disposici?n entre otras posibilidades 
diferentes a las autorizadas, se entender?n expresamente prohibidas. Si 
Usted No es el destinatario, deber  eliminar completamente el mensaje y, en
lo posible, notificar al remitente del mismo. Es responsabilidad del 
destinatario de este mensaje comprobar que el mensaje de datos y sus 
adjuntos no representan un riesgo inform?tico para su propio sistema.

La Federaci?n ha tomado las medidas adecuadas para tratar de prevenir la 
transmisi?n de virus y programas malignos, no obstante, no se hace 
responsable por su eventual transmisi?n por este conducto. La Federaci?n 
 no acepta responsabilidad alguna por eventuales da?os o alteraciones
derivadas de la recepci?n o uso del presente mensaje.
#
Why are you overwriting your input file after you read it in? This seems likely to end up corrupting your input data if you make a mistake.

For instance, when you read a file into a data frame that has pure numeric values in the header line, the default behaviour is to convert those numeric values to valid labels, which means that they must start with a letter (in this case X). 

I have never used the spi function, but its help file example for the filename argument suggests that the year numbers should not have letters in them. 

You should be able to use a text editor to repair your input file, and remove the line that overwrites it from your code.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
On May 25, 2015 8:56:32 AM PDT, Miller Andres Ruiz Sanchez <mruiz at cenipalma.org> wrote: