[R] add to vector without duplicatation

2008-08-27 Thread Yuan Jian
Hi,   I try to add items to a vector, but when the it has existed, the item should be skipped. does anyone know how to do it a simple way?     Yu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.eth

[R] [R-pkgs] filehash 2.0

2008-08-27 Thread Roger D. Peng
I have just uploaded to CRAN version 2.0 of the 'filehash' package. This version contains a major rewriting of many of the internals (much rewritten in C) for the DB1 format, which is the default. This development has lead to better file locking for concurrent access and faster reading and writing

[R] RCurl: authentication when posting forms

2008-08-27 Thread Valerie Obenchain
Hi, Has anyone successfully used RCurl for posting data to a password-protected site? I have tired using option netrc=1 with both postForm and curlPerform (with postfields option) but can't authenticate. I would happily provide more details if some one has had some experience with this. Than

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Phil Spector
Could this be related to the administrative rights of the user? If a user had administrative rights, packages would be installed into the /Library/Frameworks directory, and then updating (to, I think a new major version) would remove them. Without the administrative rights it would install the

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Rolf Turner
On 28/08/2008, at 3:00 PM, Charilaos Skiadas wrote: On Aug 27, 2008, at 10:40 PM, Rolf Turner wrote: On 28/08/2008, at 2:02 PM, James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'

Re: [R] ifelse() fill order and recycling rules [Sec=Unclassified]

2008-08-27 Thread Rolf Turner
On 28/08/2008, at 11:30 AM, John McKinlay wrote: Hi all, Using R v2.7.1, platform i386-pc-mingw32 Can someone please shed some light on the behaviour of ifelse() for me? My intent is to calc relative proportions of z$b, at the same time subsetting z$b based on z$a. I could attack the probl

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Charilaos Skiadas
On Aug 27, 2008, at 10:40 PM, Rolf Turner wrote: On 28/08/2008, at 2:02 PM, James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to downloa

[R] c4 for the un-biasing of sample stddev of normal distribution

2008-08-27 Thread James Muller
Hi list, I'm trying to track down a function returning (the expected value of) c4, for correcting for bias in sample standard deviation, given sample standard deviation, population size, and normality of the distribution. Any help appreciated :) And, apologies if I'm looking past it... Cheer

Re: [R] How to create additional columns?

2008-08-27 Thread milton ruser
Dear Kayj Try something like setwd("c:\\temp") require(MASS) my.df<-read.table("my_inputfile.txt", sep="\t", head=T) my.df$newcol<-my.df$col1+my.df$col2+my.df$col3 write.table(my.df, "my_outputfile.txt", append=F, row.names=F, sep="\t") On the above example, I suppose that your input file are

Re: [R] Upgrading R means I lose my packages

2008-08-27 Thread Rolf Turner
On 28/08/2008, at 2:02 PM, James Milks wrote: The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to download and install each of them anew every time I instal

[R] c4 for the un-biasing of sample stddev of normal distribution

2008-08-27 Thread James Muller
Hi list, I'm trying to track down a function returning (the expected value of) c4, for correcting for bias in sample standard deviation, given sample standard deviation, population size, and normality of the distribution. Any help appreciated :) And, apologies if I'm looking past it... Cheer

[R] How to create additional columns?

2008-08-27 Thread kayj
I do have some data of dim 100*3 (i.e 100 rows and 3 columns ) stored in a txt file. I want to read the data into R, Perform the same operation in each row and store the result in a forth column( that I should create). I do not know how I can create a forth column to store the result of the ope

[R] help with rimage compiling

2008-08-27 Thread Guilherme Garcia
i'm trying to compile the source code for the package 'rimage', and it fails after it starts compiling. I have both fftw and jpeg packages installed, and i'm currently running R 2.7.1 under gentoo x86_64. here goes the output from R while compiling the package: * Installing *source* package 'r

[R] ifelse() fill order and recycling rules [Sec=Unclassified]

2008-08-27 Thread John McKinlay
Hi all, Using R v2.7.1, platform i386-pc-mingw32 Can someone please shed some light on the behaviour of ifelse() for me? My intent is to calc relative proportions of z$b, at the same time subsetting z$b based on z$a. I could attack the problem other ways (suggestions welcome) but I am also intrig

[R] I need to change from character to numeric?

