[R] plot methods in sp

2006-12-30 Thread Patrick Giraudoux
Dear listers, I am working since a while with the sp package and still wonder how the plot methods are managed with sp spatial objects. For instance, SpatialPolygonsDataFrame objects have obviously a plot method. However it cannot be found in the list provided by methods(plot) . Furthermore

[R] Error: cannot take a sample larger than the population

2006-12-30 Thread Aldi Kraja
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

Re: [R] Why giving negative density when doing kernel density estimate?

2006-12-30 Thread Prof Brian Ripley
This is called 'rounding error', and has been discussed here previously. If it matters to you (why?) use pmax(0, kde$y). When doing numerical calculations you should always be aware that the numerical results will differ from algebraic ones, and that is all that is happening here. On Sat, 30

Re: [R] Evaluating Entire Matlab code at a time

2006-12-30 Thread Bhanu Kalyan.K
Dear Mr. Bengtsson, I worked on the code you sent. But, I dont think it is responding either. Kindly verify. evaluate(matlab, pwd=cd();); Sending expression on the Matlab server to be evaluated...: 'pwd=cd();' Received an 'MatlabException' reply (-1) from the Matlab server: 'Error: Expected

Re: [R] Evaluating Entire Matlab code at a time

2006-12-30 Thread Henrik Bengtsson
This is very odd, but maybe 'cd' is not a command on your Windows Matlab installation. I tried the same code on a Unix installation (I don't have access to Matlab for Windows but others have been using R.matlab there successfully). Find out what the command for getting the current directory in

Re: [R] Error: cannot take a sample larger than the population

2006-12-30 Thread Chuck Cleland
Aldi Kraja wrote: 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

Re: [R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-30 Thread Uwe Ligges
Talbot Katz wrote: Hi Uwe. Thank you so much for responding! I guess I wasn't entirely clear about the problem. If I make the mistake of trying to install a package from CRAN in a second session after I've already installed it in a previous session, it won't install in the second

Re: [R] Survfit with a coxph object

2006-12-30 Thread Frank E Harrell Jr
sj wrote: I am fitting a coxph model on a large dataset (approx 100,000 patients), and then trying to estimate the survival curves for several new patients based on the coxph object using survfit. When I run coxph I get the coxph object back fairly quickly however when I try to run survfit

[R] Crosstab from sql dump

2006-12-30 Thread Alan Gibson
Hello all,, Im looking for a simple function to produce a crosstab from a dumped sql query result. Its very hard to produce crosstabs with most databases (Access being the exception), so with the vast array of R packages, Im sure this has to have already been implemented somewhere. Examples are

Re: [R] wrapping mle()

2006-12-30 Thread Sebastian P. Luque
On Sat, 30 Dec 2006 07:41:48 + (GMT), Prof Brian Ripley [EMAIL PROTECTED] wrote: [...] You need to set the environment of ll to that containing your data objects. This would happen automatically if you defined ll in the function fit.mle. A brutal solution would be fit.mle -

Re: [R] Error: cannot take a sample larger than the population

2006-12-30 Thread Aldi Kraja
Partial Summary and discussion: = Thank you to Chao Gai, Chuck Cleland, and Jim Lemon for their suggestion to use replace=T in R. There is a problem though (see below) In the Splus7, sample is defined as - sample(x, size = n, replace = F, prob = NULL, n = NULL,

Re: [R] Crosstab from sql dump

2006-12-30 Thread Dieter Menne
Alan Gibson alan.gibson at gmail.com writes: Im looking for a simple function to produce a crosstab from a dumped sql query result. xtabs in stats is a simple solution, but package reshape is much more flexible and comes with a good introduction.pdf. Dieter

Re: [R] Error: cannot take a sample larger than the population

2006-12-30 Thread chao gai
Aldi, Your concept of sample is different from mine. I would expect with replacement to be equivalent for a for loop of sampling without replacement. samples - 1:400 for (i in 1:400) samples[i] - sample(c(0,1,2),1 ,prob=c(0.02 ,0.93 ,0.05 )) Sampling without replacement: first :

Re: [R] Why giving negative density when doing kernel density estimate?

2006-12-30 Thread 李俊杰
If it matters to you (why?) use pmax(0, kde$y). Actually, it bothers me because I need sufficient precision of numerical calculation in this case, where the density estimate is around zero. To illustrate why I concern about it, I'd like to introduce the problem I am working with. The problem is

Re: [R] Error: cannot take a sample larger than the population

2006-12-30 Thread Chuck Cleland
Aldi Kraja wrote: Partial Summary and discussion: = Thank you to Chao Gai, Chuck Cleland, and Jim Lemon for their suggestion to use replace=T in R. There is a problem though (see below) In the Splus7, sample is defined as - sample(x, size = n, replace =

Re: [R] wrapping mle()

2006-12-30 Thread Luke Tierney
It is much cleaner to do this sort of thing with lexical scope. For example, mkll - function(x, y) { function(ymax=15, xhalf=6) { -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE)) } } creates a log-likelihood likelyhood function for data x,y that can

Re: [R] wrapping mle()

2006-12-30 Thread Sebastian P. Luque
On Sat, 30 Dec 2006 15:46:01 -0600 (CST), Luke Tierney [EMAIL PROTECTED] wrote: It is much cleaner to do this sort of thing with lexical scope. For example, mkll - function(x, y) { function(ymax=15, xhalf=6) { -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE))

[R] getting a new factor

2006-12-30 Thread Ricardo Rodríguez
Hi all, Given a data frame as... head(veg) genus species trophia type geo zone importance 1 Sphagnum subsecundum MA En100 2 Sphagnum denticulatum MA En200 3 Molinia caerulea MA En300 4 Sphagnumflexuosum

Re: [R] OT: any recommendation for scripting language

2006-12-30 Thread Wensui Liu
Dear Experts, Thank you so much for your opinions. I probably will go with python. Following your suggestion, I started reading some tutorials but have a quick question. In the sense of statistical computing, is there anything that can be easily done with python but not with SAS/R? Could you

Re: [R] getting a new factor

2006-12-30 Thread Richard M. Heiberger
tmp - data.frame(G=factor(letters[c(1,2,3,1,2,3)]), + S=factor(LETTERS[c(1,1,1,2,2,2)])) tmp G S 1 a A 2 b A 3 c A 4 a B 5 b B 6 c B tmp$G.S - with(tmp, interaction(G, S)) tmp G S G.S 1 a A a.A 2 b A b.A 3 c A c.A 4 a B a.B 5 b B b.B 6 c B c.B

Re: [R] Crosstab from sql dump

2006-12-30 Thread Alan Gibson
thanks for all the tips. using 'unstack(read.table('/tmp/codes', header=TRUE))' gets me user1 user2 1 100 100 2 200 200 3 300 300 where /tmp/codes contains code name 100 user1 200 user1 300 user1 100 user2 200 user2 300 user2 so unstack is exactly what i was looking for. for the

Re: [R] OT: any recommendation for scripting language

2006-12-30 Thread BBands
On 12/30/06, Wensui Liu [EMAIL PROTECTED] wrote: Dear Experts, Thank you so much for your opinions. I probably will go with python. Following your suggestion, I started reading some tutorials but have a quick question. In the sense of statistical computing, is there anything that can be

Re: [R] wrapping mle()

2006-12-30 Thread Gabor Grothendieck
That has two disadvantages: (1) it only works if the user is defining ll himself; however, if the user is getting ll from somewhere else then its not applicable since the user no longer controls its scope whereas resetting the environment method still works (2) its cleaner for the developer but

Re: [R] OT: any recommendation for scripting language

2006-12-30 Thread Gabor Grothendieck
Its easier to write command line filters using perl/python/gawk than R. Its possible in R but awkward as there is no good way (platform independent,easy to use) of referring to stdin data. Something as simple as gawk 1 which just copies its input to its output is pretty awkward in R. What R

[R] rimage package broken with fedora upgrade

2006-12-30 Thread John Kornak
Dear R list members I would be grateful if anyone could guide me to a solution for fixing my rimage package problem described below. I recently upgraded my machine from fedora core 3 to fedora core 6 and then upgraded R from version 2.3.1 from version 2.4.1. I then fired up R, tried to load

Re: [R] getting a new factor

2006-12-30 Thread Manuel Morales
On Sun, 2006-12-31 at 00:25 +0100, Ricardo Rodríguez wrote: Hi all, Given a data frame as... head(veg) genus species trophia type geo zone importance 1 Sphagnum subsecundum MA En100 2 Sphagnum denticulatum MA En200 3 Molinia

Re: [R] importing bitmap images to R

2006-12-30 Thread Oleg Sklyar
http://bioconductor.org/packages/2.0/bioc/html/EBImage.html This will read/write about 95 image formats into R, all those supported by ImageMagick and provide many image processing filters. If Windows is your platform, this version will work on Windows as well (the version release in Bioconductor

Re: [R] rimage package broken with fedora upgrade

2006-12-30 Thread Oleg Sklyar
Cannot help you much with that as the thing seems to compile normally. As you use a global R installation, try giving yourself write permissions in /usr/lib/R/library, this might help. Otherwise, try installing R from source in your home or elsewhere where you have all write permissions and check

[R] Genotype importing from Sequenom

2006-12-30 Thread Farrel Buchinsky
Sequenom has an odd format of calling a SNP genotype gg [1] C GA A C C AG C C T G homozygous A is called A and heterozygous is called AT The genetics package cannot handle the fact that some genotypes are declared with 2 letter while other are declared with only 1. Consequently the

Re: [R] Genotype importing from Sequenom

2006-12-30 Thread Jim Lemon
Farrel Buchinsky wrote: Sequenom has an odd format of calling a SNP genotype gg [1] C GA A C C AG C C T G homozygous A is called A and heterozygous is called AT The genetics package cannot handle the fact that some genotypes are declared with 2 letter while other are declared

Re: [R] Genotype importing from Sequenom

2006-12-30 Thread Farrel Buchinsky
Thanks. I stumbled upon another way that is quite similar. I like it since I can manipulate the entire vector in the same way. RawSeqG-paste(RawSeq$GENOTYPE_ID,RawSeq$GENOTYPE_ID,sep=) #this duplicates heterozygotes to become ATAT or CGCG which makes no sense, so now we use substr

[R] Does SQL group by have a heavy duty equivalent in R

2006-12-30 Thread Farrel Buchinsky
I have hundreds of humans who have undergone SNP genotyping at hundreds of loci. Some have even undergone the procedure twice or thrice (kind of an internal control). So obviously I need to find those replications, and confirm that the results are the same. If there is discordance then I need to