Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread Dieter Menne
P.Dalgaard wrote: > > >> IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2); > > vehicles <- ifelse(TYPE=='TRUCK' & count=12, TRUCK+((CAR+BIKE)/2.2), NA) > > Read both versions to an audience, and you will have to admit that this is one of the cases where SAS is superior. D

Re: [R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread Dieter Menne
Tony Breyal wrote: > > Is there an alternative website which uses a similar structure to > google groups? I had a quick browse on the R Wiki > (http://wiki.r-project.org/rwiki/doku.php?id=links:links) but didn't > see a page with this sort of info. > > For reading and searching, nothing beat

Re: [R] nls vs nlme: parameter constraints

2009-06-22 Thread Dieter Menne
Manuel Morales wrote: > > I'm trying to fit a model like beta[trt]/(1+alpha*x) where the data > include some grouping factor. The problem is that the estimate for alpha > is undefined for some of the treatments - any value greater than 20 is > equally good and a step function would suffice. Ign

[R] curvedarrow (some graphics problem)

2009-06-22 Thread casperyc
Hi there, I just wonder how to draw this kind of picture... http://www.nabble.com/file/p24158796/b.jpg http://www.nabble.com/file/p24158796/a.jpg and this is what i have done % library(shape) library(diagram) curve(sin(x),bty="n",-8,8,yaxt="n",ylab="",xaxt="n",type="n",xlab="") axis(1,la

Re: [R] How to exclude insignificant intercepts using "step" function

2009-06-22 Thread David Winsemius
I think you should explain (to yourself primarily) what it means to have a non-significant intercept. If you can justify on a theoretic basis the exclusion of an intercept, then you may get more assistance. However, if you are just naively questing after some mythical concept of "significan

[R] How to exclude insignificant intercepts using "step" function

2009-06-22 Thread Chris Friedl
I posted this question way down at teh end of another thread realted to an error in step, but that was stupid since it really is another matter altogether. I should have posted it separately, as I have now done. The code below creates a data.frame comprising three marginally noisy surfaces. The c

Re: [R] Smart way to check if a column with certain name exists in a data.frame

2009-06-22 Thread Kingsford Jones
try: 'x' %in% colnames(df) hth, Kingsford On Mon, Jun 22, 2009 at 9:17 PM, R_help Help wrote: > Hi, > > I have a matrix or data.frame (df). When I would like to check if a column > named "x" exists, it becomes my habit to do the following: > > if (length(which(colnames(df)=="x"))>0) > > Is there

Re: [R] Roxygen to ignore a block of code?

2009-06-22 Thread Ian Fiske
I think that you want the the @nord tag which is in development. I am eager for the release of the Roxygen version with this tag too! See their mailing list on R-Forge for more details on this. cheers, Ian Ken-JP wrote: > > I don't want any zoo.Rd to be generated - I am a user of the library

[R] Smart way to check if a column with certain name exists in a data.frame

2009-06-22 Thread R_help Help
Hi, I have a matrix or data.frame (df). When I would like to check if a column named "x" exists, it becomes my habit to do the following: if (length(which(colnames(df)=="x"))>0) Is there any smarter way to do this? Thank you. adschai [[alternative HTML version deleted]] __

Re: [R] Error when using step

2009-06-22 Thread Chris Friedl
David Winsemius wrote: > > > ... > > Perhaps: > > by(data2, data2$grp, function(x) step(lm(model, data=x))) > > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > Perhaps ;) You know of course that this worked. It took a moment to understand the screen output bec

Re: [R] Error when using step

2009-06-22 Thread Chris Friedl
Dieter Menne wrote: > > ... > > Looks like an environment problem. I could not find a workaround quickly, > but you might have a look at > > http://finzi.psych.upenn.edu/R/Rhelp02a/archive/16599.html > > We call it "Ripley's Game" here, because variants of it can help you quite > often. >

Re: [R] p-values for ARIMA coefficients

2009-06-22 Thread Rolf Turner
On 23/06/2009, at 11:38 AM, m.gha...@yahoo.fr wrote: Hi, I'm a beginner using R and I'm modeling a time series with ARIMA. I'm looking for a way to determine the p-values of the coefficients of my model. Does ARIMA function return these values? or is there a way to determine them easily?

Re: [R] negation in grep

2009-06-22 Thread Gabor Grothendieck
Try txt[- grepl(pattern, txt)] txt[! grepl(pattern, txt)] On Mon, Jun 22, 2009 at 5:45 PM, orzack wrote: > Does anybody know how to negate a string in a grep command, i.e., what I > need is to return only strings that do NOT contain a second string anywhere > in the entire string. > > > for

Re: [R] p-values for ARIMA coefficients

2009-06-22 Thread Clifford Long
Hi Myriam, I'll take a stab at it, but can't offer elegance in the solution such as the more experienced R folks might deliver. I believe that the ARIMA function provides both point estimates and their standard errors for the coefficients. You can use these as you might a mean and standard error

Re: [R] negation in grep

2009-06-22 Thread Henrique Dallazuanna
You can try somthing about like this: setdiff(txt, grep("(oob|boo|\\w[^oo]\\w)", txt, value = TRUE)) On Mon, Jun 22, 2009 at 6:45 PM, orzack wrote: > Does anybody know how to negate a string in a grep command, i.e., what I > need is to return only strings that do NOT contain a second string an

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
David, Once again, many thanks for your very useful and timely feedback, and for your patience with my learning curve. Sincerely, Cliff On Mon, Jun 22, 2009 at 7:11 PM, David Winsemius wrote: > > On Jun 22, 2009, at 7:55 PM, David Winsemius wrote: > >> >> On Jun 22, 2009, at 6:16 PM, Clifford

Re: [R] problem reading in a csv file

2009-06-22 Thread jim holtman
Check for unbalanced quotes or comments. try: count.fields("RWM Shopper Tracker - RAW DATA - 22JUN09 - Copy.csv", quote='', comment.char='', sep=",") On Mon, Jun 22, 2009 at 9:38 PM, Chris Howden wrote: > Morning all, > > I'm trying to read in a csv file and R is having some problems. For some >

[R] problem reading in a csv file

2009-06-22 Thread Chris Howden
Morning all, I'm trying to read in a csv file and R is having some problems. For some reason its not 'seeing' all the columns for each row, and as such is not reading in the file. I've opened the file in EXCEL and I can't see any problems with it. All rows have the correct number of columns. The

Re: [R] coloring agnes plots

2009-06-22 Thread Raymond Wan
Hi all, Raymond Wan wrote: I am creating dendrograms using agnes and was wondering if it is possible to add color to the leaves (and just the leaves). I think I can answer my own question :-). Just found out about the A2R package, which seems to do what I am looking for... Seems to work f

