Re: [R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Karl Ove Hufthammer
On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma wrote: > any(duplicated(c(1,2,2))) or anyDuplicated(c(1,2,2)) which is slightly more efficient. -- Karl Ove Hufthammer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Remark on tapply().

2009-11-30 Thread Karl Ove Hufthammer
On Tue, 1 Dec 2009 14:10:17 +1300 Rolf Turner wrote: > Consider the following: > > > set.seed(42) > > ff <- factor(sample(c(1,3,5),42,TRUE),levels=1:5) > > x <- runif(42) > > tapply(x,ff,sum) > 12345 > 3.675436 NA 7.519675 NA 9.094210 > >

[R] Calculation of Central Moments

2009-11-30 Thread Maithili Shiva
Dear R helpers If for a given data, I need to calculate Mean, Standard Deviation, Mode, Median, Skewness, Kurtosis, is there any package in R, which will calculate these moments? Individually I can calculate these, but if there is any function which will calculate these at a stretch, please le

Re: [R] Stripchart: way to get different colour for each group

2009-11-30 Thread David Winsemius
On Dec 1, 2009, at 12:42 AM, johannes rara wrote: Hi, Is there a way to get different colour based on group when plotting stripchart? mydata <- data.frame(val1 = c(1.1, 3.2, 4.1, 2.5, 6.2, 5.3, 4.5, 2.2, 4.7, 2.7), val2 = c(4.2, 5.3, 3.4, 2.6, 5.3, 6.2, 7.7, 4.8, 3.4, 2.1), group = rep(0:1

Re: [R] Scaling variables to positive values using scale() or performing BoxCox on negative data

2009-11-30 Thread Karl Ove Hufthammer
On Mon, 30 Nov 2009 16:47:41 + Henry Thorogood wrote: > The scale function seems to have tackled the skew, just looking at the > boxplots for the data. No, the 'scale' function does absolutely nothing to change the skew; it's only a linear transformation. -- Karl Ove Hufthammer _

Re: [R] Ggplot2: Elegant Graphics for Data Analysis (Use R) (2009 Paperback)

2009-11-30 Thread Karl Ove Hufthammer
On Mon, 30 Nov 2009 14:35:45 -0800 (PST) DispersionMap wrote: > Is this book worth its dollar? If so, why?, if not, why not? Yes, it's an excellent book, IMHO. It teaches you both the 'how' and the 'why' of ggplot2 in a nice, well-structured way, with lots of examples, and information on vario

Re: [R] About the method dispatch mechanism

2009-11-30 Thread Sharpie
Peng Yu wrote: > > I see the follow explanation in help(cbind). I don't understand what > the dispatch mechanism is. Could you point me what document or > reference I should read? > > The method dispatching is _not_ done via 'UseMethod()', but by > C-internal dispatching. Therefore, t

[R] R] Re: Histogram and Density on the the same graph

2009-11-30 Thread Charlotte Maia
Hi, The computer I'm using now doesn't have R on it, so this is a naive guess: lines (density (y) ) regards -- Charlotte Maia http://sites.google.com/site/maiagx/home __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] apply on two lists?

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 11:07 PM, Peng Yu wrote: x=list(a=c(1,2),b=c(3,4,5)) y=list(a=c(1,2),b=c(3,4,5)) lapply(seq(along=x),function(i){cbind(x[[i]],y[[i]])}) mapply("cbind", x, y) I need to apply some function on two lists. I have to use the index to do as shown above. But I feel more natur

[R] GLM Repeated measures test of assumptions: e.g. test for sphericity e.g. Bartletts and Levenes homogenous variances

2009-11-30 Thread Joanne Lenehan
Hello and thanks in advance I am running a glm in R the code is as follows with residual diagnostic code below model4<-glm(Biomass~(Treatment+Time+Site)^2, data=bobB, family=quasi(link="log", variance="mu")) par(mfrow=c(2,2)) plot(model2) to test the effect of grazing exclusion of feral ho

[R] Stripchart: way to get different colour for each group

2009-11-30 Thread johannes rara
Hi, Is there a way to get different colour based on group when plotting stripchart? mydata <- data.frame(val1 = c(1.1, 3.2, 4.1, 2.5, 6.2, 5.3, 4.5, 2.2, 4.7, 2.7), val2 = c(4.2, 5.3, 3.4, 2.6, 5.3, 6.2, 7.7, 4.8, 3.4, 2.1), group = rep(0:1, 5)) mydata.stack <- stack(mydata, select=-group) strip

Re: [R] apply on two lists?

2009-11-30 Thread sayan dasgupta
why don't you try this tmp=list(X=x,Y=y) and then lapply(tmp,fun(..)) Peng Yu wrote: > > x=list(a=c(1,2),b=c(3,4,5)) > y=list(a=c(1,2),b=c(3,4,5)) > lapply(seq(along=x),function(i){cbind(x[[i]],y[[i]])}) > > > I need to apply some function on two lists. I have to use the index to > do as shown

[R] Amendment to previous post a minute ago, please amend before posting if possible

2009-11-30 Thread Joanne Lenehan
Sorry, I just posted the email below but realised I did not give a name or details, would it be possible to adjust before posting and send what is below, sorry again, first time user... From: Joanne Lenehan [mailto:jlene...@une.edu.au] Sent: Tuesday, 1 December 2009 3:51 PM To: 'r-help@r-proje

[R] Agreement among three or more observers

2009-11-30 Thread John Sorkin
R 2.9 Windows XP Is there an R function that will compute a measure of agreement(e.g. Kappa) among three or more observers? Thank you, John Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}} __ R-help@r

