Dear R users,
I am stuck here: My first function returns a vector of 5 values.
In my second function, I want to repeat this, a number of times, say 10
so that I have 10 rows and five columns but I keep on getting errors.
See the code and results below:
optm -function(perm, verbose = FALSE)
{
On 07-06-2013, at 10:59, Laz lmra...@ufl.edu wrote:
Dear R users,
I am stuck here: My first function returns a vector of 5 values.
In my second function, I want to repeat this, a number of times, say 10
so that I have 10 rows and five columns but I keep on getting errors.
See the code
Dear Berend,
For reproducibility,
Rspatswap() is a function which originally returns a single value. For
example Rspatswap(...) and you get 0.8
So, run Rspatswap() 20 times and store all the values.
Then from these 20 values, calculate the calculate average,
sd,se,min,max to get something
Hi,
I am almost getting there, but still have errors. Thanks for your help.
I have tried improving but I get the following errors below:
itn-function(it){
+siml-matrix(NA,ncol=5,nrow=it)
+for(g in 1:it){
+siml[g]-optm(perm=20)[g]
+}
+siml
+}
itn(3)
[,1] [,2] [,3] [,4] [,5]
[1,]
On 07-06-2013, at 11:57, Laz lmra...@ufl.edu wrote:
Dear Berend,
I have made some changes but I still get errors:
For reproducibility,
Rspatswap() is a function which originally returns a single value. For
example Rspatswap(...) and you get 0.8
So, run Rspatswap() 20 times and
Please, please do not use html formatted mail.
It is clearly requested by the mailing list
The code of your last mail is a mess and when replying it becomes even more of
a mess.
I told you to do
siml[g,] - optm(perm=20)
See the comma after g.
and not what you are now doing with
Dear R Users,
I created a function which returns a value every time it's run (A
simplified toy example is attached on this mail).
For example spat(a,b,c,d) # run the first time and it gives you ans1=
10, perm=1 ;
run the second time and gives you ans2= 7, perm=2 etc
I store both the
Is this what you want? I was not clear on your algorithm, but is looks
like you wanted descending values:
testx -
+ function(n, verbose = FALSE)
+ {
+ mat - cbind(optA = sample(n, n, TRUE), perm = seq(n))
+ if (verbose){
+ cat(***starting matrix\n)
+ print(mat)
+ }
+
8 matches
Mail list logo