similar to: Bug on sample (PR#219)

Displaying 20 results from an estimated 10000 matches similar to: "Bug on sample (PR#219)"

2000 Feb 14
1
Problem with expression evaluation depth (PR#436)
Full_Name: Jose M. Perez Version: 0.99.0a OS: Linux - 2.0.38 Submission from: (NULL) (159.90.200.68) Hi, I'm having problems with the check of infinite recursion in the expression evaluation depth. The problem appears in a program with no recursions whatsoever. The layout of my program is a series of routines called by a big loop. I printed out depthsave in src/main/eval.c and it appears
2000 Feb 16
0
Fwd: Re: Problem with expression evaluation depth (PR#436)
Jose Miguel Perez <jperez@cesma.usb.ve> writes: > I think I found the root of the problem. > My program throws out some cycles of the loop > using 'next'. > The following code shows the behavior of R_EvalDepth in these cases: > without next: > > for (i in 1:10 ) {} > 0 > 1 > 2 > 2 > 1 > 1 > 1 > 1 > 1 > 1 > 1 > > with next:
2006 Dec 30
2
Error: cannot take a sample larger than the population
Hi, In Splus7 this statement xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 )) worked fine, but in R the interpreter reports that the length of the vector to chose c(0,1,2) is shorter than the size of many times I want to be selected from the vector c(0,1,2). Any good reason? See below the error. > xlrmN1 <- sample(c(0,1,2),400 ,prob=c(0.02 ,0.93 ,0.05 )) Error in
2010 Feb 18
2
error in using sample( )
Hi, I am using the command >sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)) and I have this error notification "Error in sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)): unused argument(s)(1,prob=c(0.2,0.3,0.5)) I don't know what is going wrong. Please give me some suggestions. Thank you Best, Jing
2002 Mar 08
2
? about sample
i am trying to use the sample command and have one question about it: i am getting the error Error in sample(length(x), size, replace, prob) : insufficient positive probabilities when i use something like: sample (1:4, prob=c(0,0,1,0))[1] i was expecting that to return a 3 every time while this is not exactly what i am using it for, i need the capabilities to deal with zeros (as the
2010 Jun 20
1
proposed change to 'sample'
There is a weakness in the 'sample' function that is highlighted in the help file. The 'x' argument can be either the vector from which to sample, or the maximum value of the sequence from which to sample. This can be ambiguous if the length of 'x' is one. I propose adding an argument that allows the user (programmer) to avoid that ambiguity: function (x, size, replace
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
When `length( skewed.probs ) > 200' uniform samples are generated in R-devel. R-3.5.1 behaves as expected. `epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced. Chuck > set.seed(123) > > epsilon <- 1e-10 > > ## uniform to 200 then small > p200 <- prop.table( rep( c(1, epsilon), c(200, 999-200))) > ## uniform to 201
2005 Mar 11
5
sample function
Hi everyone, I need help. I want to have a "uniform" kind distribution. When I used sample function I got almost twice many zeros compared to other numbers. What's wrong with my command ? temp <-sample(0:12, 2000, replace=T,prob=(rep(1/13,13))) hist(temp) Thanks in advance, Taka,
2005 Jun 21
2
efficiency of sample() with prob.
Dear list, A while ago, Vadim asked opinions on improving efficiency of sample() with prob, e.g. sample with replacement with weight. ( https://stat.ethz.ch/pipermail/r-devel/2004-September/030844.html ) He did not post what he ended up with this problem though. I am having exactly the same problem. I need to sample with replacement from a population of size 10 million with fitness values for
2012 Jul 20
1
conditional subset and reorder dataframe rows
Hi List I have a dataframe (~1,200,000 rows deep) and I'd like to conditionally reorder groups of rows in this dataframe. I would like to reorder any rows where the Chr.Strand column contains a '-' but reorder within subsets delineated by the Probe.Set.Name column. # toy example #### library(plyr) negStrandGene <- data.frame(Probe.Set.Name =
2012 Oct 06
2
sample
Hello If I have x=c(3,2,6,1) and n=length(x), are the following codes equivalent?? sample(x,1,replace=TRUE)    and       sample(x,1,replace=TRUE,prob=rep(1/n , n) ) Regards [[alternative HTML version deleted]]
2010 Feb 19
1
sample on data.frame
Currently, sample of a data.frame is a sample of the columns: e.g. sample(data.frame(a=1,b=2:3,c=4),2) => data.frame(b=2:3,c=c(4,4)) I'd have thought it would be much more common to want a sample of the rows. It's easy enough to define an appropriate function for this: sample.data.frame <- function(x,size,replace=FALSE,prob=NULL) # no auto-dispatch; sample is not a generic
2001 Oct 09
1
sample() help
The documentation for sample() describes the optional "prob" argument as "A vector of probabilities of obtaining the elements of the vector being sampled". Both run time behavior and source code (routine FixupProb) suggest that "prob" can be a vector of non-negative, relative weights (i.e. not necessarily normalized). Should the help be updated to reflect this?
2013 May 23
1
sample(c(0, 1)...) vs. rbinom
Greetings.? My wife is teaching an introductory stat class at UC Davis.? The class emphasizes the use of simulations, rather than mathematics, to get insight into statistics, and R is the mandated tool.?? A student in the class recently inquired about different approaches to sampling from a binomial distribution.? I've appended some code that exhibits the idea, the gist of which is that using
2003 Feb 13
2
error from sample if sampling length one character (PR#2546)
Full_Name: Patrick Burns Version: 1.6.1 OS: Suse Linux Submission from: (NULL) (217.36.14.68) Sample gives an error if it is sampling a length one character vector: > sample('a', 1) Error in sample(x, size, replace, prob) : invalid first argument The fix is trivial (numeric test in first line of the body): function (x, size, replace = FALSE, prob = NULL) { if (length(x) == 1
2005 Feb 10
5
sample
I am trying to sample a subset from a matrix using sample. The size of the matrix is 20X 1532. It works fine with this, but when I transpose the matrix and try to sample it, it returns null. pick.set<-sample(tissue.exp.t,5,replace=FALSE,prob=NULL) Is there something that I am missing here ? Thanks ../Murli
2008 Aug 25
2
Using sample() with a data frame ?
I have a data frame (daf1), that holds +80000 records, and 10 variables (i.e. 10 columns and some 80000 rows) > length(daf1) [1] 10 > length(daf1[,1]) [1] 83805 I would like to sample() e.g. 10000 records from this. I use: > daf2 <- sample(daf1, 1000, replace = FALSE, prob = NULL) Error in `[.data.frame`(x, .Internal(sample(length(x), size, replace, : cannot take a sample larger
2010 Aug 16
2
Random Number Generators and Sample
I am trying to get documentation about the random number generator used in "sample". The help for sample does not mention it. Can anyone point me in the right direction. Thanks [[alternative HTML version deleted]]
2011 Jul 05
2
sample function with different proportions
Hi there, I guess this is an easy one, but still:  I would like to randomly sample 0s and 1s but in a way that I end up having for example 70% of 1s and the rest of 0s and not 50:50 as this function does: sample(c(0,1), 100, replace = TRUE) Any recommendations? Many thanks! Ana [[alternative HTML version deleted]]
2000 Sep 20
1
SV: sample from contingency table
I have had the same problem and I wrote this function rmulti <- function(n, size, p) { NrDim <- length(p) if(NrDim<2) stop("The simulated variabel has to be at least 2-dimensional") res <- matrix(data=NA, nrow=n, ncol=NrDim) p <- p/sum(p) TempSize <- size for(i in 1:NrDim) { TempP <- p[i]/sum(p[i:NrDim]) TempBin <- rbinom(n=n, size=TempSize,