RE: [R] Puzzled by write.table function

2004-02-12 Thread Wang, Hui
Hi, Sorry,the syntax in the email was wrong. The code is boring, it virtually processes some data and write the results out using write.table function at the end. The output has <10,000 rows. Here is part of the code: write.table(sigGene, file="sigGene1.tab",append=FALSE, quote = FALSE,

Re: [R] Importing BSQ/BIP/BIL files into R

2004-02-12 Thread Uwe Ligges
Jonathan Greenberg wrote: I was hoping I could get some help with an import question. I work with remote sensing imagery which commonly comes in binary form in various interleaving formats (byte interleaved by line, by pixel, etc..). These files are 2d spatial x B bands in size, and I want to be

Re: [R] Readbin and file position

2004-02-12 Thread Uwe Ligges
Jonathan Greenberg wrote: I have a binary file which is an image with multiple bands, arranged in BSQ format such that R, B and G are all N x M sized matrices (corresponding to Red, Blue and Green colors respectively). The BSQ file arranges the data as [R, B, G], so to access the B matrix, I have

[R] kriging prediction intervals

2004-02-12 Thread Ole F. Christensen
Dear Monica Take a look at some of the spatial packages. kriging prediction errors are implemented, and from these you can obtain kriging prediction intervals. See Also http://sal.agecon.uiuc.edu/csiss/Rgeo/index.html Cheers Ole Hi everybody, I am interested in calculating kriging prediction

Re: [R] Puzzled by write.table function

2004-02-12 Thread Uwe Ligges
Wang, Hui wrote: I am puzzled by the following: I use two write.table function(write into files) in my code as following (I use source to call the code): write.table (x1, file ="x1.txt", quote = "FALSE", append=FALSE, sep="\t", eol="\n", "na=NA"...) (more statement) .. write.table (x2

[R] Help in installing packages

2004-02-12 Thread Chetan Kumar
Hi all, My R installtion was fine till a few days back. On trying to install a package I see this "/usr/lib/R/bin/INSTALL: line 420: cd: src: No such file or directory" I HAVE installed packages in the past without this kind of situation having ever arisen. To get around this I installed R-1.8.1-2

RE: [R] How to get time differences in consistent units?

2004-02-12 Thread Gabor Grothendieck
If date1 and date2 have been defined in the GMT time zone then this should do it: difftime( date1, date2, tz="GMT" ) The other way is to represent your dates as chron dates since chron does not support time zones at all. In that case you could just do: date1 - date2 --- Date: Fri, 13 F

[R] IIA tests

2004-02-12 Thread Cheng
Dear Listeners, Does anyone know how to do an IIA test (Independence of Irrelevant Alternatives) after estimating a multinomial logit model? The literature discusses 4 different types of IIA test after a multinomial logit model: Hausman, Small/Hsiao, MTT, and H. How many of these tests are imple

Re: RES: [R] AGREP

2004-02-12 Thread Duncan Murdoch
On Fri, 13 Feb 2004 14:45:33 +1300 (NZDT), you wrote: >"Marcos Sanches" <[EMAIL PROTECTED]> wrote: > Ls1<-length(s1) > Ls2<-length(s2) > for ( p in 1:ls1){ > for (q in 1:ls2){ >t1<-levenshteinFast(s1[p],s2[q]) >... > > Ls1=42000 > Ls2=7 >

[R] Readbin and file position

2004-02-12 Thread Jonathan Greenberg
I have a binary file which is an image with multiple bands, arranged in BSQ format such that R, B and G are all N x M sized matrices (corresponding to Red, Blue and Green colors respectively). The BSQ file arranges the data as [R, B, G], so to access the B matrix, I have to read forward N x M + 1

[R] How to get time differences in consistent units?

2004-02-12 Thread Patrick Connolly
I'm still having trouble getting to grips with time classes. I wish to calculate the difference in days between events. Browse[1]> insp.j$First [1] "2002-02-19 13:00:00 NZDT" Browse[1]> spray.j$Date [1] "2001-11-29 13:00:00 NZDT" Browse[1]> insp.jk - spray.j$Date Time difference of 82 days If

Re: RES: [R] AGREP

2004-02-12 Thread Richard A. O'Keefe
"Marcos Sanches" <[EMAIL PROTECTED]> wrote: Ls1<-length(s1) Ls2<-length(s2) for ( p in 1:ls1){ for (q in 1:ls2){ t1<-levenshteinFast(s1[p],s2[q]) ... Ls1=42000 Ls2=7 I think I will wait for months untill this pro

Re: [R] C-Code

2004-02-12 Thread Jason Turner
> Can you assist me of a C-code or a compiled c-code for the > statistics-functions that exist in R. > Easy. Just download the latest source verion - it's all open, and there for you to see. Most of the functions have self-descriptive file names. http://cran.r-project.org/src/base/R-1.8.1.tgz

[R] Puzzled by write.table function

2004-02-12 Thread Wang, Hui
I am puzzled by the following: I use two write.table function(write into files) in my code as following (I use source to call the code): write.table (x1, file ="x1.txt", quote = "FALSE", append=FALSE, sep="\t", eol="\n", "na=NA"...) (more statement) .. write.table (x2, file="x2.txt"..

[R] how to get the cluster output as a text file but not a graphic one?

2004-02-12 Thread ysun8
Hi, I got a problem when using the cluster in R. Instead of getting the graphic output, I prefer a text format output rather than a graphic one. How can I get the text file if it's possible? Thanks a lot! Sincerely, Ying __ [EMAIL PROTECTED] maili

[R] Importing BSQ/BIP/BIL files into R

2004-02-12 Thread Jonathan Greenberg
I was hoping I could get some help with an import question. I work with remote sensing imagery which commonly comes in binary form in various interleaving formats (byte interleaved by line, by pixel, etc..). These files are 2d spatial x B bands in size, and I want to be able to extract the band v

[R] C-Code

2004-02-12 Thread Yousef, Waleed A*
Can you assist me of a C-code or a compiled c-code for the statistics-functions that exist in R. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

RE: [R] Basic Help

2004-02-12 Thread Andy Bunn
Marisa, If the examples in R Data Import/Export can't help you you'll have to be way way way more specific. http://cran.r-project.org/doc/manuals/R-data.pdf I'm assuming you are using windows. Here's an example. Try saving the attached file to c:\temp and copying the commands below into R. This

Re: [R] Basic Help

2004-02-12 Thread Jason Turner
> OK I have been trying to learn how to use this program and I cannot even > import any data into it. I have downloaded all the manuals but they do > not > seem to help. Is there a book on R for dummies??? I don't know about dummies, but Peter Dalgaard's book, "Introductory Statistics with R" is

RE: [R] Basic Help

2004-02-12 Thread Liaw, Andy
Other than the official "An Introduction to R" manual, there are a few intro-level documentations on CRAN. Do you mean to say that all of them are too advanced for you? Andy > From: Marisa Ramos > > OK I have been trying to learn how to use this program and I > cannot even > import any data i

Re: [R] Basic Help

2004-02-12 Thread partha_bagchi
Have you looked at the manual : " R Data Import /Export" that comes with R? If you are using Windows platform Go to Help -->Manuals --> R Data Import/ Export. Hope that helps. Partha Marisa Ramos <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 02/12/2004 02:49 PM To: [EMAIL

RE: [R] Basic Help

2004-02-12 Thread Ko-Kang Kevin Wang
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Marisa Ramos > Sent: Friday, February 13, 2004 8:49 AM > To: [EMAIL PROTECTED] > Subject: [R] Basic Help > > > OK I have been trying to learn how to use this program and I > cannot even > import

Re: [R] variances of values predicted using a lm object

2004-02-12 Thread Rajarshi Guha
On Thu, 2004-02-12 at 14:50, Sundar Dorai-Raj wrote: > Rajarshi Guha wrote: > > Hi, > > is there a function in R that will give me the variances of a > > predicted values obtained using predict.lm(). > From ?predict.lm: > > > Details: > > 'predict.lm' produces predicted values, obtaine

[R] Importing BSQ/BIP/BIL files into R

2004-02-12 Thread Jonathan Greenberg
I was hoping I could get some help with an import question. I work with remote sensing imagery which commonly comes in binary form in various interleaving formats (byte interleaved by line, by pixel, etc..). These files are 2d spatial x B bands in size, and I want to be able to extract the band v

[R] kriging prediction intervals

2004-02-12 Thread Monica Palaseanu-Lovejoy
Hi everybody, I am interested in calculating kriging prediction intervals. Any suggestions will be very much appreciated. Thank you in advance, Monica __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do re

RE: [R] variances of values predicted using a lm object

2004-02-12 Thread Liaw, Andy
In case you haven't read ?predict.lm, please do, and if you did, please do it yet again. Look for the `se.fit' and `interval' arguments. Andy > From: Rajarshi Guha > > Hi, > is there a function in R that will give me the variances of a > predicted values obtained using predict.lm(). > > If n

Re: [R] variances of values predicted using a lm object

2004-02-12 Thread Sundar Dorai-Raj
Rajarshi Guha wrote: Hi, is there a function in R that will give me the variances of a predicted values obtained using predict.lm(). If no function is available I would need to calculate them myself - which involves taking the inverse of X'X (' indicating transpose) where X is my model matrix.

[R] Basic Help

2004-02-12 Thread Marisa Ramos
OK I have been trying to learn how to use this program and I cannot even import any data into it. I have downloaded all the manuals but they do not seem to help. Is there a book on R for dummies??? __ [EMAIL PROTECTED] mailing list https://www.stat.m

[R] variances of values predicted using a lm object

2004-02-12 Thread Rajarshi Guha
Hi, is there a function in R that will give me the variances of a predicted values obtained using predict.lm(). If no function is available I would need to calculate them myself - which involves taking the inverse of X'X (' indicating transpose) where X is my model matrix. I know that calculatin

RES: [R] AGREP

2004-02-12 Thread Marcos Sanches
Hi Henrik, Your function is really faster, but I tested it to solve my problem. And I found it is too time consuming yet for me. This happens because I need to compare strings from two very large vectors. Bellow I wrote the syntax I have to use: ## Ls1<-length(s1

Re: [R] How do you create a "MCMC" object?

2004-02-12 Thread Duncan Murdoch
On Thu, 12 Feb 2004 10:06:41 -0600, "Icabalceta, Jorge L." <[EMAIL PROTECTED]> wrote : >I have been running a Gibbs Sampler to estimate levels of efficiency in the >Louisiana Shrimp Industry. I created a matrix (samp) where I stored the >results of each iteration for 86 variables. I run 10,000 ite

RE: [R] lapply and dynamically linked functions

2004-02-12 Thread Jason Nielsen
I figured this much by looking at the function: > lapply function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.list(X)) X <- as.list(X) rval <- .Internal(lapply(X, FUN)) names(rval) <- names(X) return(rval) } however I have to say that the help page doesn't say any

Re: [R] R-help

2004-02-12 Thread Marc Schwartz
On Thu, 2004-02-12 at 10:42, [EMAIL PROTECTED] wrote: > On 12-Feb-04 Marc Schwartz wrote: > > Jim, just for clarification, do you truly mean the SAS *code* or did > > you mean the SAS *dataset*? > > > > If the former, as you are probably picking up, no go. There is no > > direct translation. It wo

Re: [R] calling R from a shell script and have it display graphics

2004-02-12 Thread Seth Falcon
How about saving to png and writing a small html file and then launching a browser? On Thu, Feb 12, 2004 at 07:45:42AM -0800, Don MacQueen wrote: > I don't know about the "simpler" part, but you could use the tcltk > package to put up a window that prompts the user to continue. > > -Don > >

Re: [R] R-help

2004-02-12 Thread Ted Harding
On 12-Feb-04 Marc Schwartz wrote: > Jim, just for clarification, do you truly mean the SAS *code* or did > you mean the SAS *dataset*? > > If the former, as you are probably picking up, no go. There is no > direct translation. It would be like expecting a C compiler to compile > Fortan code. Been

[R] suggestion "suggestion" and dataframe operations

2004-02-12 Thread ivo welch
hi chaps: a simple suggestion: R tells me who the contributors() are, but this should also tell me where I should mail suggestions to. Is it this mailing list? a repository of suggestions? an individual? this came up because i wanted to suggest two small enhancements: the first is for the

[R] How to predict ARMA models?

2004-02-12 Thread John J. Gazaille
Hi all, I am fitting an ARMA(1,(1,4)) model. y(t) = a*y(t-1) + e(t) + b1*e(t-1) + b4*e(t-4) > arma1.14 <- arma(series, lag=list(ar=1, ma=c(1,4)), + include.intercept = F, qr.tol = 1e-07) works fine: Coefficient(s): ar1 ma1 ma4 0.872 -0.445 0.331 I wan

[R] MARS in classification problem

2004-02-12 Thread Kim Mouridsen
Dear R-experts I recently tried out the Salford Systems MARS software on a large dataset. Apparently MARS outperformed traditional techniques such as logistic regression and k-nearest-neighbor. Since I usually perform all my data analyses in R I have installed the 'mda' package but I seem to get

RE: [R] AGREP

2004-02-12 Thread Henrik Bengtsson
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Gabor > Grothendieck > Sent: den 12 februari 2004 16:07 > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [R] AGREP > > One could shorten it slightly with these minor improvements. > Unfortu

Re: [R] left eigenvector

2004-02-12 Thread Spencer Graves
What about the following: > A <- array(1:4, dim=c(2,2)) > leftA <- eigen(t(A)) > t(leftA$vectors) [,1] [,2] [1,] -0.4159736 -0.9093767 [2,] -0.8245648 0.5657675 hope this helps. spencer graves Tom Blackwell wrote: Federico - If a matrix is symmetric, its left and r

[R] How do you create a "MCMC" object?

2004-02-12 Thread Icabalceta, Jorge L.
I have been running a Gibbs Sampler to estimate levels of efficiency in the Louisiana Shrimp Industry. I created a matrix (samp) where I stored the results of each iteration for 86 variables. I run 10,000 iterations. So, the matrix samp is 10,000 x 86. I want to use the gelman-rubin test to check f

RES: [R] AGREP

2004-02-12 Thread Marcos Sanches
Thanks very much, this function is just what I am looking for!!! Marcos -Mensagem original- De: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 12 de fevereiro de 2004 12:07 Para: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Assunto: Re: [R] AGREP

Re: [R] calling R from a shell script and have it display graphics

2004-02-12 Thread Don MacQueen
I don't know about the "simpler" part, but you could use the tcltk package to put up a window that prompts the user to continue. -Don At 11:57 AM +0100 2/12/04, Christophe Pallier wrote: Hello, I am running R under Linux/x11. I would like to call R from a shell script and have it display a se

Re: [R] left eigenvector

2004-02-12 Thread Tom Blackwell
Federico - If a matrix is symmetric, its left and right eigenvectors are identical. If a matrix is not symmetric, its left eigenvector is the right eigenvector of its transpose. However, without checking, I don't recall which R functions will return the correct right eigenvectors for a non-symme

Re: [R] AGREP

2004-02-12 Thread Gabor Grothendieck
One could shorten it slightly with these minor improvements. Unfortunately, the key performance problem, the double loop at the end which implements the dynamic programming calculation, is still there. levenshtein<-function(s1,s2) { # Make sure args are strings a <- as.character(s

[R] left eigenvector

2004-02-12 Thread Federico Calboli
Dear All, how do I compute the left eigenvector of a matrix? I gather that "eigen" computes the right eigenvectors... Regards, Federico Calboli -- = Federico C. F. Calboli PLEASE NOTE NEW ADDRESS Dipartimento di Biologia Via Selmi 3 40126 Bologna Italy tel

Re: [R] Porting let* from Common LISP to R

2004-02-12 Thread Luke Tierney
Just creating variables with assignments is essentialy the same as let*. If you need to limit the scope of the variables to part of a function you can use local(); just remember to use <<- if you want to change the value of a variable outside the local(). Most Comman Lisp systems have higher defa

RE: [R] R-help

2004-02-12 Thread partha_bagchi
Perhaps he means that he wants to translate SAS code to R code? I couldn't tell from the email. If you want to execute SAS code from R, you can definitely do what you suggest (tongue in cheek perhaps) but still legitimate question? "Liaw, Andy" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED]

Re: [R] AGREP

2004-02-12 Thread Rodrigo Abt
"Marcos Sanches" <[EMAIL PROTECTED]> writes: >Hi listers > >If you don't know what is the Edit Distance beetwen two strings, I will >try to explain, in fact it is very simple to understund but not to >calculate througth a program. It is simplilly the minimum number of >operations you must perform

[R] Porting let* from Common LISP to R

2004-02-12 Thread Gabriel Baud-Bovy
In porting some Common LISP code to R, I am trying to found out whether special care must be taken for the let* function. In Common LISP, "the let* block is like let except it is guaranteed to evaluate the initialization of its local variables in sequentially nested scopes, i.e. it provides an ord

Re: [R] R-help

2004-02-12 Thread Marc Schwartz
On Thu, 2004-02-12 at 06:36, Frank E Harrell Jr wrote: > On Thu, 12 Feb 2004 12:12:01 +0100 > Jim Gustafsson <[EMAIL PROTECTED]> wrote: > > > Hi, > > I have a problem. > > I would like to put my SAS-code into R. > > Could I do that, if yes, how? > > > > > > Best regards > > Jim Gustafsson > > J

[R] Edit strings (was: AGREP)

2004-02-12 Thread Conrad Halling
I have not written such a function, but a good place to learn more is Chapter 11 of _Algorithms on Strings, Trees, and Sequences_ by Dan Gusfield. Marcos Sanches wrote: Hi listers If you don't know what is the Edit Distance beetwen two strings, I will try to explain, in fact it is very simple t

RE: [R] R-help

2004-02-12 Thread Liaw, Andy
[Sorry. Just can't resist...] Probably quite easy. Something like: system("sas mysascode.sas") Andy > From: Jim Gustafsson > > Hi, > I have a problem. > I would like to put my SAS-code into R. > Could I do that, if yes, how? > > > Best regards > Jim Gustafsson > ___

RE: [R] lapply and dynamically linked functions

2004-02-12 Thread Liaw, Andy
That's the expected behavior, not a bug, because: > args(lapply) function (X, FUN, ...) NULL so lapply has `X' as an formal argument. Any calls to lapply() with named argument `X=...' will match to that, so the net effect is that the `X=...' part gets used by lapply() as the list to operate on,

Re: [R] lattice: showing panels for factor levels with no values

2004-02-12 Thread Deepayan Sarkar
On Thursday 12 February 2004 03:12, Wolfram Fischer - Z/I/M wrote: > How to show panels for factor levels of conditioning variables > which do have no values? > > E.g. there are panels for "Grand Rapids" when they have values: > data( barley ) > with( barley, dotplot(variety ~ yield | y

Re: [R] R-help

2004-02-12 Thread Frank E Harrell Jr
On Thu, 12 Feb 2004 12:12:01 +0100 Jim Gustafsson <[EMAIL PROTECTED]> wrote: > Hi, > I have a problem. > I would like to put my SAS-code into R. > Could I do that, if yes, how? > > > Best regards > Jim Gustafsson Just reverse the procedure you use when you put R code into SAS. ;) --- Frank E

Re: [R] R-help

2004-02-12 Thread Rolf Turner
Jim Gustafsson <[EMAIL PROTECTED]> wrote: > I have a problem. Boy, do you ever. > I would like to put my SAS-code into R. > Could I do that, if yes, how? Right. I have a couple of questions for you too. (1) How long is a piece of string? (2) How do I bring peace, pro

Re: [R] Debugging R Code

2004-02-12 Thread Angel
If you plan using Mark Bravingtons's debug package within emacs via ess you should read this: https://www.stat.math.ethz.ch/pipermail/ess-help/2004-February/001708.html were Mark suggested that in emacs you should set options( debug.command.recall=FALSE)' before running the debugger. Cheers, Angel

[R] (no subject)

2004-02-12 Thread GAYATRI
Sir / Madam, My working on windows version and my system is connected to internet. Moreover there is no problem in the firewall. GAYATRI [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.st

[R] Almost Ideal Demand System

2004-02-12 Thread Wayne Jones
Hi there fellow R users, Has anyone got an R example of applying an Ideal demand system, possibly using the library systemfit?? Thanks Wayne Dr Wayne R. Jones Senior Statistician / Research Analyst KSS Limited St James's Buildings 79 Oxford Street Manchester M1 6SS Tel: +44(0)161 609 4084

Re: [R] How to download

2004-02-12 Thread Uwe Ligges
GAYATRI wrote: Sir/Madam, I have been trying to install packages from bioconductor or CRAN but we get an error message saying "can't open URL http://www. bioconductor.org/bin/windows/contrib/1.7/PACKAGES". Kindly help me in resolving this problem. F

Re: [R] AGREP

2004-02-12 Thread Duncan Murdoch
On Wed, 11 Feb 2004 14:53:33 -0300, you wrote: > > Hi all, I have two questions > >1 - I have the version 1.4.1 of R, and it doesn't have the 'agrep' >function in the base library. Is there a way to make this funcion >avaliable in R 1.4.1? I mean, how to 'copy' it from R 1.8.1 and 'paste' >i

Re: [R] Debugging R Code

2004-02-12 Thread Simon Wood
Maybe try Mark Bravingtons's debug package? (see article in last R news) > is there a more convenient way to debug R code than the built in debug() > function? (so that one can set breakpoints, step in and out of function > calls,...). I read the section on debugging compiled code in the manual >

Re: [R] How to download

2004-02-12 Thread Douglas Bates
"GAYATRI" <[EMAIL PROTECTED]> writes: > I have been trying to install packages from bioconductor or CRAN but > we get an error message saying "can't open URL http://www. > bioconductor.org/bin/windows/contrib/1.7/PACKAGES". Kindly help me > in resolving this problem. The 1.7 in that URL indicates

[R] R-help

2004-02-12 Thread Jim Gustafsson
Hi, I have a problem. I would like to put my SAS-code into R. Could I do that, if yes, how? Best regards Jim Gustafsson ___ Codan Insurance, Gammel Kongevej 60, DK-1790 Copenhagen V telephone: +45 33 55 55 55, fax: +45 33

[R] calling R from a shell script and have it display graphics

2004-02-12 Thread Christophe Pallier
Hello, I am running R under Linux/x11. I would like to call R from a shell script and have it display a series of graphics. The graphics should remain visible until the user clicks or presses a key. I first tried R BATCH, but it does not load the x11 module, making it impossible to open x11 or

Re: [R] Debugging R Code

2004-02-12 Thread dlc
hello, the new library "debug" contains such possibilities and has a nice tcl/tk interface. Read the description of that library in the last volume of R-news (volume 3/3, december 03, p.29) hope this help, dlc Hi all, is there a more convenient way to debug R code than the built in debug() fun

[R] How to download

2004-02-12 Thread GAYATRI
Sir/Madam, I have been trying to install packages from bioconductor or CRAN but we get an error message saying "can't open URL http://www. bioconductor.org/bin/windows/contrib/1.7/PACKAGES". Kindly help me in resolving this problem. Further, I would

[R] Debugging R Code

2004-02-12 Thread Tobias Sing
Hi all, is there a more convenient way to debug R code than the built in debug() function? (so that one can set breakpoints, step in and out of function calls,...). I read the section on debugging compiled code in the manual "Writing R Extensions" (I only want to debug ordinary code but thought

[R] lattice: showing panels for factor levels with no values

2004-02-12 Thread Wolfram Fischer - Z/I/M
How to show panels for factor levels of conditioning variables which do have no values? E.g. there are panels for "Grand Rapids" when they have values: data( barley ) with( barley, dotplot(variety ~ yield | year * site, layout=c(6,2) ) ) There are no panels for "Grand Rapids" when

[R] RE: Kernel Density Estimator for 2D Binned Data

2004-02-12 Thread Nicholas Lewin-Koh
Hi James, You can try the hexbin package at www.bioconductor.org. Do the following bin<-hexbin(x,y) ## This will give you hexagonal bins of the data binsm<-smooth.hexbin(bin) plot(binsm) This is an approximation to what you want. The other way is to use a 2d bspline on the bin center of masses o