[R] About the method dispatch mechanism

2009-11-30 Thread Peng Yu
I see the follow explanation in help(cbind). I don't understand what the dispatch mechanism is. Could you point me what document or reference I should read? The method dispatching is _not_ done via 'UseMethod()', but by C-internal dispatching. Therefore, there is no need for, e.g.,

[R] go back a block of code in history

2009-11-30 Thread Peng Yu
Suppose I run the following code in the R session. At the last prompt '>', I want to retrieve the second command (staring with 'y'). But I have to type up arrow many times, which is very inconvenient. I'm wondering if there is a way to configure R to skip block of code in the history? > x=list(a=c

[R] apply on two lists?

2009-11-30 Thread Peng Yu
x=list(a=c(1,2),b=c(3,4,5)) y=list(a=c(1,2),b=c(3,4,5)) lapply(seq(along=x),function(i){cbind(x[[i]],y[[i]])}) I need to apply some function on two lists. I have to use the index to do as shown above. But I feel more natural to refer to the lists without using the index (using the syntax of somet

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Remko Duursma
any(duplicated(c(1,2,2))) r - Remko Duursma Post-Doctoral Fellow Centre for Plants and the Environment University of Western Sydney Hawkesbury Campus Richmond NSW 2753 Dept of Biological Science Macquarie University North Ryde NSW 2109 Australia

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Ista Zahn
See ?duplicated. But really I don't see anything wrong with your approach. -Ista On Mon, Nov 30, 2009 at 10:42 PM, Peng Yu wrote: > length(unique(c(1,2,2)))==length(c(1,2,2)) > > I use the above test to test if all the elements in a vector are > unique. But I'm wondering if there is a convenient

Re: [R] vector as data.frame element?

2009-11-30 Thread Remko Duursma
Maybe you can just use a list? mylis <- list("x", c("y","z")) element 1 is then mylis[[1]], which is x, and so forth. But it looks like you really need to 'map' some numbers to your list. You could use separate vector that keeps track of the index numbers: index <- c(0,1) and then map like thi

Re: [R] Overlapping Plot Labels and Color Palette

2009-11-30 Thread Jim Lemon
On 12/01/2009 01:56 PM, Brock Tibert wrote: Hi all, I am new to R, but with the help I have received thus,I have already been able to work through a bunch of questions on my own in just a few days. I imagine my questions are relatively simple, but here she goes. 1) I am using a package where

[R] Is there a function to test if all the elements in a vector are unique

2009-11-30 Thread Peng Yu
length(unique(c(1,2,2)))==length(c(1,2,2)) I use the above test to test if all the elements in a vector are unique. But I'm wondering if there is a convenient function to do so in R library. __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

[R] vector as data.frame element?

2009-11-30 Thread Peng Yu
It seems that an vector or other non elemental data type can not be assigned to an element in the data.frame. I'm wondering what is the walk around. > li=data.frame(a=c(0,1), b=c('x','y')) > li$b[[1]]= 'x' > li$b[[2]]<- c('y','z') Error in li$b[[2]] <- c("y", "z") : more elements supplied than t

[R] Overlapping Plot Labels and Color Palette

2009-11-30 Thread Brock Tibert
Hi all, I am new to R, but with the help I have received thus,I have already been able to work through a bunch of questions on my own in just a few days. I imagine my questions are relatively simple, but here she goes. 1) I am using a package where one of the objects generated represents X/Y

Re: [R] optim or nlminb for minimization, which to believe?

2009-11-30 Thread Ravi Varadhan
Hi Harold, Hans is right. You can see this if you use BB::spg require(BB) opt2 <- spg(startVal, fn) # this is fine opt3 <- spg(startVal, fn,gradient) # this is not fine! > opt3 <- spg(startVal, fn, gradient) Gradient check details: max. relative difference in gradients= 0.001697913

