Hello,
Try removing the square parenthesis from the left hand side,
Vsim <- Vsim[, NSErr > 0.6]
Hope this helps,
Rui Barradas
Em 20-11-2012 04:07, Irucka Embry escreveu:
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 [ruipbarra...@sapo.pt]
Sent: 11/19/2012 10:35:00 AM
To: iruc...@mail2world.com
Cc: r-help@r-project.org
Subject: Re: [R] help on matrix column removal based on another matrix
results
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
for
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
e/NSEr.R")
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
101x416.
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:
http://r.789695.n4.nabble.com/help-on-matrix-column-removal-based-on-an
other-matrix-results-tp4650043.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
.
<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2"
style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com
target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited Email Storage – POP3 – Calendar – SMS – Translator –
Much More!</font></font></span>
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.