similar to: error from sample if sampling length one character (PR#2546)

Displaying 20 results from an estimated 30000 matches similar to: "error from sample if sampling length one character (PR#2546)"

2003 Feb 25
1
sample (PR#2546)
There is rumour that some of my mail didn't go where it should have because I don't know how to work email. It was suggested that I summarize here. The issue is with sample when the first argument is length 1. Current behaviour is: > sample('a', 1) Error in sample(x, size, replace, prob) : invalid first argument > sample(3+0i, 1) Error in x >= 1 : illegal comparison
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
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
2008 Feb 07
0
Sampling with unequal probabilities
This is in followup to a thread on R-help with subject "Sampling". I claim that R does the wrong thing by default when sampling with unequal probabilities without replacement - the selection probabilities are not proportional to 'prob', for any draw after the first: I suggest that R do what S-PLUS now does (though you're free to choose a better implementation). What S-PLUS
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
2015 Sep 09
0
sample.int() algorithms
I was experiencing a strange pattern of slowdowns when using sample.int(), where sampling from a one population would sometimes take 1000x longer than taking the same number of samples from a slightly larger population. For my application, this resulted in a runtime of several hours rather than a few seconds. Looking into it, I saw that sample.int() is hardcoded to switch algorithms when the
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
2006 Aug 04
2
Sampling from a Matrix
Hello all, Consider the following problem: There is a matrix of probabilities: > set.seed(1) > probs <- array(abs(rnorm(25, sd = 0.33)), dim = c(5,5), dimnames = list(1:5, letters[1:5])) > probs a b c d e 1 0.21 0.27 0.50 0.0148 0.303 2 0.06 0.16 0.13 0.0053 0.258 3 0.28 0.24 0.21 0.3115 0.025 4 0.53 0.19 0.73 0.2710 0.656 5 0.11 0.10 0.37 0.1960
1999 Jul 07
1
Bug on sample (PR#219)
Full_Name: Jose M. Perez Version: 0.64.2 OS: Linux/x86 Submission from: (NULL) (159.90.200.68) sample(1,1,prob=c(1)) Causes a core dump. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the
2015 Jun 17
2
Add-on argument in sample()
On 6/16/2015 1:32 PM, Peter Meissner wrote: > Am .06.2015, 14:55 Uhr, schrieb Millot Gael <Gael.Millot at curie.fr>: > >> Hi. >> >> I have a problem with the default behavior of sample(), which performs >> sample(1:x) when x is a single value. >> This behavior is well explained in ?sample. >> However, this behavior is annoying when the number of
2012 Jun 14
1
Question about sampling
Dear list I wish to extract from a population genotypized for 10 SNP a subsample of the same population of size n with similar allele frequencies. Essentially i have a matrix of 200 rows (df) like this Name,Condition,rs1385699_X,rs6625163_X,rs962458_X,Rs4658627_1, sample01,Case,1,1,1,-1 sample02,Control,1,1,1,1 sample06,Control,1,-1,1,0 sample10,Case,1,1,1,0 sample11,Control,1,1,1,1
2010 Jul 22
1
svydesign syntax
This message is for those familiar with the survey package. I need to fit a weighted Cox model to accommodate the sampling weights as I have a case-control study with controls sampled at random from a database in a ratio 2:1 to cases (whom were all sampled). I want to make sure I am using the right svydesign syntax to specify this sampling design. Can anyone please check if the statement below is
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
2008 Jul 17
2
Sampling distribution (PDF & CDF) of correlation
Hi all, I'm looking for an analytic method to obtain the PDF & CDF of the sampling distribution of a given correlation (rho) at a given sample size (N). I've attached code describing a monte carlo method of achieving this, and while it is relatively fast, an analytic solution would obviously be optimal. get.cors <- function(i, x, y, N){ end=i*N
2008 Jan 10
0
prob package: elementary probability on finite sample spaces
Dear R Community, I am pleased to announce the beta-release of the prob package. The source code is now on CRAN, and binaries should be generated there before long. In the meantime, you can get it with install.packages("prob", repos = "http://r-forge.r-project.org") The prob package gives a framework for doing elementary probability on finite sample spaces in R. The
2008 Jan 10
0
prob package: elementary probability on finite sample spaces
Dear R Community, I am pleased to announce the beta-release of the prob package. The source code is now on CRAN, and binaries should be generated there before long. In the meantime, you can get it with install.packages("prob", repos = "http://r-forge.r-project.org") The prob package gives a framework for doing elementary probability on finite sample spaces in R. The
2009 Mar 24
2
Random sampling based on the observations
Hello!I am having a problem with Random sampling in R. I have used a syntax: mydata.sub=sample(mydata,7,replace=FALSE,prob=NULL) which allows me to choose a random sample based on the variables(correct me if I am wrong!). Suppose I have 10 variable and if I use the above mentioned command then it will choose 7 variables out of the 10 randomly. My problem is that I want to have a random sample
2011 Sep 03
1
Loop with random sampling and write.table
Hi! I need to perform this simple sampling function several hundred times: x1=as.character(rnorm(1000, 100, 15)) x2=as.character(rnorm(1000, 150, 10)) y1=as.data.frame(x1,x2) sample1=as.data.frame(sample(y1$x1, 12, replace = FALSE, prob = NULL)) sample1 write.table(sample1, "sample1.txt", sep=" ",row.names=F,quote=F) My knowledge of loops is quite low. How can I produce 100
2011 Oct 08
2
Permutation or Bootstrap to obtain p-value for one sample
Hi, I am having trouble understanding how to approach a simulation: I have a sample of n=250 from a population of N=2,000 individuals, and I would like to use either permutation test or bootstrap to test whether this particular sample is significantly different from the values of any other random samples of the same population. I thought I needed to take random samples (but I am not sure how
2009 Jul 01
0
probit with sample selection error?
Deal all: i want to do the probit with sample selection estimation, the following is my code: probit with sample selection can be done by stata :heckprob The heckprobll is the likelihood function shown in W.H. Greene 5th p714 ¡´ The question is the convergence is very slow compare with Stata using likellihood only. ¡´ Second i did the similar way in matlab using fminsearch , the estimated