I forgot to add that if you have less than 16GB of memory, then you
were probably paging memory to disk and that would have take a much,
much, longer time. When you are trying to do something BIG, do it in
some smaller steps and look at the resources that it takes (memory,
cpu, ...).
Jim Holtman
Do you realize you are trying to create a vector with 1 billion
entries, so this will take some time. How much memory do you have on
your computer?
Here are some times to generate increasing sample sizes. I have 16GB
on my computer and it took only 30 seconds to generate the data and
used almost
When I ran this code:
"
x<-sample(1:5,10,TRUE,c(0.1,0.2,0.4,0.2,0.1))
print(table(x)/10)
plot(table(x)/10,type="h",xlab="x",ylab="P(x)")
"
My laptop was frozen and didn't respond. Although I used ctrl+alt+del to
terminate r program, my laptop still did nothing. And I must re
1. If you create a variable x or w or dummy, it is stored in the current
environment. You can refer to it by the name x or w or dummy. If you create a
column x in the data frame dummy, you can refer to it as dummy$x or
dummy[["x"]]. That is a different x than the variable x in your current
envi
Hi Stephen,
See in line.
On Fri, May 30, 2014 at 4:18 PM, Stephen Meskin wrote:
> Greg, Ista, (or anyone else),
> Let me take one last run at this problem.
>
> Consider the following extract from the Appendix A text:
>
>> x <- 1:20
>> w <- 1+sqrt(x)/2
>> dummy <- data.frame(x=x, y=x+rnorm(x)*w)
Greg, Ista, (or anyone else),
Let me take one last run at this problem.
Consider the following extract from the Appendix A text:
> > x <- 1:20
> > w <- 1+sqrt(x)/2
> > dummy <- data.frame(x=x, y=x+rnorm(x)*w)
> > fm <- lm(y~x, data=dummy)
> > fm1 <- lm(y~x, data=dummy, weight=1/w^2)
>
> >attach(d
If you pay attention and are careful not to use any variables names
that conflict then you do not need a work around (and the conflicts
function can help you see if there are any conflicts that you may need
to worry about).
Probably the best work around is to use the with or within function
instea
On May 29, 2014 9:45 PM, "Stephen Meskin" wrote:
>
> Thanks Greg for your response. Is there a work around?
A work around for what?
>
> Of course this begs the question as to Why is attach part of the sample
session in App. A of the introductory manual?
Because people find it convenient.
All t
Thanks Greg for your response. Is there a work around?
Of course this begs the question as to Why is attach part of the sample session
in App. A of the introductory manual? All the commands are directly from App.
A. Is it possible the configuration of R on my computer is not in accord with
acce
This is a warning and in your case would not be a problem, but it is
good to think about and the reason why it is suggested that you avoid
using attach and be very careful when you do use attach. What is
happening is that you first created a vector named 'x' in your global
workspace, you then crea
While following the suggestion in the manual "An Introduction to R" to
begin with Appendix A, I ran into the problem shown below about 3/4 of
the way down the 1st page of App. A.
After using the function /attach/, I did not get visible columns in the
data frame as indicated but the rather puzzl
yes you are right it was my inattention it is friday and my head needs
to start the week end sorry;-)
2012/6/8 David Winsemius
>
> On Jun 8, 2012, at 12:33 PM, Guido Leoni wrote:
>
> Dear list
>> Is there a way to extract a random sample without duplicated row from a
>> dataframe ?.
>> a
On Jun 8, 2012, at 12:33 PM, Guido Leoni wrote:
Dear list
Is there a way to extract a random sample without duplicated row
from a
dataframe ?.
a=c(1,2,3,1,1,1,2,1)
b=c(1,2,3,1,2,1,2,1)
c=c(1,1,1,1,1,1,1,1)
d=c(1,2,3,1,1,1,2,1)
prov<-data.frame(a,b,c,d)
prov2<-prov[sample(1:nrow(prov),5,repl
Dear Guido,
Try
prov2<-prov[sample(1:nrow(prov),5,replace=F),]
which corresponds to without replacement sampling.
Best
Ozgur
--
View this message in context:
http://r.789695.n4.nabble.com/Problem-with-sample-function-tp4632835p4632836.html
Sent from the R help mailing list archive at Nabble.
Dear list
Is there a way to extract a random sample without duplicated row from a
dataframe ?.
a=c(1,2,3,1,1,1,2,1)
b=c(1,2,3,1,2,1,2,1)
c=c(1,1,1,1,1,1,1,1)
d=c(1,2,3,1,1,1,2,1)
prov<-data.frame(a,b,c,d)
prov2<-prov[sample(1:nrow(prov),5,replace=T),]
prov2
a b c d
3 3 3 1 3
6 1 1 1 1
On 04/04/2009 6:34 PM, mackas21 wrote:
Hi,
I'm having a problem using sample() within a function.
Basically I get an error reading:
Error in sample(v, 1, prob = h) : non-positive probability
Can anyone advise me as to the possible origin of this error?
Presumably h doesn't contain a vector o
Hi,
I'm having a problem using sample() within a function.
Basically I get an error reading:
Error in sample(v, 1, prob = h) : non-positive probability
Can anyone advise me as to the possible origin of this error?
Here is my code
#Discretised Gillespie algorithm function (From SMfSB, D.J. Wilk
17 matches
Mail list logo