Hi,
I guess it is because when you have the FALSE option the sample function
take off the number from the whole population so your data_frame becomes
different in length. If you try with the option TRUE it works (of course)
but then you have the possibility that you sample the same row twice. Hope
On 12-10-04 6:06 AM, Gian Maria Niccolò Benucci wrote:
Hi again to everybody,
I incountered the following error when I try to make a sample inside a
dataset.
My code is:
data_ostrya <- sample(ostrya,200, replace=F)
Error in `[.data.frame`(x, .Internal(sample(length(x), size, replace, :
ca
Hello,
If the dataset 'data_ostrya' is kept in a data.frame, then
length(data_ostrya) is equal to the number of columns, not the number of
rows. This is because a data.frame is a special type of list and
length(some_list) is the number of its elements (obvious). if you want
to sample rows, try
Hi again to everybody,
I incountered the following error when I try to make a sample inside a
dataset.
My code is:
> data_ostrya <- sample(ostrya,200, replace=F)
Error in `[.data.frame`(x, .Internal(sample(length(x), size, replace, :
cannot take a sample larger than the population when 'replac
On 12-09-13 7:18 AM, Gian Maria Niccolò Benucci wrote:
Thank you very much for your help,
I was wondering if is possible to sample randomly specifying to select in a
particular group of data inside the matrix, for example only within the
whole samples collected in 2011 I would randomly choose 20
Thank you very much for your help,
I was wondering if is possible to sample randomly specifying to select in a
particular group of data inside the matrix, for example only within the
whole samples collected in 2011 I would randomly choose 20 random samples...
Thanks a again,
Gian
On 13 Septemb
On 13-09-2012, at 10:42, Gian Maria Niccolò Benucci wrote:
> Hi all,
>
> I am wondering if do exist a function in R that allow me to sample or
> choose randomly the rows (i.e., samples) inside a given matrix.
Use sample.
Like this for example
A <- matrix(runif(8*4), nrow=8)
A
select.row <- sa
7 matches
Mail list logo