Re: [R] Assign palette (e.g. rainbow) to a series of points on 1 plot

2009-11-30 Thread Frostygoat
It was arbitrary data and I made a mistake. Thanks for your help nonetheless. I solved the problem using matpoints, which does the job quite nicely: > lx100=c(1,1,1,.8,.5,.4,.2,0) > day100=c(0,1,2,3,4,5,6,7) > lx90=c(1,1,1,1,.9,.8,.6,.4,.2,.1,0) > day90=c(0,1,2,3,4,5,6,7,8,9,10) > lx0=c(1,1,1,1,1

Re: [R] how to solve a problem in R this problem?can someone help me

2009-11-30 Thread susan jacobs
Hi, i already read everything that is in the site that it is in English , i not figuring out how to start. I don t understand how to look at the data that where given to me and began to relate them. I m sorry for my english but it s the best i can do, im not american or english so i write with

[R] Remark on tapply().

2009-11-30 Thread Rolf Turner
Consider the following: > set.seed(42) > ff <- factor(sample(c(1,3,5),42,TRUE),levels=1:5) > x <- runif(42) > tapply(x,ff,sum) 12345 3.675436 NA 7.519675 NA 9.094210 I got bitten by those NAs in the result of tapply(). Effectively one is summi

Re: [R] paste name in for loop?

2009-11-30 Thread jim holtman
Here is what you want: xout <- c(1,5,10,25,50,100) for(i in xout) { print(paste("Areal_Ppt_",i,"sqmi.txt", sep="")) } Notice that 'i' will be assigned each value in xout; you do not have to index into the vector. Notice that you second value is 50 which is xout[5]. On Mon, Nov 30, 2009 at 7:49

Re: [R] paste name in for loop?

2009-11-30 Thread Jorge Ivan Velez
Hi Douglas, You were almost there. Just remember that your iterator is i and not xout. R> xout <- c(1,5,10,25,50,100) R> for(i in xout) print(paste("Areal_Ppt_", i,"sqmi.txt", sep="")) [1] "Areal_Ppt_1sqmi.txt" [1] "Areal_Ppt_5sqmi.txt" [1] "Areal_Ppt_10sqmi.txt" [1] "Areal_Ppt_25sqmi.txt" [1] "A

Re: [R] paste name in for loop?

2009-11-30 Thread Duncan Murdoch
On 30/11/2009 7:49 PM, Douglas M. Hultstrand wrote: Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout <- c(1,5

[R] paste name in for loop?

2009-11-30 Thread Douglas M. Hultstrand
Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout <- c(1,5,10,25,50,100) for(i in xout) { print(paste("Areal_Pp

Re: [R] question about availability of splines library for 2.10.0

2009-11-30 Thread Alan Swanson
Phil and Peter, thanks - figured it was something obvious. I had uninstalled splines to check the behavior of some other code. I just reinstalled R 2.10.0 and it shows up. Thanks! Alan Peter Ehlers wrote: Have you searched your computer? Rhome/library/splines It's one of the packages autom

Re: [R] question about availability of splines library for 2.10.0

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 6:47 PM, Alan Swanson wrote: Dear R gurus, I am using the gbm library under R version 2.10.0, which depends on the splines library. I have searched the various repositories and can't seem to locate any current version of the splines library. This is strange because I

Re: [R] question about availability of splines library for 2.10.0

2009-11-30 Thread Peter Ehlers
Have you searched your computer? Rhome/library/splines It's one of the packages automatically installed with R. -Peter Ehlers Alan Swanson wrote: Dear R gurus, I am using the gbm library under R version 2.10.0, which depends on the splines library. I have searched the various repositories

[R] question about availability of splines library for 2.10.0

2009-11-30 Thread Alan Swanson
Dear R gurus, I am using the gbm library under R version 2.10.0, which depends on the splines library. I have searched the various repositories and can't seem to locate any current version of the splines library. This is strange because I had previously installed splines (built under 2.10.0

Re: [R] Ggplot2: Elegant Graphics for Data Analysis (Use R) (2009 Paperback)

2009-11-30 Thread milton ruser
I agree with Ista. The book is very interesting. I put my 2cents too. milton On Mon, Nov 30, 2009 at 6:20 PM, Ista Zahn wrote: > Depends on what you want. It's possible to find most of the > information contained in the book in other places (the ggplto2 > website, Hadley's dissertation, the gg

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Jakson A. Aquino
On Mon, Nov 30, 2009 at 12:01:12PM +0100, Trafim wrote: > Dear all, > > I cannot find a function which would allow drawing hist and density on the > same graph. > > x <- seq(1,40,1) > y <- 2*x+1+5*rnorm(length(x)) > > hist(y,freq = FALSE) > plot(density(y)) The package descr has the function hi

Re: [R] Ggplot2: Elegant Graphics for Data Analysis (Use R) (2009 Paperback)

2009-11-30 Thread Ista Zahn
Depends on what you want. It's possible to find most of the information contained in the book in other places (the ggplto2 website, Hadley's dissertation, the ggplot2 mailing list archive). Personally I really appreciate having all that information in one place, and in an easy to read format. It's

Re: [R] How do I run to or more R consoles on Mac OS X?

2009-11-30 Thread chronos.phenomena
Thanks... that worked is there a way to run r script? for example open -n /Applications/R.app myscript.r when I use this syntax... I get my script file opened but not executed :( Thanks in advance Ken Knoblauch wrote: > > chronos.phenomena gmail.com> writes: > >> >> >> This is really

Re: [R] Plotting color.legend() outside of plot region

2009-11-30 Thread Tim Clark
Peter, Thanks, layout() does exactly what I want. Now I also realize why I wasn't able to get the legend where I wanted it. I didn't realize par(xpd=...) was only for the last plot. That explains why I was getting weird results when trying to move my legend around! Aloha, Tim Tim Clark D

[R] Fitting Distribution to Data

2009-11-30 Thread reezwan you
Hello everyone: I tried to fit a Beta distribution on a right-skewed dataset using: fitdistr(temp,densfun="beta",start=list(shape1=3,shape2=2)) To assess the fit, I proceeded as follows: Using distribution parameters from the sample resulting from fitdistr() function, I generated 1000 samples

[R] Ggplot2: Elegant Graphics for Data Analysis (Use R) (2009 Paperback)

2009-11-30 Thread DispersionMap
Is this book worth its dollar? If so, why?, if not, why not? Cheers. -- View this message in context: http://n4.nabble.com/Ggplot2-Elegant-Graphics-for-Data-Analysis-Use-R-2009-Paperback-tp931702p931702.html Sent from the R help mailing list archive at Nabble.com.

[R] normalized kernel question:

2009-11-30 Thread Parminder Mankoo
Hey! Can anyone help me coding in R a normalized kernel matrix. Basically, I want K(x,y)/sqrt(*K*(*x, x*)*K*(*y, y*)) Anyone has a piece of code that you could share? Many thanks, Parmee [[alternative HTML version deleted]] __ R-help@r-proje

Re: [R] how to solve a problem in R this problem?can someone help me

2009-11-30 Thread Rolf Turner
You should do your own homework. cheers, Rolf Turner On 1/12/2009, at 10:37 AM, susan jacobs wrote: Census from 1990 california in USA. It’s a data frame with data from 20640 zones from Califórnia. Zones are chosen as being geograficly near, wich one with 1500 pe

Re: [R] Plotting color.legend() outside of plot region

2009-11-30 Thread Peter Ehlers
Tim Clark wrote: Dear List, I am trying to plot a color.legend() in the right outer margin of my device region. I have read multiple threads on the subject and still can't get it right. I have stolen an example from one of the threads to demonstrate my problem. I have extended the outer marg

Re: [R] Question about output from optim

2009-11-30 Thread Prof. John C Nash
As Ben Bolker has indicated, I am working on various improvements to the functionality of optim() along with others, esp. Ravi Varadhan and Kate Mullen. With relevance to the posts by Sebastien Bihorel and Ben Bolker about output of point/function value information on each evaluation, I am wo

Re: [R] kernlab's ksvm method freeze

2009-11-30 Thread Heiko Strathmann
Sorry, heres the message: Hi yes the freeze is rather a result of the kernelMatrix being non-positive definite, have a look at the eigenvalues of kernelMatrix with eigs and you will see even small negative values. This is usualy the result of small numerical inacuracies in the computation of the

[R] how to solve a problem in R this problem?can someone help me

2009-11-30 Thread susan jacobs
Census from 1990 california in USA. It’s a data frame with data from 20640 zones from Califórnia. Zones are chosen as being geograficly near, wich one with 1500 persons (mean). For each zone are provided several informations in the colums from data frame: - longitude e latitude from the geograf

Re: [R] Learning R

2009-11-30 Thread susan jacobs
Hi, im working in R but honestly i don t know how to apply the formulas in my problem, can someone give some help? I already learn how we use the formulas but im not understanding the main issue in my problem. Johannes Huesing wrote: > > Esmail [Mon, Nov 30, 2009 at 01:07:15PM CET]: > >>

[R] how to calculate "axis variance" in metaMDS, pakage vegan?

2009-11-30 Thread Gian
Hi there, I am trying to use funcion metaMDS (vegan pakage) for Community Ecology data, but I find no way to calculate the "expressed variance" of the first 2 axis? is there a way to do that? Thanks a lot in advance, Gian -- View this message in context: http://n4.nabble.com/how-to-calculate-

Re: [R] Learning R

2009-11-30 Thread DispersionMap
Data Analysis and Graphics Using R - An Example-Based Approach John Maindonald and John Braun 2nd edn, Cambridge University Press, January 2007 susan jacobs wrote: > > Hi, > > im working in R but honestly i don t know how to apply the formulas in my > problem, can someone give some help?

Re: [R] error when installing Rcmdr / tcltk on a Apple laptop

2009-11-30 Thread Prof Brian Ripley
On Mon, 30 Nov 2009, Karin Groothuis wrote: Hello, I have installed R on my Apple Laptop. Next I wanted to install the package Rcmdr which requires the package tcltk. But then I get errors like: The downloaded packages are in /var/folders/0p/0pD8fDrwHouNDsQ+k8dGmU+++TI/-Tmp-//RtmpSp

[R] error when installing Rcmdr / tcltk on a Apple laptop

2009-11-30 Thread Karin Groothuis
Hello, I have installed R on my Apple Laptop. Next I wanted to install the package Rcmdr which requires the package tcltk. But then I get errors like: The downloaded packages are in /var/folders/0p/0pD8fDrwHouNDsQ+k8dGmU+++TI/-Tmp-//RtmpSp4q7p/ downloaded_packages Loading required packag

[R] Plotting color.legend() outside of plot region

2009-11-30 Thread Tim Clark
Dear List, I am trying to plot a color.legend() in the right outer margin of my device region. I have read multiple threads on the subject and still can't get it right. I have stolen an example from one of the threads to demonstrate my problem. I have extended the outer margin using par(oma(

Re: [R] Learning R

2009-11-30 Thread Johannes Huesing
Esmail [Mon, Nov 30, 2009 at 01:07:15PM CET]: > ps: Just checked, 'R in a Nutshell': > http://oreilly.com/catalog/9780596801717 > release date dec 2009/jan 2010 You can't really judge a book by its cover, and in this case not even the cover is presented to us. But judging by the author's

Re: [R] kernlab's ksvm method freeze

2009-11-30 Thread Heiko Strathmann
Hello again, i got this message from the maintainer: Am Montag, den 30.11.2009, 11:22 +0100 schrieb Heiko Strathmann: > Ok, i reported it. > thanks for trying it out again. > > Am 30. November 2009 11:06 schrieb Uwe Ligges > : > My apologies, that must have been a copy&paste error and t

[R] Need help with for loop in forecast

2009-11-30 Thread tobiasfa
Hi I have a ts from 1980:1 trough 2009:9 with a frequency of 12. I want to make 25 6 month forecast where the first 6 month forecast is between 2007:4 - 2007:9 and the last 2009:4 - 2009:9. My script: Forecast <- list() for (i in 1:25){ j <- i + 326 Data <- window(omxr, end = time(omxr)[j]) Res

Re: [R] bug or bizarre feature?

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 2:24 PM, Henrique Dallazuanna wrote: Dim argument must be a integer, see the return of: Less true than you might expect: > x <- 3.5 > y <- 5.2 > z <- array(0, dim=c(x,y)) > z [,1] [,2] [,3] [,4] [,5] [1,]00000 [2,]00000 [3,]

Re: [R] Is there a way to convert rgb/hex value to a (nearest) color name?

2009-11-30 Thread Henrique Dallazuanna
You can try something about like this: yourColor <- c(250,235,215) colors()[which.min(colSums(col2rgb(colors()) - yourColor )[colSums(col2rgb(colors()) - yourColor) >= 0])] On Mon, Nov 30, 2009 at 5:25 PM, Jorgy Porgee wrote: > Hi all, I'm trying to convert a series of rgb codes into a color na

Re: [R] Is there a way to convert rgb/hex value to a (nearest) color name?

2009-11-30 Thread Jorgy Porgee
Fantastic. Thanks Duncan. Clearly my google key words were the wrong ones, nothing of this sort came up. Hope my title is easier to find somehow.. Regards, George __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Is there a way to convert rgb/hex value to a (nearest) color name?

2009-11-30 Thread Gabor Grothendieck
Try this: > mycolor <- col2rgb("red"); mycolor [,1] red255 green0 blue 0 > colors()[sapply(lapply(colors(), col2rgb), identical, mycolor)] [1] "red" "red1" On Mon, Nov 30, 2009 at 2:25 PM, Jorgy Porgee wrote: > Hi all, I'm trying to convert a series of rgb codes into a color

Re: [R] Is there a way to convert rgb/hex value to a (nearest) color name?

2009-11-30 Thread Duncan Murdoch
On 30/11/2009 2:25 PM, Jorgy Porgee wrote: Hi all, I'm trying to convert a series of rgb codes into a color name. What is my easiest option? So far I'm stuck with just converting to hex using rgb() and I know R knows a number of colours() but a mapping of the two has failed me. Any help in this

Re: [R] allocating vector memory > 1 GByte on Windows XP / Vista / 7

2009-11-30 Thread Duncan Murdoch
In answer to your 4th question: you are trying to allocate an object whose size is 1/4 of the addressable memory on your machine. You might be lucky and have that much available in one piece, but I'm guessing you don't, which is why the allocation fails. So don't worry about questions 1,2, o

[R] Is there a way to convert rgb/hex value to a (nearest) color name?

2009-11-30 Thread Jorgy Porgee
Hi all, I'm trying to convert a series of rgb codes into a color name. What is my easiest option? So far I'm stuck with just converting to hex using rgb() and I know R knows a number of colours() but a mapping of the two has failed me. Any help in this regard will be highly appreciated. Regards,

Re: [R] bug or bizarre feature?

2009-11-30 Thread Henrique Dallazuanna
Dim argument must be a integer, see the return of: as.integer(slope*xdim) Try this: udim <- ceiling(max(slope*xdim,5)) On Mon, Nov 30, 2009 at 5:15 PM, Rupert Mazzucco wrote: > Hello, > > I'm running into a very strange problem: > >> xrange <- c(-2.5,2.5) >> xdim <- 100 >> mobility <- 0.1 >> s

Re: [R] bug or bizarre feature?

2009-11-30 Thread Erik Iverson
Simply a manifestation of FAQ 7.31, i.e., a floating-point arithmetic issue. On my machine, > 1.16 * 100 == 116 [1] FALSE > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Rupert Mazzucco > Sent: Monday, November 30, 2009 1:

Re: [R] bug or bizarre feature?

2009-11-30 Thread David Winsemius
Proably ole Faq 7.21 again. You are using floating point numbers and expecting coercion to result in upward rounding. My guess is that if you use trunc(udim) you will get a different number. Yep: > trunc(udim) [1] 115 On Nov 30, 2009, at 2:15 PM, Rupert Mazzucco wrote: Hello, I'm running

[R] RMySQL unique primary key ??

2009-11-30 Thread Benton, Paul
Dear R-guru's, I have some data that I'm writing to a mysql database. I need the database to generate the primary key and it's not being generated as a unique ID. My understanding was that primary keys should be unique. I submit a data.frame with named columns. The only name that it's missing i

[R] bug or bizarre feature?

2009-11-30 Thread Rupert Mazzucco
Hello, I'm running into a very strange problem: > xrange <- c(-2.5,2.5) > xdim <- 100 > mobility <- 0.1 > slope <- 1.16 > urange <- slope*xrange > udim <- max(slope*xdim,5) > du <- (urange[2]-urange[1])/udim > uvec <- urange[1]+(1:udim-0.5)*du > # type dependent we

Re: [R] command similar to colSums for rowSums?

2009-11-30 Thread Will Carr
This seems to work quite well and gives an ~85% speed increase compared to the for loop. Thanks a bunch! Peter Ehlers wrote: > > Or maybe aperm() is faster: > > max(colSums(aperm(yourArray, c(2,1,3 > > -Peter Ehlers > > Peter Ehlers wrote: >> Does this >> >> max(apply(yourArray, 3,

Re: [R] command similar to colSums for rowSums?

2009-11-30 Thread Will Carr
This gives the correct result but appears to be slower than the for loop I was using, I do appreciate the suggestion though. Peter Ehlers wrote: > > Does this > > max(apply(yourArray, 3, rowSums)) > > give you what you want? > > -Peter Ehlers > > Will Carr wrote: >> Working with an NxMx

Re: [R] command similar to colSums for rowSums?

2009-11-30 Thread Will Carr
David Winsemius wrote: > > What are M, N, and O? All the same magnitude? > In this case, 4,13,10. > What are you doing based on that if( ) determination? > Increasing a counter. > Are you sure you are interpreting your profile results correctly? > No, but I think I am. I'm using proc.t

[R] allocating vector memory > 1 GByte on Windows XP / Vista / 7

2009-11-30 Thread Jochen Albrecht
Let me begin stating that I read all help files and faq's on the subject matter (there aren't more than about a dozen) but either did not find solutions or found them not to work. Here is the issue. I am trying to run a spatial regression on a medium-sized dataset. Part of the functions in the s

Re: [R] Assign palette (e.g. rainbow) to a series of points on 1 plot

2009-11-30 Thread Phil Spector
One of the reasons we ask for a *reproducible* example, is that it allows us to test our ideas and make sure that all the details are taken care of. Here's a reproducible example that may help solve your problem: lx100=c(1,1,1,.8,.5,.4,.2,0) day100=c(0,1,2,3,4,5,6,7) lx90=c(1,1,1,1,.9,.8,.6,.4,.

Re: [R] command similar to colSums for rowSums?

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 11:10 AM, Will Carr wrote: Working with an NxMxO sized matrix, currently I can do this in my code: What are M, N, and O? All the same magnitude? if (max(colSums(array)) >= number) But to get an equivalent result using rowSums, I have to do: for (i in 1:10) { if (max

Re: [R] command similar to colSums for rowSums?

2009-11-30 Thread Peter Ehlers
Or maybe aperm() is faster: max(colSums(aperm(yourArray, c(2,1,3 -Peter Ehlers Peter Ehlers wrote: Does this max(apply(yourArray, 3, rowSums)) give you what you want? -Peter Ehlers Will Carr wrote: Working with an NxMxO sized matrix, currently I can do this in my code: if (max(co

Re: [R] Joint density approximation?

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 11:20 AM, Trafim wrote: Sorry, maybe I confused everybody with what I want. I have time process X_k, and corresponding returns process R_k I am interesting in f(r|x), which I can find knowing f(r,x) and f(x). I know the latter I need the first. How can I apploximate thi

Re: [R] Scaling variables to positive values using scale() or performing BoxCox on negative data

2009-11-30 Thread Henry Thorogood
Great! Have managed to shift my dataset to positive. Thanks for all your help. Henry. 2009/11/30 David Winsemius > > On Nov 30, 2009, at 11:47 AM, Henry Thorogood wrote: > > The scale function seems to have tackled the skew, just looking at the >> boxplots for the data. >> >> The boxcox functio

Re: [R] Scaling variables to positive values using scale() or performing BoxCox on negative data

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 11:47 AM, Henry Thorogood wrote: The scale function seems to have tackled the skew, just looking at the boxplots for the data. The boxcox function I'm using is boxcox(), from MASS. I'm puzzled. When I look at the boxcox function in MASS it says: "Arguments object a f

Re: [R] command similar to colSums for rowSums?

2009-11-30 Thread Peter Ehlers
Does this max(apply(yourArray, 3, rowSums)) give you what you want? -Peter Ehlers Will Carr wrote: Working with an NxMxO sized matrix, currently I can do this in my code: if (max(colSums(array)) >= number) But to get an equivalent result using rowSums, I have to do: for (i in 1:10) { if

Re: [R] Learning R

2009-11-30 Thread Benton, Paul
Julia, I can vouch for the 'Statistical Analysis in R'. Very good book, I learnt R from it. The other one to look at is Spoetry. It solves a lot of problem for me. Paul http://www.burns-stat.com/pages/spoetry.html On 30 Nov 2009, at 17:17, Ben Seligman wrote: > Hi Julia, > > I'm also a newc

Re: [R] RSQLite does not read very large values correctly

2009-11-30 Thread jim holtman
It appears that you were reading the number in as an integer and not numeric. The value that you are seeing (-596864072) is the numeric value trucated to 32 bit. The number would have been in hex (6DC6C93B8) but dropping the leading '6' you will get the result as a 32 bit integer. Check your dat

Re: [R] Learning R

2009-11-30 Thread Ben Seligman
Hi Julia, I'm also a newcomer to R and to this listserv (in the past two weeks). One book that was recommended to me, and has been extraordinarily helpful in learning how to really make use of R, is "A Beginner's Guide to R", which focuses on data entry/import, data manipulation, functions, and p

Re: [R] Scaling variables to positive values using scale() or performing BoxCox on negative data

2009-11-30 Thread Henry Thorogood
The scale function seems to have tackled the skew, just looking at the boxplots for the data. The boxcox function I'm using is boxcox(), from MASS. I've looked through the help page, but I don't think (from what I can see) there's a way to make the boxcox function handle the negative values, unlik

[R] RSQLite does not read very large values correctly

2009-11-30 Thread Ruecker, Sebastian
Hello, I am trying to import data from an SQLite database to R. Unfortunately, I seem to get wrong data when I try to import very large numbers. For example: I look at the database via SQLiteStudio(v.1.1.3) and I see the following values: OrderID Day TimeToclose 1 2009-

Re: [R] Scaling variables to positive values using scale() or performing BoxCox on negative data

2009-11-30 Thread David Winsemius
On Nov 30, 2009, at 11:02 AM, Henry Thorogood wrote: Hi, I'm doing some work with linear models, and I've scaled my data using the scale(dataset) function. This was great at removing the skew, but I now can't perform the Box Cox transformation on the data set (using the boxcox(dataset) fu

Re: [R] JMP <-> R ?

2009-11-30 Thread Upton, Stephen C
Hi Robert and Wai-Kuan, I'd be interested as well. I see in the JMP Scripting Book that there appear to be 3 possibilities (all in Chapter 11-at least for version 8): 1. using a JMP DataFeed object 2. using sockets 3. OLE automation Sockets with something like RServe may be the way to go. I have

Re: [R] Ubuntu tcl/tk problems

2009-11-30 Thread stephen sefick
I used the archives, but I didn't use the FAQs. I removed the compiled version- and all other R versions. I reinstalled through the repository, and everything works fine. Sorry for the inconvenience. regards, Stephen On Mon, Nov 30, 2009 at 10:14 AM, Dirk Eddelbuettel wrote: > > On 30 Novembe

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
Sorry, maybe I confused everybody with what I want. I have time process X_k, and corresponding returns process R_k I am interesting in f(r|x), which I can find knowing f(r,x) and f(x). I know the latter I need the first. How can I apploximate this f(r,x) in the such way that later I can find f(X=

[R] rpart: how to assign observations to nodes in regression trees

2009-11-30 Thread Diego Bellisai
Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way

[R] command similar to colSums for rowSums?

2009-11-30 Thread Will Carr
Working with an NxMxO sized matrix, currently I can do this in my code: if (max(colSums(array)) >= number) But to get an equivalent result using rowSums, I have to do: for (i in 1:10) { if (max(rowSums(array[,,i])) >= number) } I'm running both in a much larger loop that loops millions of tim

Re: [R] Ubuntu tcl/tk problems

2009-11-30 Thread Dirk Eddelbuettel
On 30 November 2009 at 15:12, Peter Dalgaard wrote: | stephen sefick wrote: | > Error in firstlib(which.lib.loc, package) : | > Tcl/Tk support is not available on this system | > Error : package 'tcltk' could not be loaded | > | > Ubuntu 9.10 | > I have both the 8.5 and 8.4 tcl and tk regular a

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
Also what if the grid matrix is not squared? How can I then find this kernel density matrix/ Thanks a lot. On Mon, Nov 30, 2009 at 4:56 PM, Trafim wrote: > You are right. > I brought this example just to see how to use its with two time series. In > reality I have price process and returns, and

[R] Scaling variables to positive values using scale() or performing BoxCox on negative data

2009-11-30 Thread Henry Thorogood
Hi, I'm doing some work with linear models, and I've scaled my data using the scale(dataset) function. This was great at removing the skew, but I now can't perform the Box Cox transformation on the data set (using the boxcox(dataset) function), as the scaling has returned negative values. So my q

Re: [R] Learning R

2009-11-30 Thread Adaikalavan Ramasamy
Dear Julia, Welcome. It is good that you wish to learn more about R. R has certainly become very vast in the last few years. Do you wish to learn R for a particular reason (financial analyses, multivariate, prediction/classification, genetics)? You might get more targeted reading materials, b

[R] rpart: how to assign observations to nodes in regression trees

2009-11-30 Thread Diego Bellisai
Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way

Re: [R] Joint density approximation?

2009-11-30 Thread Trafim
You are right. I brought this example just to see how to use its with two time series. In reality I have price process and returns, and I need conditional density. Will highly appreciate your help. I found function kde2d but cannot understand how to call for the values of the matrix. On Mon, No

[R] rpart: how to assign observations to nodes in regression trees

2009-11-30 Thread Diego Bellisai
Hi, I am building a regression tree (method=anova) by using rpart package and as a final result I get the final leaves characterized by different means and standard deviations for the dependent variable. However, differently from the classification tree for categorical variables I cannot find a way

Re: [R] Using stepAIC to produce a p-value for when a particular variable was taken out of the model

2009-11-30 Thread Laura Bonnett
I've just realised that this is a very silly post as I can't read!!! The output in the "anova" is the excluded variables - very sorry! Laura 2009/11/30 Laura Bonnett > Dear all, > > I have decided after much deliberation to use backward elimination and > forward selection to produce a multivar

  1   2   >