Foro de debate

Qué significa este error?

Qué significa este error?

de Frida Flores Flores -
Número de respuestas: 2

Hola, tengo el siguiente código:

>source("depurdat.R")
> library(readxl)
> d<-as.data.frame(read_excel("Database_RioChapingoMX_final1.xls", sheet="todas" ))
> options(max.print=1000000) 
> write(unlist(t(d[,4:34])),'Prec_1970-2015.dat',ncolumns=34)
> library(readxl)
> p<-as.data.frame(read_excel("Prec_1970-2015.xls", sheet="Hoja1" ))
> options(max.print=1000000) 
> write(unlist(t(p[1:9,])),"Prec_1970-2015.est", ncolumns=5)
> homogen("Prec", 1970, 2015, snht1=0,expl=TRUE)
HOMOGEN() APPLICATION OUTPUT  (From R's contributed package 'climatol' 3.1)
=========== Homogenization of Prec, 1970-2015. (Sat Feb 24 18:32:25 2018)
Parameters: varcli=Prec anyi=1970 anyf=2015 suf=NA nm=NA nref=10,10,4 std=3 swa=NA ndec=1 dz.max=5 dz.min=-5 wd=0,0,100 snht1=0 snht2=0 tol=0.02 mxdif=NA maxdif=0.05 maxite=999 force=FALSE wz=0.001 trf=0 mndat=NA gp=3 ini=NA na.strings=NA vmin=NA vmax=NA nclust=100 cutlev=NA grdcol=#666666 mapcol=#666666 hires=TRUE expl=TRUE metad=FALSE sufbrk=m tinc=NA tz=UTC cex=1.2 verb=TRUE

y me arroja al final este error

Error in if (max(abs(est.c[, 1])) > 180 | max(abs(est.c[, 2])) > 90) deg <- FALSE else { : 
  missing value where TRUE/FALSE needed

No entiendo bien qué significa, también coloqué el argumento deg=TRUE o deg=FALSE, pero luego me marca esto:

Error in homogen("Prec", 1970, 2015, snht1 = 0, deg = FALSE) : 
  unused argument (deg = FALSE)

Alguien que me pueda orientar?





En respuesta a Frida Flores Flores

Re: Qué significa este error?

de Manuel Muñoz Márquez -

Buenas Frida:

Pues yo diría que la función espera una columna est.c que no le estás pasando.

¿Has mirado la documentación de dicha función?

Un saludo.

En respuesta a Manuel Muñoz Márquez

Re: Qué significa este error?

de Frida Flores Flores -

Tienes razón. Si, pero en la versión actual ya no pide que se declare ese argumento:

http://www.climatol.eu/Climatol3-es.pdf

  • La función homogen nos va a permitir constatar de cuántos datos disponemos y si contienen anomalías atribuibles a errores. Para ello ejecutaremos: 

                       homogen('Ttest',1981,2000,snht1=0)


anterior: http://www.climatol.eu/climatol-guide.pdf pagina 13 y 14: 

  • deg Set to FALSE if the input coordinates are in km (the distance units used internally by the package), or left in its default TRUE value if they are in geographical degrees.

  • As it was said in the quick guide, the most trivial homogenization example with this function is: homogen("Tmin", 1956, 2005)

Aún así, estoy intentando que declarar que las columas 1 y 2 sean deg<-TRUE, y ahora me encuentro con esto: 

 -98.9128  19.5439 2245 "15008"                   "ATENCO"

1 -98.84611 19.38472 2405 "15017"   "COATEPEC DE LOS OLIVOS"

2 -98.76528 19.32500 2900 "15018" "COLONIA MANUEL A CAMACHO"

3 -98.91389 19.57611 2250 "15044"                "LA GRANDE"

4 -98.91056 19.53194 2244 "15083"               "SAN ANDRES"

5 -98.81250 19.51944 2405 "15101"      "SAN MIGUEL TLAIXPAN"

6 -98.93167 19.45056 2260 "15145"     "PLAN LAGO DE TEXCOCO"

7 -98.88639 19.48472 2250 "15170"             "CHAPINGO DGE"



8 -98.72667 19.52972 2750 "15210"      "SAN JUAN TOTOLALPAN"



No logro que lea la primera línea, es decir que no considere encabezado. Y ya coloqué el argumento header=FALSE, (aún cuando el archivo no tiene encabezados), y también con la orden que lea de la línea 1 a la 9:

library(readxl)
p<-as.data.frame(read_excel("Prec_1970-2015.xls", sheet="Hoja1" ))
options(max.print=1000000) 
write(unlist(t(p[1:9,],"Prec_1970-2015.est", ncolumns=5)
print(p)

Aquí le quite el argumento de header al ver que no funcionaba.

¿Qué opinas?