Re: [R] easiest way to extend and recompile a package?

2009-06-22 Thread Michael
Thanks a lot! There is no MSVC project for R on Windows? On Mon, Jun 22, 2009 at 5:32 PM, Duncan Murdoch wrote: > On 22/06/2009 6:52 PM, Michael wrote: >> >> Hi all, >> >> I am thinking of extending a package by directly adding stuff to its >> C++ code. And then I have to recompile the package. >>

Re: [R] subset POSIXct

2009-06-22 Thread jim holtman
If you want to use regular expressions, try: > x V1 V2 V3 V4 1 1 2009-06-20 00:53:00 73 2 2 2009-06-20 01:08:00 73 3 3 2009-06-20 01:44:00 72 4 4 2009-06-20 01:53:00 71 5 5 2009-06-20 02:07:00 72 > x[grep(":53:", x$V3),] V1 V2 V3 V4 1 1 2009-06-20 00:53:00 73 4

Re: [R] subset POSIXct

2009-06-22 Thread Gabor Grothendieck
Try this: > Lines <- "dt,tf + 2009-06-20 00:53:00,73 + 2009-06-20 01:08:00,73 + 2009-06-20 01:44:00,72 + 2009-06-20 01:53:00,71 + 2009-06-20 02:07:00,72" > DF <- read.csv(textConnection(Lines), colClasses = c("POSIXct", "numeric")) > DF[format(DF$dt, "%M") == "53",] dt tf 1 2009

[R] negation in grep

2009-06-22 Thread orzack
Does anybody know how to negate a string in a grep command, i.e., what I need is to return only strings that do NOT contain a second string anywhere in the entire string. for txt <- c("boo","goo","doob","foo","boofoo") I need a grep command that returns strings with "oo" except when "b" is

Re: [R] subset POSIXct

