3
I need to calculate the pBias, but it’s a mistake. I’ve performed this calculation before and it worked, I don’t know what could be going wrong, below the code I used:
#observado
obs <- read.csv("Goiania-estacao.csv", header = T, skip = 0, sep = ",")
#simulado
sim <- read.csv("Goiania-reanalise.csv", header = T, skip = 0, sep = ",")
library(hydroGOF)
pbias(sim$Prec, obs$Prec, na.rm=TRUE)
The following error appears:
Error in pbias.default(yes$Prec, Obs$Prec, na.rm = TRUE) : Invalid argument type: 'yes' & 'Obs' have to be of class: c('integer', 'Numeric', 'ts', 'zoo')
Follow sample of my data
> dput(head(obs,100))
structure(list(Data = c("1/1/1990", "1/2/1990", "1/3/1990", "1/4/1990",
"1/5/1990", "1/6/1990", "1/7/1990", "1/8/1990", "1/9/1990", "1/10/1990",
"1/11/1990", "1/12/1990", "1/13/1990", "1/14/1990", "1/15/1990",
"1/16/1990", "1/17/1990", "1/18/1990", "1/19/1990", "1/20/1990",
"1/21/1990", "1/22/1990", "1/23/1990", "1/24/1990", "1/25/1990",
"1/26/1990", "1/27/1990", "1/28/1990", "1/29/1990", "1/30/1990",
"1/31/1990", "2/1/1990", "2/2/1990", "2/3/1990", "2/4/1990",
"2/5/1990", "2/6/1990", "2/7/1990", "2/8/1990", "2/9/1990", "2/10/1990",
"2/11/1990", "2/12/1990", "2/13/1990", "2/14/1990", "2/15/1990",
"2/16/1990", "2/17/1990", "2/18/1990", "2/19/1990", "2/20/1990",
"2/21/1990", "2/22/1990", "2/23/1990", "2/24/1990", "2/25/1990",
"2/26/1990", "2/27/1990", "2/28/1990", "3/1/1990", "3/2/1990",
"3/3/1990", "3/4/1990", "3/5/1990", "3/6/1990", "3/7/1990", "3/8/1990",
"3/9/1990", "3/10/1990", "3/11/1990", "3/12/1990", "3/13/1990",
"3/14/1990", "3/15/1990", "3/16/1990", "3/17/1990", "3/18/1990",
"3/19/1990", "3/20/1990", "3/21/1990", "3/22/1990", "3/23/1990",
"3/24/1990", "3/25/1990", "3/26/1990", "3/27/1990", "3/28/1990",
"3/29/1990", "3/30/1990", "3/31/1990", "4/1/1990", "4/2/1990",
"4/3/1990", "4/4/1990", "4/5/1990", "4/6/1990", "4/7/1990", "4/8/1990",
"4/9/1990", "4/10/1990"), Prec = c("8.9", "32.7", "0.3", "3.9",
"8.8", "29.2", "2.5", "0.6", "27.7", "11.2", "9.8", "0", "6.6",
"0", "0", "0", "0", "0", "5.5", "0", "0", "0", "0", "6.2", "0",
"0", "19.4", "15.1", "0.9", "16.4", "0", "0", "0", "0", "0",
"0", "0", "0.1", "10.1", "0.1", "0.2", "1.3", "2.4", "2.6", "0",
"0", "4.8", "0", "0.6", "7.1", "4.1", "0", "5", "0", "2.3", "6.3",
"9.1", "25.7", "8.3", "24", "1.2", "0", "0", "0", "0", "19.8",
"5.5", "0", "0", "0", "0.2", "0", "2.8", "6.9", "51.6", "41.6",
"58.9", "0.2", "0", "22.1", "0", "0", "2.3", "0", "2.2", "10.6",
"0", "0", "0", "0", "0", "0.3", "0", "4", "0", "0.2", "0", "13.7",
"0.7", "44.6")), row.names = c(NA, 100L), class = "data.frame")
> dput(head(sim,100))
structure(list(Data = c("1/1/1990", "1/2/1990", "1/3/1990", "1/4/1990",
"1/5/1990", "1/6/1990", "1/7/1990", "1/8/1990", "1/9/1990", "1/10/1990",
"1/11/1990", "1/12/1990", "1/13/1990", "1/14/1990", "1/15/1990",
"1/16/1990", "1/17/1990", "1/18/1990", "1/19/1990", "1/20/1990",
"1/21/1990", "1/22/1990", "1/23/1990", "1/24/1990", "1/25/1990",
"1/26/1990", "1/27/1990", "1/28/1990", "1/29/1990", "1/30/1990",
"1/31/1990", "2/1/1990", "2/2/1990", "2/3/1990", "2/4/1990",
"2/5/1990", "2/6/1990", "2/7/1990", "2/8/1990", "2/9/1990", "2/10/1990",
"2/11/1990", "2/12/1990", "2/13/1990", "2/14/1990", "2/15/1990",
"2/16/1990", "2/17/1990", "2/18/1990", "2/19/1990", "2/20/1990",
"2/21/1990", "2/22/1990", "2/23/1990", "2/24/1990", "2/25/1990",
"2/26/1990", "2/27/1990", "2/28/1990", "3/1/1990", "3/2/1990",
"3/3/1990", "3/4/1990", "3/5/1990", "3/6/1990", "3/7/1990", "3/8/1990",
"3/9/1990", "3/10/1990", "3/11/1990", "3/12/1990", "3/13/1990",
"3/14/1990", "3/15/1990", "3/16/1990", "3/17/1990", "3/18/1990",
"3/19/1990", "3/20/1990", "3/21/1990", "3/22/1990", "3/23/1990",
"3/24/1990", "3/25/1990", "3/26/1990", "3/27/1990", "3/28/1990",
"3/29/1990", "3/30/1990", "3/31/1990", "4/1/1990", "4/2/1990",
"4/3/1990", "4/4/1990", "4/5/1990", "4/6/1990", "4/7/1990", "4/8/1990",
"4/9/1990", "4/10/1990"), Prec = c(8.6, 4.9, 1.4, 6.5, 22.7,
11.7, 1, 9.5, 4.7, 7.1, 3.6, 0.7, 1.2, 0.4, 0, 0, 0.1, 1.6, 0.5,
0, 0, 0, 0.4, 0.7, 0.4, 0, 1.3, 1.1, 3.4, 1.7, 0.7, 0.2, 0.3,
0.2, 0, 0, 0.1, 1.1, 9.1, 3.3, 0.7, 2.4, 18.1, 6.6, 16, 8.1,
3.8, 5.2, 3, 3.7, 5.3, 14.4, 5.1, 5.2, 5, 4, 12.5, 12.4, 5.9,
12.1, 0.6, 0.1, 0, 0, 0.3, 4.4, 8.7, 0.6, 0, 0, 0, 0.1, 0.2,
4.4, 0.8, 5.5, 37.7, 9.9, 0.5, 5.5, 2.8, 3, 6.5, 4.7, 1, 13.3,
13, 0.7, 0.1, 0, 1.7, 2.3, 10.7, 3.9, 7, 4.4, 9.1, 6.3, 2, 4.3
)), row.names = c(NA, 100L), class = "data.frame")
Any suggestions?
Thanks Marcus! I didn’t know this str command and only now I could notice the color difference when it is numeric or characters. Thanks!
– Bruna
str
is a very useful function! Use whenever I read a new data set to check if everything went well in the import.– Marcus Nunes
I’ll do the same thing from today Marcus!
– Bruna