ker.
Best Wishes,
Ben W.
UEA (ENV) and The Sainsbury Laboratory.
From: Jean V Adams [jvad...@usgs.gov]
Sent: 27 November 2012 22:01
To: Benjamin Ward (ENV)
Cc: r-help@r-project.org
Subject: Re: [R] Stuck trying to modify a function
Ben,
You can use the
Ben,
You can use the sample() function to randomly add -1, 0, or 1 to each
observation, and control for the probability of mutation at the same time.
Then you can use the match() function to make sure that any mutations in
X are carried through to Y in the same way. I wrote the function to do
Le mardi 27 novembre 2012 à 16:45 +, Benjamin Ward (ENV) a écrit :
> Hi,
>
> I have the following data:
>
> Path_Number <- 5
> ID.Path <- c(1:Path_Number) # Make vector of ID's.
> No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) #
> X <- split(sample(1:1, sum(No_of_X), replace=TRU
Hi,
I have the following data:
Path_Number <- 5
ID.Path <- c(1:Path_Number) # Make vector of ID's.
No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) #
X <- split(sample(1:1, sum(No_of_X), replace=TRUE), rep(ID.Path, No_of_X))
Y <- lapply(X,function(x) sample(x, round(runif(1, min=10, m
4 matches
Mail list logo