2009-06-22 Thread Henrique Dallazuanna
Convert dt to POSIXct class: wtd$dt <- as.POSIXct(wtd$dt) subset(wtd, format(dt, '%M') == 53) On Mon, Jun 22, 2009 at 9:58 PM, Keith Jones wrote: > Hi, > > I have a data frame with two columns: dt and tf. The dt column is datetime > and the tf column is a temperature. > >

[R] p-values for ARIMA coefficients

2009-06-22 Thread m . gharbi
Hi, I'm a beginner using R and I'm modeling a time series with ARIMA. I'm looking for a way to determine the p-values of the coefficients of my model. Does ARIMA function return these values? or is there a way to determine them easily? Thanks for your answer Myriam

[R] subset POSIXct

2009-06-22 Thread Keith Jones
Hi, I have a data frame with two columns: dt and tf. The dt column is datetime and the tf column is a temperature. dt tf 1 2009-06-20 00:53:00 73 2 2009-06-20 01:08:00 73 3 2009-06-20 01:44:00 72 4 2009-06-20 01:53:00 71 5 2009-06-20 02:07:00 72 ... I need a

Re: [R] easiest way to extend and recompile a package?

2009-06-22 Thread Duncan Murdoch
On 22/06/2009 6:52 PM, Michael wrote: Hi all, I am thinking of extending a package by directly adding stuff to its C++ code. And then I have to recompile the package. Do I have to download the whole R source repository, in order to do the recompilation? What is the minimal setup requirement for

Re: [R] Automatically Adding Categories

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 7:56 PM, Jeffrey Edgington wrote: Greetings, I have two files which contain responses to a series of multiple choice questions. One file contains responses before an "intervention" and the other contains the responses afterward. There were three possible responses to

Re: [R] Automatically Adding Categories

2009-06-22 Thread Henrique Dallazuanna
Try this: table(factor(pre, levels = c("D", "F", "T")), factor(post, levels = c("D", "F", "T"))) On Mon, Jun 22, 2009 at 8:56 PM, Jeffrey Edgington wrote: > Greetings, > > I have two files which contain responses to a series of multiple choice > questions. One > file contains responses

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 7:55 PM, David Winsemius wrote: On Jun 22, 2009, at 6:16 PM, Clifford Long wrote: Hi David, I appreciate the advice. I had coerced 'list4' to as.list, but forgot to specify "list=()" in the call to aggregate. I made the correction, and now get the following: slo

[R] Automatically Adding Categories

