Hi Rui, how are you?
I want to thank you for your assistance again.
I'm sorry, but the code that you provided for me did not work this time.
The code and the warning message are both below:
NSErr <- t(matrix(NSEr)) # which is a 1x1000 double matrix
Vsim[] <- Vsim[ , NSErr > 0.6]
Warning message:
In Vsim[] <- Vsim[, NSErr > 0.6] :
number of items to replace is not a multiple of replacement length
Thanks again.
Irucka
<-----Original Message----->
From: Rui Barradas [ruipbarradas at sapo.pt]
Sent: 11/19/2012 10:35:00 AM
To: iruckaE at mail2world.com
Cc: r-help at r-project.org
Subject: Re: [R] help on matrix column removal based on another matrix
Sorry, the comma is in the wrong place, it should be
Vsim[] <- Vsim[ , NSErr > 0.6]
Rui Barradas
Em 19-11-2012 16:18, Rui Barradas escreveu:
Hello,
Try
Vsim[] <- Vsim[NSErr > 0.6, ]
Hope this helps,
Rui Barradas
Em 19-11-2012 14:30, iembry escreveu:
Hi everyone, now I am trying to finish writing the code (I had asked
assistance on subtracting arrays)
This is what I what I am running in R:
source("/home/ie/Documents/TTU/GA_Research/GLUE/R-Project/R_GLUE_Exampl
NSEr <- function (obs, sim)
{
{jjh <- (as.vector(obs) - sim)^2
Xjjhs <- apply(Xjjh, 2, sum)
Yii <- (obs - mean(obs))^2
Yiis <- apply(Yii, 2, sum)
NSEr <- 1 - (Xjjhs/Yiis)
}
NSEr}
Vsim <- read.csv("1000Samples_Vsim.csv", header = TRUE, sep =",")
Vsim <- as.matrix(Vsim[,-1]) # remove column 1 from analysis
Vobs <- read.csv("Observed_Flow.csv", header = TRUE, sep =",")
Vobs <- as.matrix(Vobs[,-1]) # remove column 1 from analysis
NSEr <- NSEr(Vobs,Vsim);
write.table(NSEr, "NSEr.csv", sep =",")
NSErr <- t(matrix(NSEr))
## select the behavioural simulations and discard the rest
Vsim <- Vsim[NSErr > 0.6]
write.table(Vsim, "Vsim.csv", sep =",")
**Vsim becomes numeric[42016] rather than a double matrix of
What is the proper way to remove the columns in Vsim where the NSEr
for that
column is less than 0.6? I am trying to make Vsim a double matrix of
101x416.
Thank-you again.
Below is the rest of the code in R:
## normalise Qsim and compute the quantiles
NSEr <- NSEr[NSEr > 0.6]
write.table(NSEr, "NSEr_great_0.6.csv", sep =",")
NSEr <- NSEr - 0.6
write.table(NSEr, "NSEr_minus0.6.csv", sep =",")
NSEr <- NSEr/sum(NSEr)
write.table(NSEr, "NSEr_normalized.csv", sep =",")
#NSEr = sum(NSEr)
limits <- apply(Vsim, 1, "wtd.quantile", weights = NSEr, probs =
c(0.05,0.95), normwt=F)
--
View this message in context:
other-matrix-results-tp4650043.html
Sent from the R help mailing list archive at Nabble.com.