2008-08-27 Thread kayj
Hi, I am reading numeric data as below but the problem is the object ndata1 and nd1 have characters instead of numeric values. I want to keep it as numeric. Why the type has changed from numeric to character and how to avoid this problem? rdata1<- read.table(file="data1.txt", header=F,stringsA

[R] Upgrading R means I lose my packages

2008-08-27 Thread James Milks
The title says it all. Does anyone know of a way to save your packages when you upgrade to a new version of R? This may seem petty, but I'm accumulating enough packages that having to download and install each of them anew every time I install a new version of R is rather of a pain. Idea

Re: [R] Integrate a 1-variable function with 1 parameter (Jose L. Romero)

2008-08-27 Thread Moshe Olshansky
This can be done analytically: after changing a variable (2*t -> t) and some scaling we need to compute f(x) = integral from 0 to 20 of (t^x*exp(-t))dt/factorial(x) f(0) = int from 0 to 20 of exp(-t)dt = 1 - exp(-20) and integration by parts yields (for x=1,2,3,...) f(x) = -exp(-20)*20^x/facto

Re: [R] Updating a list.

2008-08-27 Thread rkevinburton
Since this didn't work: > m2007$DayOfYear <- factor(m2008$DayOfYear, levels = 1:365) Error in `$<-.data.frame`(`*tmp*`, "DayOfYear", value = c(1L, 1L, 1L, : replacement has 432267 rows, data has 1592009 Perhaps I need to clarify how the m2007 object was generated. t2007 <- read.csv("Total200

Re: [R] Updating a list.

2008-08-27 Thread hadley wickham
On Wed, Aug 27, 2008 at 6:18 PM, <[EMAIL PROTECTED]> wrote: > I have a list that is generated from the resape package function 'cast'. It > consists of three columns, Sku, DayOfYear, variable it is generated like: > > r2007 <- cast(m2008, DayOfYear ~ variable | Sku, sum) > > Now DayOfYear can ran

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Jorge Ivan Velez
Dear Steven, Try this: # Data set yourdata=as.data.frame(cbind(lvl=LETTERS[1:2],x=rpois(10,10),y=rnorm(10) )) # Splitting your data set sdata=split(yourdata,yourdata$lvl) res=lapply(sdata,function(X) max(dist(X[,-1]))) do.call(c,res) HTH, Jorge On Wed, Aug 27, 2008 at 7:28 PM, Steven Mat

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Dylan Beaudette
On Wednesday 27 August 2008, Steven Matthew Anderson wrote: > Thank you Jorge, > > My talent in building functions is weak. I think I'm close but I'm > not doing something right. > > res=dist(yourdata) > res[which.max(res)] > does provide me with the correct distance but how do I apply it across >

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Steven Matthew Anderson
Thank you Jorge, My talent in building functions is weak. I think I'm close but I'm not doing something right. res=dist(yourdata) res[which.max(res)] does provide me with the correct distance but how do I apply it across data with level such as ... > yourdata =as.data.frame(cbind(lvl=LE

[R] Updating a list.

2008-08-27 Thread rkevinburton
I have a list that is generated from the resape package function 'cast'. It consists of three columns, Sku, DayOfYear, variable it is generated like: r2007 <- cast(m2008, DayOfYear ~ variable | Sku, sum) Now DayOfYear can range from 1:365 but there are not necessarily that many rows in the list

Re: [R] How to learn R language?

2008-08-27 Thread Bert Gunter
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Baer Sent: Wednesday, August 27, 2008 3:42 PM To: r-help@r-project.org Subject: Re: [R] How to learn R language? but I doubt you'll ever be done learning because the project is so comprehensive ;-)

Re: [R] How to learn R language?

2008-08-27 Thread Robert Baer
On 27-Aug-08 14:24:31, Charles Annis, P.E. wrote: There are many books, but if I had to choose one that teaches R and teaches statistics at the same time (Yes, you already know stats, so it will be that much easier) I'd choose Peter Dalgaard's book, Introductory Statistics with R. It's excepti

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Ben Bolker
Steven Matthew Anderson mac.com> writes: > I'm trying to figure out how to write a r function that will calculate > the extreme spread of a group of points given their (x,y) > coordinates. Extreme Spread is the maximal Euclidean distance between > two points in a group > > ex.spread = max

Re: [R] plot.cuminc: how to put tick marks for censored observations

2008-08-27 Thread stephen sefick
see how survfit does it and then implement that- maybe harder than it sounds. my two cents On Wed, Aug 27, 2008 at 5:13 PM, Kuan-Chi Lai <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to figure out how to put tick marks for censored observations > using plot.cuminc for my competing risk analysi

Re: [R] Basic question about X11()

2008-08-27 Thread Barry Rowlingson
2008/8/27 Patrick Connolly <[EMAIL PROTECTED]>: > Your question is one relating to your window manager. The display > parameter for x11() does not relate to desktops. All the desktops are > part of the same display. Some very clever R-devel people might be > able to think of a way of making a s

[R] plot.cuminc: how to put tick marks for censored observations

2008-08-27 Thread Kuan-Chi Lai
Hi, I am trying to figure out how to put tick marks for censored observations using plot.cuminc for my competing risk analysis (survfit does this automatically). I've searched online for resources but found nothing. Does anybody know how to do this? Thank you in advance for your input. KC

Re: [R] conversion of data structure between R and Perl

2008-08-27 Thread Rolf Turner
You need to do: system("perl presentPerformance.pl",intern=TRUE) It does pay to read the help, you know. cheers, Rolf Turner On 28/08/2008, at 8:36 AM, kevinchang wrote: Dear R users, I am trying to call a Perl subroutine from R . T

[R] conversion of data structure between R and Perl

2008-08-27 Thread kevinchang
Dear R users, I am trying to call a Perl subroutine from R . The subroutine returns an arrray contaning three elements wihch are all strings. But the calling in R return an integer which is 0. I have no idea how this could happen. Maybe becasue I shouldn't use system() in R or I should load a pa

Re: [R] Basic question about X11()

2008-08-27 Thread Patrick Connolly
On Wed, 27-Aug-2008 at 02:42PM +0200, Groeneweg M (GEN) wrote: |> Hello, |> |> I have a basic question about the display() function, but I can't find the answer easily. |> |> I am running R 2.7.16.0 on Suse linux 11.0 Are you sure of that? R-2.7.2 is the most recent. |> with KDE 4.0 You

[R] r function for calculating extreme spread in group

2008-08-27 Thread Steven Matthew Anderson
I'm trying to figure out how to write a r function that will calculate the extreme spread of a group of points given their (x,y) coordinates. Extreme Spread is the maximal Euclidean distance between two points in a group ex.spread = max{ sqrt [ (xi-xj)^2 - (yi-yj)^2 ] } for i not equal to

Re: [R] problems formating scientific collaboration data

2008-08-27 Thread Jorge Ivan Velez
I'm sorry Grant, my bad. To reproduce what you'd like to do, my previous code should be: x="Paper,Author, Year 1,SmithKK JonesSD, 2008 2,WallaceAR DarwinCA, 1999 3,HawkingS, 2003" X=read.delim2(textConnection(x),sep=",",header=TRUE) closeAllConnections() author= s

Re: [R] problems formating scientific collaboration data

2008-08-27 Thread Jorge Ivan Velez
Dear Grant, Try this: x="Paper,Author, Year 1,SmithKK JonesSD, 2008 2,WallaceAR DarwinCA, 1999 3,HawkingS, 2003" X=read.delim2(textConnection(x),sep=",",header=TRUE) closeAllConnections() author= strsplit(as.character(X$Author)," ") l=lapply(author,length) P=rep(X

Re: [R] lattice: plotting an arbitrary number of panels, defining arbitrary groups

2008-08-27 Thread Deepayan Sarkar
On Tue, Aug 26, 2008 at 6:56 PM, Alex Karner <[EMAIL PROTECTED]> wrote: > Thanks Deepayan, works like a charm. > > A followup question though--I'd like to produce the same data on four > panels with the final two "zoomed in", i.e. plotted with shorter x and > y axes. Since I can't access panel.numb

Re: [R] problems formating scientific collaboration data

2008-08-27 Thread Dong-hyun Oh
Hi, name of the data.frame is assumed to be dt. cnt.tmp <- strsplit(dt$Author, " ") cnt <- sapply(cnt.tmp, length) paper.cnt <- dt$Paper[cnt] author <- unlist(cnt.tmp) year <- dt$Year[cnt] dt.new <- data.frame(Paper = paper.cnt, Author = author, Year = year) HTH, Dong-hyun Oh On Aug 27, 2008,

Re: [R] Calculating total observations based on combinations of variable values

2008-08-27 Thread hadley wickham
On Wed, Aug 27, 2008 at 12:11 PM, Josip Dasovic <[EMAIL PROTECTED]> wrote: > Hello: > > As someone making the move from STATA to R, I'm finding it difficult at times > to perform basic tasks in R, so forgive me if I've missed an obvious and > easily obtained solution to my problem. I've searche

[R] solution found [was: accessing sd and var functions in embedded app]

2008-08-27 Thread EBo
I found a solution, but it will take me awhile to articulate why the example in the manual generated a segfault. EBo -- EBo <[EMAIL PROTECTED]> said: > I am able to call R functions like min, mean, and mad from from a C/C++ > embedded appli

[R] problems formating scientific collaboration data

2008-08-27 Thread Grant Gillis
Hello all and thanks in advance for any help or direction. I have co-authorship data that looks like: PaperAuthor Year 1 SmithKK JonesSD 2008 2 WallaceAR DarwinCA 1999 3 HawkingS2003 I would like: Paper Author

Re: [R] Simple programming problem with 'with' or 'data ='

2008-08-27 Thread Adaikalavan Ramasamy
with(gdsgraph, boxplot(BReT3T5T ~ gds3lev)) is equivalent to boxplot(gdsgraph$BReT3T5T ~ gdsgraph$gds3lev), so all the terms are found. gds1lev is not found within the scope of the function gdsbox(). This function has too many hard codings to be of much use generically. Consider rewriting it

Re: [R] Two envelopes problem

2008-08-27 Thread Greg Snow
> -Original Message- > From: Mario [mailto:[EMAIL PROTECTED] > Sent: Monday, August 25, 2008 5:41 PM > To: Greg Snow > Cc: r-help@r-project.org > Subject: Re: [R] Two envelopes problem > > Dear Greg, > > The problem is that in your code you are creating a > distribution where there are on

Re: [R] Combine x-axis labels size

2008-08-27 Thread baptiste auguie
Whoops, typo in my previous post: x <- 1:10 y <- x plot(x, y, ann=F, xaxt="n") axis(1, lab=F) -> positions mtext(paste(positions), side = 1, line = 1, outer = F, at = positions, cex=seq(1, 9, length=length(positions))) Is this what you mean by label sizes? On 27 Aug 2008, at 18:51, baptiste

Re: [R] Combine x-axis labels size

2008-08-27 Thread baptiste auguie
Hi, I'm not sure I understand what you want, but perhaps: x <- 1:9 y <- x plot(x, y, ann=F, xaxt="n") axis(1, lab=F) -> positions mtext(paste(positions), side = 1, line = 1, outer = F, at = test, cex=1:length(positions)) HTH, baptiste On 27 Aug 2008, at 18:36, Dani Valverde wrote: Hel

Re: [R] Simple programming problem with 'with' or 'data ='

2008-08-27 Thread Duncan Murdoch
On 8/27/2008 1:15 PM, Peter Flom wrote: Hello I wrote a simple program to modify a boxplot: <<< gdsbox <- function(indvar){ boxplot(indvar~gds3lev, main = paste('Boxplot of', substitute(indvar), "for GDS groups"), names = c('1', '3', '4, 5, 6')) } If I attach the dataframe gdsgrap

[R] Combine x-axis labels size

2008-08-27 Thread Dani Valverde
Hello, I would like to combine different label sizes in the same x-axis, for example 1 2 3 4 5 6 7 8 9 How can I do it? Best, Dani -- Daniel Valverde Saubí Grup de Biologia Molecular de Llevats Facultat de Veterinària de la Universitat Autònoma de Barcelona Edifici V, Campus UAB 08193 Cerdany

Re: [R] Integrate a 1-variable function with 1 parameter (Jose L. Romero)

2008-08-27 Thread jose romero
To Ravi Varadhan and Peter Dalgaard: Infinite thanks for your help and suggestions- they were very instructive, as i have still to learn on the appropriate use of the apply family of functions. jlrp --- On Wed, 8/27/08, Ravi Varadhan <[EMAIL PROTECTED]> wrote: > From: Ravi Varadhan <[EMAIL PR

Re: [R] Two envelopes problem

2008-08-27 Thread Greg Snow
The reason that taking the log fixes things is because log( 2 ) = -log( 1/2 ), so log takes us to an additive difference. I think the use of log(utility) is actually based on experiments where people were asked what they were willing to risk for various potential gains and the results were more

Re: [R] Calculating total observations based on combinations of variable values

2008-08-27 Thread Henrique Dallazuanna
Try this: merge(aggregate(x$DAY, x[, c("YEAR", "MONTH")], length), data.frame(YEAR = unique(x$YEAR), MONTH = 1:12), all = T) On Wed, Aug 27, 2008 at 2:11 PM, Josip Dasovic <[EMAIL PROTECTED]> wrote: > Hello: > > As someone making the move from STATA to R, I'm finding it difficult at >

Re: [R] Calculating total observations based on combinations of variable values

2008-08-27 Thread Dylan Beaudette
On Wednesday 27 August 2008, Josip Dasovic wrote: > Hello: > > As someone making the move from STATA to R, I'm finding it difficult at > times to perform basic tasks in R, so forgive me if I've missed an obvious > and easily obtained solution to my problem. I've searched the help guides > and the

[R] Simple programming problem with 'with' or 'data ='

2008-08-27 Thread Peter Flom
Hello I wrote a simple program to modify a boxplot: <<< gdsbox <- function(indvar){ boxplot(indvar~gds3lev, main = paste('Boxplot of', substitute(indvar), "for GDS groups"), names = c('1', '3', '4, 5, 6')) } >>> If I attach the dataframe gdsgraph, this works fine. However, I've been war

[R] Calculating total observations based on combinations of variable values

2008-08-27 Thread Josip Dasovic
Hello: As someone making the move from STATA to R, I'm finding it difficult at times to perform basic tasks in R, so forgive me if I've missed an obvious and easily obtained solution to my problem. I've searched the help guides and the archives and have not been able to find a solution that w

[R] accessing sd and var functions in embedded app

2008-08-27 Thread EBo
I am able to call R functions like min, mean, and mad from from a C/C++ embedded application, but when I try to get the standard deviation or variance (sd, var) R segfaults. Can someone suggest how to resolve this? Thanks and best regards, EBo -- __

Re: [R] RCurl: using netrc with curlPerform

2008-08-27 Thread Valerie Obenchain
Thanks Martin! Valerie Martin Morgan wrote: Hi Valerie -- curlPerform is expecting the url to be an option that is named, i.e., myopts <-curlOptions(netrc=1) url <- "http://www.omegahat.org/RCurl/testPassword/index.html"; cat(curlPerform(url=url, .opts=myopts)) Basic Password Te

[R] Quantitative risk analysis with R

2008-08-27 Thread Graham Smith
Recently a course with this title, from Vose consulting, was announced on the list. Does anyone know of any books/websites/downloadable tutorials etc that cover the same ground. ie not just quantitative risk analysis, but specifically on using R for risk analysis and as an alternative to @Risk/Cr

Re: [R] Fw: How to learn R language?

2008-08-27 Thread Roland Rau
Ajay ohri wrote: - go with Bob and Peter's book. Too many sources can be confusing. - Join the list, create filters for keywords of your specialty (like from R -Help ) contains regression. - Try use it for a live project . I think this is really very good advice: - 2 books (I would

Re: [R] Significant digits for checking values of variable?

2008-08-27 Thread jim holtman
Try this using 'sapply'" > sapply(X.new, all.equal, .2) == "TRUE" [1] TRUE FALSE On Wed, Aug 27, 2008 at 12:13 PM, David Afshartous <[EMAIL PROTECTED]> wrote: > > Thanks. Is there simple way around this for simple checking of single > values? The all.equal() mentioned in the FAQ doesn't seem

Re: [R] averaging pairs of columns in a dataframe

2008-08-27 Thread JonD
That's great, thanks! Jon Gabor Grothendieck wrote: > > Try this: > > # test data > DF <- data.frame(a = 1:9, a = 21:29, b = 31:39, b = 41:49, check.names = > FALSE) > > t(apply(DF, 1, tapply, names(DF), mean)) > > It gives a matrix so use as.data.frame on that if you need a data frame >

Re: [R] Significant digits for checking values of variable?

2008-08-27 Thread David Afshartous
Thanks. Is there simple way around this for simple checking of single values? The all.equal() mentioned in the FAQ doesn't seem appropriate. X = c(1.2, 2) > X.new = X -1 > X == 1.2 [1] TRUE FALSE > X.new == .2 [1] FALSE FALSE On 8/27/08 11:47 AM, "jim holtman" <[EMAIL PROTECTED]> wrote: >

Re: [R] Seeking Code for Chaid or Similar

2008-08-27 Thread Daniel Folkinshteyn
on 08/27/2008 09:26 AM David Cobey said the following: I'm interested in modifying a regression tree algorithm to use the difference between a control and a dosed sample as its dependent variable. I was wondering if anyone knew where I could find code to implement a basic chaid algorithm. Is

[R] How to calculate cumulative values for a simple Bernoulli's distribution?

2008-08-27 Thread Ana Kolar
Hi there, I have two questions and believe that there is an extremely easy solution. Being a beginner with R makes thinks a bit more complicated. This is the code: rpois(15,3) n<-15 DATA<-cbind(D,rpois(15,3)) data<-as.data.frame(DATA) colnames(data)<-c("D","X") *# 1. question: is it possible

[R] ggplot2: problem with large fonts and overlapping labels

2008-08-27 Thread Paul Emberson
Hi, I am using ggplot2 to generate graphs for a paper I am writing in two column format. When I shrink the graphs to fit in a single column, the graph is clear but the axis and tick labels are way too small. I have increased the font sizes by manipulating the grid. However, when I do this

Re: [R] A manipulation problem for a large data set in R

2008-08-27 Thread Charles C. Berry
On Wed, 27 Aug 2008, Giuseppe Paleologo wrote: I have two questions for the group. One is very concrete, and is dangerously close to a "please do my homework" posting. The second follows from the first one but is more general. I would welcome the advice of experienced R users. As for the first

Re: [R] Significant digits for checking values of variable?

2008-08-27 Thread jim holtman
FAQ 7.31 On Wed, Aug 27, 2008 at 11:51 AM, David Afshartous <[EMAIL PROTECTED]> wrote: > > All, > > I'm witnessing some strange behavior when checking the values of one of my > variables. My guess is that it has something to do with the number of > significant digits being represented, but perhap

[R] A manipulation problem for a large data set in R

2008-08-27 Thread Giuseppe Paleologo
I have two questions for the group. One is very concrete, and is dangerously close to a "please do my homework" posting. The second follows from the first one but is more general. I would welcome the advice of experienced R users. As for the first one: I have a data frame with two variables X Y

Re: [R] Ratio of gammas

2008-08-27 Thread Ravi Varadhan
This will work: exp( lgamma(nu/2) - lgamma((nu+1)/2) ) Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins Universit

[R] Significant digits for checking values of variable?

2008-08-27 Thread David Afshartous
All, I'm witnessing some strange behavior when checking the values of one of my variables. My guess is that it has something to do with the number of significant digits being represented, but perhaps not as my variable was created from other variables that only had one decimal place. See below.

Re: [R] averaging pairs of columns in a dataframe

2008-08-27 Thread Gabor Grothendieck
Try this: # test data DF <- data.frame(a = 1:9, a = 21:29, b = 31:39, b = 41:49, check.names = FALSE) t(apply(DF, 1, tapply, names(DF), mean)) It gives a matrix so use as.data.frame on that if you need a data frame On Wed, Aug 27, 2008 at 9:47 AM, JonD <[EMAIL PROTECTED]> wrote: > > Dear all, >

Re: [R] Ratio of gammas

2008-08-27 Thread Duncan Murdoch
On 8/27/2008 11:14 AM, [EMAIL PROTECTED] wrote: hello, gamma(a) works fine for a<173, but gamma(173) returns [1] Inf Warning message: value out of range in 'gammafn' What I really need is the ratio gamma(nu/2) / gamma((nu+1)/2) is anyone aware of a way to re-express this in a form that push

Re: [R] How to learn R language?

2008-08-27 Thread Ted Harding
On 27-Aug-08 14:24:31, Charles Annis, P.E. wrote: > There are many books, but if I had to choose one that teaches R > and teaches statistics at the same time (Yes, you already know > stats, so it will be that much easier) I'd choose Peter Dalgaard's > book, Introductory Statistics with R. It's exc

Re: [R] juxtaposed and stacked bars in one barplot?

2008-08-27 Thread Gasper Cankar
You can simply do > a <- c(2,4,3,4,5) > b <- c(4,3,4,5,2) > barplot(cbind(a,b)) or you can put a and b in matrix as help suggests. Gasper Cankar -Original Message- From: Stefan Uhmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2008 11:39 AM To: r-help@r-project.org Subject:

Re: [R] Converting 1-D array to vector

2008-08-27 Thread Gasper Cankar
> c(as.matrix(df[1,])) will also work in your case. Gasper Cankar -Original Message- From: N. Lapidus [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2008 9:06 AM To: r-help@r-project.org Subject: Re: [R] Converting 1-D array to vector You were very close to an answer : as.vect

Re: [R] SparseM

2008-08-27 Thread Heike Pospisil
Hi Sam, thank your for your reply. The lib location statement is correct. I have installed SparseM locally because I do not have su rights. Best, Heike (BTW: An installation by our systems administrator into the R directory did not work, too.) On Wednesday 27 August 2008 19:00, Samuel Bächle

Re: [R] Fw: How to learn R language?

2008-08-27 Thread Ajay ohri
- go with Bob and Peter's book. Too many sources can be confusing. - Join the list, create filters for keywords of your specialty (like from R -Help ) contains regression. - Try use it for a live project . Let the R begin Ajay On Wed, Aug 27, 2008 at 7:46 PM, John Kane <[EMAIL PROTE

[R] Ratio of gammas

2008-08-27 Thread Erwann.Rogard
hello, gamma(a) works fine for a<173, but gamma(173) returns [1] Inf Warning message: value out of range in 'gammafn' What I really need is the ratio gamma(nu/2) / gamma((nu+1)/2) is anyone aware of a way to re-express this in a form that pushes the threshold past which a warning message is ge

[R] averaging pairs of columns in a dataframe

2008-08-27 Thread JonD
Dear all, I have a dataframe with 132 columns and 100 rows. Every 2nd column is a repeat measurement so that the columns could be titled, a a b b c c d d etc. I would like to average the repeats such that I am left with a data frame of 66 columns (of means) and 100 rows. I have been trying t

[R] Seeking Code for Chaid or Similar

2008-08-27 Thread David Cobey
Quick disclaimer: I'm new to the list and I'm not sure if I'm sending this to the correct forum. If there is a better place for questions like these, please let me know! Dear R List, I'm interested in modifying a regression tree algorithm to use the difference between a control and a dosed sa

Re: [R] SparseM

2008-08-27 Thread Samuel Bächler
Hi Heike library(SparseM,lib.loc=my.lib.loc) Error in packageDescription(pkg)$Version : $ operator is invalid for atomic vectors In addition: Warning message: In packageDescription(pkg) : no package 'SparseM' was found Error : .onLoad failed in 'loadNamespace' for 'SparseM' Error: package/n

[R] convert princomp output to equation for plane?

2008-08-27 Thread William Simpson
I want to fit something like: z = b0 + b1*x + b2*y Since x, y,and z all have measurement errors attached, the proper way to do the fit is with principal components analysis, and to use the first component (called loadings in princomp output). My dumb question is: how do I convert the princomp out

Re: [R] Integrate a 1-variable function with 1 parameter (Jose L. Romero)

2008-08-27 Thread Peter Dalgaard
Peter Dalgaard wrote: > jose romero wrote: > >> Hey fellas: >> >> I would like to integrate the following function: >> >> integrand <- function (x,t) { >> exp(-2*t)*(2*t)^x/(10*factorial(x)) >> } >> >> with respect to the t variable, from 0 to 10. >> The variable x here works as a parameter

Re: [R] Integrate a 1-variable function with 1 parameter (Jose L. Romero)

2008-08-27 Thread Ravi Varadhan
Here is one way: integrand <- function (t, x) { exp(-2*t)*(2*t)^x/(10*factorial(x)) } x <- 0:44 ans <- sapply(x, function(x) integrate(integrand, lower=0, upper=10, x=x)) cbind(x=x, integral=unlist(ans[1,]), abs.error=unlist(ans[2,])) Ravi. ---

Re: [R] Integrate a 1-variable function with 1 parameter (Jose L. Romero)

2008-08-27 Thread Peter Dalgaard
jose romero wrote: > Hey fellas: > > I would like to integrate the following function: > > integrand <- function (x,t) { > exp(-2*t)*(2*t)^x/(10*factorial(x)) > } > > with respect to the t variable, from 0 to 10. > The variable x here works as a parameter: I would like to integrate the said

Re: [R] Seeking Code for Chaid or Similar

2008-08-27 Thread Achim Zeileis
On Wed, 27 Aug 2008, David Cobey wrote: Quick disclaimer: I'm new to the list and I'm not sure if I'm sending this to the correct forum. If there is a better place for this questions, please let me know! Dear R List, I'm interested in modifying a regression tree algorithm to use the differe

[R] Integrate a 1-variable function with 1 parameter (Jose L. Romero)

2008-08-27 Thread jose romero
Hey fellas: I would like to integrate the following function: integrand <- function (x,t) { exp(-2*t)*(2*t)^x/(10*factorial(x)) } with respect to the t variable, from 0 to 10. The variable x here works as a parameter: I would like to integrate the said function for each value of x in 0,

Re: [R] How to learn R language?

2008-08-27 Thread Charles Annis, P.E.
There are many books, but if I had to choose one that teaches R and teaches statistics at the same time (Yes, you already know stats, so it will be that much easier) I'd choose Peter Dalgaard's book, Introductory Statistics with R. It's exceptionally well written, easy to follow, and will systemat

Re: [R] Fw: How to learn R language?

2008-08-27 Thread John Kane
I'm not a statistician so my approach may not make sense for you but I'd suggests having a look at Bob Muenchen's R for SAS and SPSS users in pdf form (very useful) or his new book with the same title (which I have not seen yet) for a start. http://rforsasandspssusers.com/ If you want some ver

Re: [R] juxtaposed and stacked bars in one barplot?

2008-08-27 Thread hadley wickham
Hi Stefan, Could you be a bit more explicit? Do you have an example dataset that you are trying to visualise? Hadley On Wed, Aug 27, 2008 at 4:38 AM, Stefan Uhmann <[EMAIL PROTECTED]> wrote: > Hi, > > anybody any hints how to get a barplot with both juxtaposed and stacked > bars? > > /Stefan >

[R] R for reliability engineering?

2008-08-27 Thread Wolfgang Keller
Hello, I was wondering whether anyone's using R for reliability (RAMS/LCC) engineering? Sincerely, Wolfgang Keller __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.

Re: [R] How to print out console output

2008-08-27 Thread jim holtman
What type of system are you running on? You can create a textConnection and maybe 'pipe' the output to 'lpr' if you are running on UNIX. On Windows there is probably a way of connecting to a printer; you can save the file and then execute the PRINT command. On Wed, Aug 27, 2008 at 7:51 AM, K. El

[R] Seeking Code for Chaid or Similar

2008-08-27 Thread David Cobey
Quick disclaimer: I'm new to the list and I'm not sure if I'm sending this to the correct forum. If there is a better place for this questions, please let me know! Dear R List, I'm interested in modifying a regression tree algorithm to use the difference between a control and a dosed sample a

[R] Odp: Closest value

2008-08-27 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 27.08.2008 15:12:58: > Hello, > I have this command: > x.axis <- seq(from=0.5, to=4.5, length.out=13112) > How can I which of the x.axis components is the closest to a given > value, for example 3.2 E.g. which.min((x.axis-3.2)^2) Regards Petr > Best, > > Dani

Re: [R] Closest value

2008-08-27 Thread Doran, Harold
Maybe this which.min(abs(x.axis-3.2)) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dani Valverde > Sent: Wednesday, August 27, 2008 9:13 AM > To: R Help > Subject: [R] Closest value > > Hello, > I have this command: > x.axis <- seq(from=0.5, to

Re: [R] Closest value

2008-08-27 Thread Henrique Dallazuanna
Try this: x.axis[which.min(abs(x.axis - 3.2))] On Wed, Aug 27, 2008 at 10:12 AM, Dani Valverde <[EMAIL PROTECTED]> wrote: > Hello, > I have this command: > x.axis <- seq(from=0.5, to=4.5, length.out=13112) > How can I which of the x.axis components is the closest to a given value, > for example 3

Re: [R] Odd behavior in histogram breaks?

2008-08-27 Thread Rory.WINSTON
I think the answer is in this line in hist.default(): breaks <- pretty(range(x), n = breaks, min.n = 1) > length(pretty(c(1:1000), 100)) [1] 101 > length(pretty(c(1:1000), 200)) [1] 201 > length(pretty(c(1:1000), 250)) [1] 201 > length(pretty(c(1:1000), 300)) [1] 201 > length(pretty(c(1:1000),

[R] Closest value

2008-08-27 Thread Dani Valverde
Hello, I have this command: x.axis <- seq(from=0.5, to=4.5, length.out=13112) How can I which of the x.axis components is the closest to a given value, for example 3.2? Best, Dani -- Daniel Valverde Saubí Grup de Biologia Molecular de Llevats Facultat de Veterinària de la Universitat Autònoma

[R] Basic question about X11()

2008-08-27 Thread Groeneweg M (GEN)
Hello, I have a basic question about the display() function, but I can't find the answer easily. I am running R 2.7.16.0 on Suse linux 11.0 with KDE 4.0 I have several desktops, that I use at the same time, called Desktop 1, Desktop 2, etc. I want to open a X11() window in another desktop

[R] Com Object mystake

2008-08-27 Thread popsmelove
Hi, I've some problem to close a com Object that I've open. example : I create the Com Object Excel : fxl = comCreateObject("Excel.Application") To close I normally used gc(verbose = FALSE) -> silent This is ok with my first Pc, the Com Object Excel is kill, but for my second computer t

Re: [R] random error with lme for repeated measures anova

2008-08-27 Thread Mark Difford
Hi Jean-Pierre, A general comment is that I think you need to think more carefully about what you are trying to get out of your analysis. The random effects structure you are aiming for could be stretching your data a little thin. It might be a good idea to read through the archives of the R-sig

Re: [R] How to learn R language?

2008-08-27 Thread milton ruser
Dear Sagga, How give a look at the introduction material on Help / Manual (in pdf) / An introduction to R HTH miltinho astronauta brazil On 8/27/08, saggak <[EMAIL PROTECTED]> wrote: > > Hi! > > I am a post graduate in Statistics. I want to learn R language, but am very > confused as to how to

[R] speeding up multiple kriging predictions using fields package

2008-08-27 Thread Felix Bonowski
Sorry for the double post - I accidentially hit my the "send" button... We want to build a global optimizer for extremely expensive noisy objective functions based on physical measurements. Our approach is based on optimizing kriging response surfaces surface models. (as seen in www.cs.ubc.ca/~h

  1   2   >