2009-06-22 Thread Jeffrey Edgington
Greetings, I have two files which contain responses to a series of multiple choice questions. One file contains responses before an "intervention" and the other contains the responses afterward. There were three possible responses to each question: D, F, T (for Don't Know, False, and Tru

Re: [R] Calculating "row standard deviations"

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 6:19 PM, Mark Na wrote: Hi R-helpers, I have been struggling with calculating row and column statistics, e.g. standard deviation. I know that datac$Mean<-rowMeans(datac,na.rm=TRUE) will give me row means. I have tried to replicate those row means with the apply function

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 6:16 PM, Clifford Long wrote: Hi David, I appreciate the advice. I had coerced 'list4' to as.list, but forgot to specify "list=()" in the call to aggregate. I made the correction, and now get the following: slope.mult = simarray[,1] adj.slope.value = simarray[,2] adj.sl

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread Gabor Grothendieck
Try this: > unname(t(do.call(cbind, lapply(a, ts [,1] [,2] [,3] [,4] [1,] "a" "b" "c" NA [2,] "d" "e" NA NA [3,] "f" "g" "h" "i" On Mon, Jun 22, 2009 at 7:15 PM, Kenneth Takagi wrote: > Hi, > > > > I have a list made up of character strings with each item a different > length

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread Kenneth Takagi
Thanks for all the feedback; I found a previous post covering this question: https://stat.ethz.ch/pipermail/r-help/2009-February/189232.html Problem solved! Kenneth Takagi kat...@psu.edu From: jim holtman [mailto:jholt...@gmail.com] Sent: Monda

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread Henrique Dallazuanna
Try this: matrix(unlist(lapply(a, '[', 1:max(sapply(a, length, ncol = 4, byrow = TRUE) or do.call(rbind, lapply(a, '[', 1:max(sapply(a, length On Mon, Jun 22, 2009 at 8:15 PM, Kenneth Takagi wrote: > Hi, > > > > I have a list made up of character strings with each item a different >

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread jim holtman
try this: > a [[1]] [1] "a" "b" "c" [[2]] [1] "d" "e" [[3]] [1] "f" "g" "h" "i" > # find max row length > rowMax <- max(sapply(a, length)) > # now create output matrix by lengthening rows > do.call(rbind, lapply(a, function(x){ + length(x) <- rowMax + x + })) [,1] [,2] [,3] [,4] [1,]

[R] Convert "ragged" list to matrix

2009-06-22 Thread Kenneth Takagi
Hi, I have a list made up of character strings with each item a different length (each item is between 1and 6 strings long). Is there a way to convert a "ragged" list to a matrix such that each item is its own row? Here is a simple example: a=list(); a[[1]] = c("a", "b", "c"); a[[2]] = c

[R] reading data in rjags

2009-06-22 Thread David Cross
I am trying to run jags.model and need the data read in a suitable format. The package (rjags) documentation describes "read.data", while the "classic-bugs" examples use "read.jagsdata". I am running R (R 2.8.1) on a PowerBook G4 (Mac OS X 10.5.7), and my installation recognizes neither read

Re: [R] Recursive partitioning algorithms in R vs. alia

2009-06-22 Thread jude.ryan
I have used all 3 packages for decision trees (SAS/EM, CART and R). As another user on the list commented, the algorithms CART uses are proprietary. I also know that since the algorithms are proprietary, the decision tree that you get from SAS is based on a "slightly different" algorithm so as to n

[R] easiest way to extend and recompile a package?

2009-06-22 Thread Michael
Hi all, I am thinking of extending a package by directly adding stuff to its C++ code. And then I have to recompile the package. Do I have to download the whole R source repository, in order to do the recompilation? What is the minimal setup requirement for such a recompilation? I am using MSVC

Re: [R] Calculating "row standard deviations"

2009-06-22 Thread Peter Dalgaard
Mark Na wrote: Hi R-helpers, I have been struggling with calculating row and column statistics, e.g. standard deviation. I know that datac$Mean<-rowMeans(datac,na.rm=TRUE) will give me row means. I have tried to replicate those row means with the apply function: datac$Mean2<-apply(datac,2,m

Re: [R] Calculating "row standard deviations"

2009-06-22 Thread Peter Alspach
Tena koe Mark I think you might want apply(datac, 1, mean) i.e., apply the function to the first dimension (rows) rather than the second (columns). HTH ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Ma

Re: [R] lattice logaritmic scale (basis "e" ), rewriting labels using xscale.component

2009-06-22 Thread Katharina May
thanks Deepayan, that works great! 2009/6/19 Deepayan Sarkar : > On 6/18/09, Katharina May wrote: >> Hi there, >> >>  sorry for troubling everybody once again, I've got a problem rewriting >>  Sarkar's function for >>  rewriting the tick locations in a logaritmic way (s. >>  http://lmdvr.r-forge

[R] Calculating "row standard deviations"

2009-06-22 Thread Mark Na
Hi R-helpers, I have been struggling with calculating row and column statistics, e.g. standard deviation. I know that > datac$Mean<-rowMeans(datac,na.rm=TRUE) will give me row means. I have tried to replicate those row means with the apply function: > datac$Mean2<-apply(datac,2,mean) so that I

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
Hi David, I appreciate the advice. I had coerced 'list4' to as.list, but forgot to specify "list=()" in the call to aggregate. I made the correction, and now get the following: > slope.mult = simarray[,1] > adj.slope.value = simarray[,2] > adj.slope.level = simarray[,2] > qc.run.violation = sim

[R] question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
Hi R-list, I'll apologize in advance for (1) the wordiness of my note (not sure how to avoid it) and (2) any deficiencies on my part that lead to my difficulties. I have an application with several stages that is meant to simulate and explore different scenarios with respect to product sales (in

Re: [R] maps maptools

2009-06-22 Thread Kingsford Jones
Hi John, The SIDS examples in the spatial graphics gallery may be helpful: http://r-spatial.sourceforge.net/gallery/ For a general reference, see Applied Spatial Data Analysis with R. Note that the book's webpage includes figures with code http://www.asdar-book.org/ There's also the spatial Ta

[R] nls vs nlme: parameter constraints

2009-06-22 Thread Manuel Morales
Hello list, I'm trying to fit a model like beta[trt]/(1+alpha*x) where the data include some grouping factor. The problem is that the estimate for alpha is undefined for some of the treatments - any value greater than 20 is equally good and a step function would suffice. Ignoring the grouping stru

Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread Thomas Lumley
On Mon, 22 Jun 2009, charles78 wrote: It is not the case as you described. In any case, the total area should be 1 and labeled fraction on y axis should be far less than 1, since I have more than 1 data points. I also test differerent bin size by change the break. Try reading Greg's res

Re: [R] Shapiro.test on data frame

2009-06-22 Thread Dylan Beaudette
On Monday 22 June 2009, Gonzalo Quiroga wrote: > Hi, I need help to perform a Shapiro.test on a data frame, I know that > this test works only with vector but I guess there most be a way to > permor it on a data frame instead of vactor by vector (i.e. I've got 40 > variables to analyze and its kind

Re: [R] Problem with storing a sequence of lmer() model fit into a list

2009-06-22 Thread Rolf Turner
(a) Your code is unnecessarily convoluted. (b) The example of things *not* working is not reproducible. (Read the posting guide!!!) (c) Nonetheless the phenomenon you describe is weird/interesting. On my system, the following runs without error: fit.list <- NULL a <- factor(rep(1:10,each=

Re: [R] Shapiro.test on data frame

2009-06-22 Thread Henrique Dallazuanna
Try this: x <- data.frame(A = runif(10), B = rnorm(10)) lapply(x, shapiro.test) On Mon, Jun 22, 2009 at 3:15 PM, Gonzalo Quiroga wrote: > Hi, I need help to perform a Shapiro.test on a data frame, I know that > this test works only with vector but I guess there most be a way to > permor it on a

Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread charles78
It is not the case as you described. In any case, the total area should be 1 and labeled fraction on y axis should be far less than 1, since I have more than 1 data points. I also test differerent bin size by change the break. I draw the graph using only 1 group, the same result was obtaine

Re: [R] User defined GLM?

2009-06-22 Thread francogrex
Emmanuel Charpentier wrote: > > I do not understand the problem as stated. if x[i] and n[i] are known, > and unless sum(n)=0, your dataset reduces to a set of nrow(dataset) > independent linear equations with nrow(dataset) unknowns (the beta[i]), > whose solution is trivially beta[i]=log(x[i]/n[

[R] Shapiro.test on data frame

2009-06-22 Thread Gonzalo Quiroga
Hi, I need help to perform a Shapiro.test on a data frame, I know that this test works only with vector but I guess there most be a way to permor it on a data frame instead of vactor by vector (i.e. I've got 40 variables to analyze and its kinda annoying to do it one by one) Thanks to anyone that

[R] maps maptools

2009-06-22 Thread John Lipkins
Hey, A basic question. Is there anyone that knows a good text on using the R packages map and maptools for R? I have read the references for both but having trouble getting started. What I want to do is to load a map (.shp file) and display statistics on this maps using colours. Thanks in advanc

Re: [R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread David M Smith
Gmane has already been mentioned, and you might also want to consider Nabble -- judging from my referrer logs many people use it to read r-help. If you use Gmail, you might also want to consider subscribing to the list and using a simple filter. Details and links at blog.revolution-computing.com, h

Re: [R] User defined GLM?

2009-06-22 Thread Emmanuel Charpentier
Le lundi 22 juin 2009 à 09:35 -0700, francogrex a écrit : > Hello, I have this generalized linear formula: > log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i] I do not understand the problem as stated. if x[i] and n[i] are known, and unless sum(n)=0, your dataset reduces to a set of nrow(dataset) indepe

Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread Peter Dalgaard
Mark Na wrote: Dear R-helpers, I am helping a SAS user run some analyses in R that she cannot do in SAS and she is complaining about R's peculiar (to her!) way of recoding variables. In particular, she is wondering if there is an R package that allows this kind of SAS recoding: IF TYPE='TRUCK'

Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread Chuck Cleland
On 6/22/2009 2:27 PM, Mark Na wrote: > Dear R-helpers, > > I am helping a SAS user run some analyses in R that she cannot do in > SAS and she is complaining about R's peculiar (to her!) way of > recoding variables. In particular, she is wondering if there is an R > package that allows this kind of

Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 2:27 PM, Mark Na wrote: Dear R-helpers, I am helping a SAS user run some analyses in R that she cannot do in SAS and she is complaining about R's peculiar (to her!) way of recoding variables. In particular, she is wondering if there is an R package that allows this kind of

[R] Problem with storing a sequence of lmer() model fit into a list

2009-06-22 Thread Sean Zhang
Dear R-helpers: May I ask a question related to storing a number of lmer model fit into a list. Basically, I have a for-loop (see towards the bottom of this email) in the loop, I am very sure that the i-th model fit (i.e.,fit_i) is successfully generated and the character string (i.e., tmp_i) is c

[R] SAS-like method of recoding variables?

2009-06-22 Thread Mark Na
Dear R-helpers, I am helping a SAS user run some analyses in R that she cannot do in SAS and she is complaining about R's peculiar (to her!) way of recoding variables. In particular, she is wondering if there is an R package that allows this kind of SAS recoding: IF TYPE='TRUCK' and count=12 THEN

Re: [R] User defined GLM?

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 12:35 PM, francogrex wrote: Hello, I have this generalized linear formula: log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i] where the the x[i] and the n[i] are known. Is there a way to program the GLM procedure to input the formula above and get the beta[i] estimates? If not t

Re: [R] Convert NA to '.'

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 1:21 PM, Jorge Ivan Velez wrote: Hi David, It works for me when handling data frames mixing characters and numeric by using either print() or a function called "foo": # Some data x <- c("A", "B", "C", 3.5, 1, 0, NA, "a character",NA, "another character") mydata <- dat

Re: [R] Convert NA to '.'

2009-06-22 Thread Jorge Ivan Velez
Hi David, It works for me when handling data frames mixing characters and numeric by using either print() or a function called "foo": # Some data x <- c("A", "B", "C", 3.5, 1, 0, NA, "a character",NA, "another character") mydata <- data.frame(x = x, y = sample(x)) mydata # Option 1: print()ing pr

Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread Greg Snow
When freq=FALSE then the y axis is not the proportion in each group (what I am assuming you mean by fraction), but rather is scaled so that the total area of the histogram is 1 (making comparing to theoretical densities easier). If all the data values are between 0 and 1, then the height of at

[R] User defined GLM?

2009-06-22 Thread francogrex
Hello, I have this generalized linear formula: log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i] where the the x[i] and the n[i] are known. Is there a way to program the GLM procedure to input the formula above and get the beta[i] estimates? If not the GLM is there another procedure to do that? The aim

[R] Problems trying to run R2jags on a Linux Cluster

2009-06-22 Thread Luwis Tapiwa Diya
Dear R users, I am having problems in trying to run R2jags on a Linux Cluster. When I tried to run the model given in the R2jags manual I get the following error error message: Error in FUN(X[[3L]], ...) : object 'J' not found Can any one help me with this problem? Looking to hear from you all.

Re: [R] The gradient of a multivariate normal density with respect toits parameters

2009-06-22 Thread Ravi Varadhan
Karl, You may want to look at the paper by Dwyer on "Some applications of matrix derivatives in multivariate analysis" (JASA 1967), especially the Table 2 on p. 617. Ravi. --- Ravi Varadhan, Ph.D. Assistant Profe

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Martin Maechler
> "DM" == Duncan Murdoch > on Mon, 22 Jun 2009 09:41:12 -0400 writes: DM> On 6/22/2009 9:23 AM, Tobias Verbeke wrote: >> On Mon, Jun 22, 2009 at 2:18 PM, Douglas Bates wrote: >>> On Mon, Jun 22, 2009 at 7:12 AM, Martin >>> Maechler wrote: > "TobiasV" == To

[R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread charles78
I have been trying to draw histogram for my manscript and found some strange things that I could not figure out why. Using the same code listed below I have successfully draw histograms for a few figures with fraction labeled on Y axis less than 1 (acturally between 0 to 0.1). But one dataset gi

Re: [R] The gradient of a multivariate normal density with respect to its parameters

2009-06-22 Thread Karl Ove Hufthammer
Ravi Varadhan skreiv: I am not aware of any. May I ask what your purpose is? You don't really need this if you are going to use it in optimization, since most optimizers use a simple finite-difference approximation if you don't provide the gradient. Using the numerical approximation from "numD

Re: [R] Convert NA to '.'

2009-06-22 Thread David_D
Jorge, Thanks a lot for your reply. It's indeed working in this case. However, with data frames mixing numeric and character is not working anymore. Morever I am working with many variables and I don't want to modify them. What I would really appreciate is a global option (in the Rprofile?) that

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 9:23 AM, Tobias Verbeke wrote: On Mon, Jun 22, 2009 at 2:18 PM, Douglas Bates wrote: On Mon, Jun 22, 2009 at 7:12 AM, Martin Maechler wrote: "TobiasV" == Tobias Verbeke on Sun, 21 Jun 2009 08:25:07 +0200 writes: TobiasV> Hi Ken, >> I have been using R for a while. Rec

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 12:04 PM, Clifford Long wrote: Hi R-list, I'll apologize in advance for (1) the wordiness of my note (not sure how to avoid it) and (2) any deficiencies on my part that lead to my difficulties. I have an application with several stages that is meant to simulate and explore

[R] Fwd: question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
Resending, as am not sure about the original "To:" address. Sorry for any redundancy. - Cliff -- Forwarded message -- From: Clifford Long Date: Mon, Jun 22, 2009 at 11:04 AM Subject: question about using _apply and/or aggregate functions To: r-h...@lists.r-project.org Hi R-lis

Re: [R] what's the R command to make the following?

2009-06-22 Thread Gabor Grothendieck
There are many ways to do this in R. See R News 4/1 for info on dates. Here is one method: > library(chron) > mdy <- month.day.year("05/16/2008") > mdy $month [1] 5 $day [1] 16 $year [1] 2008 > mdy$month [1] 5 On Mon, Jun 22, 2009 at 11:36 AM, Jack Luo wrote: > Hi, > > I have a simple questi

[R] standard error and p-value for the estimated parameter in AR model

2009-06-22 Thread FMH
Dear All, I used an  AR(1) model to explain the process of the stationary residual and have used an 'ar' command in R. From the results, i tried to extract the standard error and p-value for the estimated parameter, but unfortunately, i never find any way to extract  it from the output. What

Re: [R] what's the R command to make the following?

2009-06-22 Thread jim holtman
Couple of choices depending on what you want to do with the data: > x <- as.POSIXct("05/16/2008", format="%m/%d/%Y") # if you want to use the date > format(x, "%d") # day [1] "16" > format(x, "%m") # month [1] "05" > format(x, "%Y") # year [1] "2008" > # or > y <- strsplit("05/16/2008", '/') # t

[R] what's the R command to make the following?

2009-06-22 Thread Jack Luo
Hi, I have a simple question, suppose I have the date "05/16/2008", what would be the command to get the month, day and year? Thanks, -Jack [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

[R] GAM function with interaction

2009-06-22 Thread Paul Simonin
Hello R Users, I have a question regarding fitting a model with GAM{mgcv}. I have data from several predictor (X) variables I wish to use to develop a model to predict one Y variable. I am working with ecological data, so have data collected many times (about 20) over the course of two years. P

Re: [R] New line operator in mtext

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 10:30 AM, Steve Murray wrote: Thanks again for a very useful comment. That seems to have separated the text and put it onto separate lines. However, whilst this results in the text being centralised in relation to the axis, it means that the lower line is left-justified in relatio

Re: [R] Error when using step

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 4:08 AM, Dieter Menne wrote: Chris Friedl gmail.com> writes: I have two questions about the built-in function step. Ultimately I want to apply a lm fitting and subsequent step procedure to thousands of data sets groups by a factor defined as a unique ID. Q1. The code

Re: [R] The gradient of a multivariate normal density with respect to its parameters

2009-06-22 Thread Ravi Varadhan
Hi Karl, I am not aware of any. May I ask what your purpose is? You don't really need this if you are going to use it in optimization, since most optimizers use a simple finite-difference approximation if you don't provide the gradient. Using the numerical approximation from "numDeriv" will be

Re: [R] New line operator in mtext

2009-06-22 Thread Steve Murray
Thanks again for a very useful comment. That seems to have separated the text and put it onto separate lines. However, whilst this results in the text being centralised in relation to the axis, it means that the lower line is left-justified in relation to the upper line, rather than being cent

Re: [R] problem with checking wether file is present or not

2009-06-22 Thread Don MacQueen
What error is it giving? Please include the exact error. What happens if you do this: if (file.exists(findings)) cat('File',findings,'exists\n') else cat('File',findings,not found\n') Your description suggests that you are using 'if' expression inside a loop. If that is the case, try i

[R] Eigen value calculation

2009-06-22 Thread RON70
Hi all, Eigen vectors obtained from the function eigen() are ortho-normal? I see the documentation however there is no formal mention on that. If no, then is there any direct function to do the same? -- View this message in context: http://www.nabble.com/Eigen-value-calculation-tp24147807p241478

[R] The gradient of a multivariate normal density with respect to its parameters

2009-06-22 Thread Karl Ove Hufthammer
Does anybody know of a function that implements the derivative (gradient) of the multivariate normal density with respect to the *parameters*? It’s easy enough to implement myself, but I’d like to avoid reinventing the wheel (with some bugs) if possible. Here’s a simple example of the result I’

Re: [R] Lattice group colors?

2009-06-22 Thread Sundar Dorai-Raj
Look at show.settings() and str(trellis.par.get()). This will show you what the default settings are. The group colors are set by the superpose.* elements (e.g. superpose.line is for group lines). To set them, I usually create a list and pass it to par.settings. For example, my.theme <- list(super

[R] Lattice group colors?

2009-06-22 Thread Fredrik Karlsson
Dear list, I have been struggling to find how I would go about changing the bakground colors of groups in a lattice barchart in a way so that the auto.key generated also does the right thing and pick it up for the key. I have used the "col" argument (which I guess is sent to par()) in a way so tha

Re: [R] How to make try to catch warnings in logistic glm

2009-06-22 Thread Dieter Menne
Fredrik Nilsson-5 wrote: > >>From an earlier post I got the impression that one could promote > warnings from a glm to errors (presumably by putting > options(warn=1)?), then try() would flag them as errors. I’ve spent > half the day trying to do this, but no luck. Do you have an explicit > sol

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Tobias Verbeke
On Mon, Jun 22, 2009 at 2:18 PM, Douglas Bates wrote: > On Mon, Jun 22, 2009 at 7:12 AM, Martin > Maechler wrote: >>> "TobiasV" == Tobias Verbeke >>>     on Sun, 21 Jun 2009 08:25:07 +0200 writes: >> >>    TobiasV> Hi Ken, >>    >> I have been using R for a while.  Recently, I have begun c

Re: [R] xyplot: subscripts, groups and subset

2009-06-22 Thread Dieter Menne
Auty, Dave forestry.gsi.gov.uk> writes: > > I'm running the following code to produce lattice plots of microfibril > angle versus ring number in Scots pine. There are 12 trees and 5 sample > positions ("Position") in each tree: > > xyplot(MFA ~ RN | Tree, data = MFA.data, > >groups =

[R] How to make try to catch warnings in logistic glm

2009-06-22 Thread Fredrik Nilsson
Dear list, >From an earlier post I got the impression that one could promote warnings from a glm to errors (presumably by putting options(warn=1)?), then try() would flag them as errors. I’ve spent half the day trying to do this, but no luck. Do you have an explicit solution? My problems is that

Re: [R] Convert NA to '.'

2009-06-22 Thread Jorge Ivan Velez
Dear David, Try this: x <- c("A", "B", "C", NA) x[is.na(x)] <- "." x HTH, Jorge On Mon, Jun 22, 2009 at 2:11 AM, David_D wrote: > > Dear R-users, > > For reporting purpose (using Sweave and LaTeX), I am creating complex > tables > with the cat function such as > > > x<-c("A", "B", "C", NA) >

Re: [R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 7:23 AM, Tony Breyal wrote: Greetings, I usually read this mailing list through google groups (http://groups.google.com/group/r-help-archive), but when I opened the webpage this morning it said: "The group named r-help-archive has been removed because it violated Google's Terms Of S

Re: [R] New line operator in mtext

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 7:58 AM, Steve Murray wrote: Thanks for the response, however, whilst this eliminates the 'new line' character from appearing, it doesn't actually cause a new line to be printed! Instead, I have the last few characters of the first character string overlapping with the first few c

[R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread Tony Breyal
Greetings, I usually read this mailing list through google groups (http://groups.google.com/group/r-help-archive), but when I opened the webpage this morning it said: "The group named r-help-archive has been removed because it violated Google's Terms Of Service." Is there an alternative website w

  1   2   >