Re: [R] How to estimate confidential intervals for the derivatives of cubic smoothing spline

2011-08-05 Thread Simon Wood
If you can put up with using gam in package mgcv to fit your splines then you can get SEs on the spline derivatives as shown in the final example in the help file for plot.gam. (gam uses reduced rank smoothing splines, so you may need to up the `k' parameter for the smooth terms to ensure that

[R] rJava on Debian squeeze (or other versions of Linux)?

2011-08-05 Thread Barnet Wagman
Has anyone successfully installed rJava on Debian squeeze (or any other version of linux)? I keep getting the ... (JDK) is missing or not registered in R error message when installing the package. I've tried running 'R CMD javareconf', setting JAVA_HOME and editing /etc/R/ldpaths by hand

Re: [R] .dta from e-mail

2011-08-05 Thread adasgu...@araastat.com
.dta is usually a State data file. Thou would be able to read it in R with the function read.dta in the package foreign. Abhijit Sent from my HTC Aria™ smartphone on AT&T - Reply message - From: "Gabriel Cepaluni" Date: Fri, Aug 5, 2011 9:35 pm Subject: [R] .dta from e-mail To: I

Re: [R] .dta from e-mail

2011-08-05 Thread Jeff Newmiller
dta is a very generic extension, so that is not enough information. I recommend saving it and opening it with a text editor. If it is binary, you will need to ask the sender how to open it. --- Jeff Newmiller The . .

Re: [R] .dta from e-mail

2011-08-05 Thread Dennis Murphy
library('foreign') d <- read.dta('yourfile.dta') read.dta() reads in files having "Stata version 5–11 binary format into a data frame". Make sure you read the help page ?read.dta after you load the foreign package and before you try to read in the data. HTH, Dennis On Fri, Aug 5, 2011 at 6:35 PM

Re: [R] jagged array (matrices of different dimensions)

2011-08-05 Thread Joshua Wiley
Dear Stephanie, At first I just tried typing and ended up with a butcchered frankenstein of a solution. Then I thought about (novel, right? ;) and realized several of the steps in your for loop could be simplified substantially, namely, the last step is just: exp(- (0:(i - k))) Then I just pad t

Re: [R] Translate Sine Function in R?

2011-08-05 Thread Katrina Bennett
Sorry, I sent that e-mail too soon. I realize you called "x.seq" just "x" in the data frame. Yes, this is a great way to fit these data. I think from this that I can probably now work with the related function of the line to get my minimum and maximum values. Thanks for your assistance! Katrina

[R] .dta from e-mail

2011-08-05 Thread Gabriel Cepaluni
I got a .dta extension file by e-mail, but I can't save it in my computer and open it in R. How can I do it? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

[R] How set lm() to don't return NA in summary()?

2011-08-05 Thread Walmes Zeviani
Hi, I've data from an incomplete fatorial design. One level of a factor doesn't has the levels of the other. When I use lm(), the summary() return NA for that non estimable parameters. Ok, I understant it. But I use contrast::contrast(), gmodels::estimable(), multcomp::glht() and all these fail wh

Re: [R] plotting many unique colors with categorical data

2011-08-05 Thread Tyler Rinker
col=sample(colors()[-1], ncol(dataframe), replace = FALSE) This may help but since it's randomized it's a crap shoot but the colors are likely to be more distinct. > Date: Fri, 5 Aug 2011 15:38:57 -0400 > From: sarah.gos...@gmail.com > To: rloise...@usgs.gov > CC: r-help@r-p

Re: [R] Sweave - landscape figure

2011-08-05 Thread Duncan Mackay
Hi Eduado It you may get some info for multiple graphs in latex with Keith Reckdahl 2006 Using Imported Graphics in LATEX and pdfLATEX there may be some later version Duncan At 03:16 06/08/2011, you wrote: Hi there This is what I did: <>= print(xyplot(data.flow,xlab="Time",ylab="Flow")) @

[R] jagged array (matrices of different dimensions)

2011-08-05 Thread Kliethermes, Stephanie A
Dear all, I am having trouble creating a "jagged array" in R. I have found no commentary on how to do it in the help files, but maybe I am misunderstanding the purpose of some of the array functions (e.g. tapply). I am using a longitudinal dataset where each individual has a different numb

Re: [R] Translate Sine Function in R?

2011-08-05 Thread Katrina Bennett
Hi Petr, Thank you for the response. I am not familiar with the nls package. I am interested in obtaining a function to represent the relationship observed in "dat" over x.seq (days) so that I can calculate a minimum and maximum of the function. In the example below, it seems like you are using a

[R] How to estimate confidential intervals for the derivatives of cubic smoothing spline

2011-08-05 Thread Bingzhang Chen
Dear all, I want to use smooth.spline to construct a cubic smoothing spline and its first derivative to my data. However, the predict.smooth.spline does not seem to provide a SE for both the fitted values and their derivatives. How should I calculate it? Thank you very much, Bingzhang

Re: [R] Sweave - landscape figure

2011-08-05 Thread Duncan Mackay
Hi The are three places where the size of the graphs can be customised 1 Sweave with options 2 R in the device 3 Latex specifying dimensions or set scale=magnification. However if your are using it in a float it there is a maximum size depending on the number of floats in a page. see \floatsep an

Re: [R] Displaying a summary in graphics

2011-08-05 Thread Aram Fingal
Thanks to both you and Greg. It would have taken a very long time for me to figure that out on my own. Aram On Aug 5, 2011, at 3:54 PM, Jean V Adams wrote: > > Using Greg's idea about the capture.output() function, I got this example to > work in R for Windows. > > x <- 1:20 > y <- rnorm

Re: [R] Question on RNG

2011-08-05 Thread Duncan Murdoch
On 11-08-05 4:04 PM, Ron Michael wrote: Thanks Duncan for your reply. However I could not understand this: 'R provides ways to call its RNGs from C'. Can you be more detailed what I need to do here? If you were writing in C, then instructions would be in the Writing R Extensions manual (in se

Re: [R] integral depending on a parameter

2011-08-05 Thread Rolf Turner
On 06/08/11 08:17, brunero liseo wrote: Is it possible to use the "integrate" function when it depends on a parameter? in other words can i get something like f(y) = integrate (g(x,y))? If not, how else can I get that? thanks in advance This really boils down to ``RTFM''. The help for "integr

Re: [R] Question on RNG

2011-08-05 Thread Barry Rowlingson
On Fri, Aug 5, 2011 at 8:54 PM, Duncan Murdoch wrote: > As far as I know, Microsoft doesn't publish the code for their RNG. Naming > it is not enough -- implementations that differ in subtle details will give > different streams. Sometimes these subtle software differences are known by another

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread peter dalgaard
On Aug 5, 2011, at 23:16 , Paul Smith wrote: > Thanks, Frank. The following piece of code generate data, which > exhibit the problem I reported: > > - > set.seed(123) > intercept = -1.32 > beta = 1.36 > xtest = rbinom(1000,1,0.5) > linpred = intercept + xt

Re: [R] If find x, then y, else do nothing

2011-08-05 Thread Joshua Wiley
On Fri, Aug 5, 2011 at 2:34 PM, Edward Patzelt wrote: > > The problem is that we were using a task where some subjects responded with > "1 & 2" and some responded with "2 & 4".  So there is overlap for 2 because > it means stimulus 1 for subject 1 and it means stimulus 2 for subject 2. > > subje

Re: [R] If find x, then y, else do nothing

2011-08-05 Thread Edward Patzelt
The problem is that we were using a task where some subjects responded with "1 & 2" and some responded with "2 & 4". So there is overlap for 2 because it means stimulus 1 for subject 1 and it means stimulus 2 for subject 2. subject subject_1 1 subject_1 1 subject_1 1 subject_1 2 subject

Re: [R] If find x, then y, else do nothing

2011-08-05 Thread Joshua Wiley
Hi Edward, You can try something like: u.ppl <- unique(init.dat1$grid) l.ppl <- ifelse(grepl(4, init.dat1$Slide1_RESP), 2, init.dat1$Slide1_RESP) Note that this is not exact as you have not provided a reproducible example. I am not exactly sure how you are putting 1 for 2 and 2

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
Thanks, Frank. The following piece of code generate data, which exhibit the problem I reported: - set.seed(123) intercept = -1.32 beta = 1.36 xtest = rbinom(1000,1,0.5) linpred = intercept + xtest*beta prob = exp(linpred)/(1 + exp(linpred)) runis = runif(100

[R] If find x, then y, else do nothing

2011-08-05 Thread Edward Patzelt
I want to write code that says "If you find an element equal to 4 in this vector for each person in the data set tested separately, then put in 1 for 2 and 2 for 4, else leave the variable as is" u.ppl <- (unique(init.dat1$grid)) l.ppl <- length(u.ppl) for (i in 1:l.ppl) {

[R] integral depending on a parameter

2011-08-05 Thread brunero liseo
Is it possible to use the "integrate" function when it depends on a parameter? in other words can i get something like f(y) = integrate (g(x,y))? If not, how else can I get that? thanks in advance BL -- View this message in context: http://r.789695.n4.nabble.com/integral-depending-on-a-paramete

Re: [R] Text annotation of a graph

2011-08-05 Thread Lisa
Thank you. I will try this. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Text-annotation-of-a-graph-tp3719775p3722163.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://sta

Re: [R] Question on RNG

2011-08-05 Thread Ron Michael
Thanks Duncan for your reply. However I could not understand this: 'R provides ways to call its RNGs from C'. Can you be more detailed what I need to do here?   Thanks, - Original Message - From: Duncan Murdoch To: Ron Michael Cc: "r-help@r-project.org" Sent: Saturday, 6 August 2011

Re: [R] Displaying a summary in graphics

2011-08-05 Thread Jean V Adams
Using Greg's idea about the capture.output() function, I got this example to work in R for Windows. x <- 1:20 y <- rnorm(20) fit <- lm(y ~ x) smry <- capture.output(summary(fit)) smry2 <- paste(smry, collapse="\n") par(oma=c(10, 0, 0, 0)) plot(x, y) mtext(side=1, outer=TRUE, text=smry2, cex=0.7

Re: [R] Question on RNG

2011-08-05 Thread Duncan Murdoch
On 11-08-05 2:17 PM, Ron Michael wrote: Hi all, I have happened to work on MS .NET for sometime now, and I found that this language offers RNG what is called as Donald E. Knuth's subtractive random number generator algorithm (found here: http://msdn.microsoft.com/en-us/library/system.random.as

Re: [R] plotting many unique colors with categorical data

2011-08-05 Thread Sarah Goslee
That's far too many to easily distinguish by color, especially if they need to be distinct, and not levels within a larger class. For the latter, you could get by with say 10 shades of red, 10 shades of blue, etc for related factors. But it doesn't sound like that's what you have. I don't think the

Re: [R] plotting many unique colors with categorical data

2011-08-05 Thread jim holtman
If you go to color brewer (http://colorbrewer2.org/) they don't have any color sequences above about 12 to provide separation. 75 is probably way too many, especially considering that a portion of the population is color blind and other can not see some of the gradations. You can create a pallet

Re: [R] Text annotation of a graph

2011-08-05 Thread Greg Snow
Look at the spread.labs function in the TeachingDemos package, it may do what you want (see the examples). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto

Re: [R] Displaying a summary in graphics

2011-08-05 Thread Greg Snow
Use the capture.output function with printing the summary of the anova, then pass that to your function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r

Re: [R] a question on list manipulation

2011-08-05 Thread Greg Snow
Here is one approach, whether it is better than the basic loop or not is up to you: > x <- list(A=c("d", "e", "f"), B=c("d", "e"), C=c("d")) > > tmp <- unlist(x) > tmp2 <- sub( '[0-9]+$', '', names(tmp) ) > > x.new <- split( tmp2, tmp ) > x.new $d [1] "A" "B" "C" $e [1] "A" "B" $f [1] "A" O

[R] Question on RNG

2011-08-05 Thread Ron Michael
Hi all, I have happened to work on MS .NET for sometime now, and I found that this language offers RNG what is called as Donald E. Knuth's subtractive random number generator algorithm (found here: http://msdn.microsoft.com/en-us/library/system.random.aspx#Y12).   Here I was wondering whether R

[R] plotting many unique colors with categorical data

2011-08-05 Thread SavageMaDaMe
Hi- I am trying to plot a matrix of categorical values across time using color to represent each individual factor. For example: 1982 1983 1984 1985 1986 1987 119 19 68 68 19 19 68 268 68 19 19 68 68 19 326 26 34 34 26 26 26 457 34

Re: [R] Text annotation of a graph

2011-08-05 Thread Lisa
Thanks you for your reply. I consider only the performance of “vars” (v1 to v10), so I just want to indicate then on the y-axis at the point they should be located. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Text-annotation-of-a-graph-tp3719775p3721799.html Sent from

Re: [R] a question on list manipulation

2011-08-05 Thread Dennis Murphy
Hi: Your clarification suggests Duncan was on the right track, so how about this: x <- list(A=c("d", "e", "f"), B=c("d", "e"), C=c("d")) x2 <- unique(unlist(x)) w <- lapply(x, function(u) names(x)[which(x2 %in% u)]) names(w) <- x2 w $d [1] "A" "B" "C" $e [1] "A" "B" $f [1] "A" HTH, Dennis On

Re: [R] Displaying a summary in graphics

2011-08-05 Thread Aram Fingal
On Aug 5, 2011, at 1:44 PM, Jean V Adams wrote: > > A search of the R-help archives may provide some help. > > See, for example, > http://r.789695.n4.nabble.com/including-tabular-information-with-a-plot-in-R-Graphics-tt885431.html > > Actually, I already read through those posts and they

Re: [R] Aggregating data

2011-08-05 Thread Dennis Murphy
Hi: This is the type of problem at which the plyr package excels. Write a utility function that produces the plot you want using a data frame as its input argument, and then do something like library('plyr') d_ply(results, .(a, b, c), plotfun) where plotfun is a placeholder for the name of the n

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Frank Harrell
Please provide the data or better the R code for simulating the data that shows the problem. Then we can look further into this. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Goodness-of-fit-of-binary-l

Re: [R] excel dates and times in R

2011-08-05 Thread Tyler Rinker
You can also make the change in the excel file first. In excel highlight the date column-> right click-> format cells ->under number tab click custom ->in the Type field type the following "-mm-dd" Now save and import. > Date: Fri, 5 Aug 2011 13:59:16 +0100 > From: ted.hard...@wlandre

Re: [R] Loop: noob question

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 1:50 PM, Ken H wrote: That's a good point Josh is correct, Its the R Bible because its the size of the Bible and serves as a very good reference. Some people apparently think so [assuming here that you are referring to Crawley.] My experience is less favorable. When I

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 2:29 PM, Paul Smith wrote: On Fri, Aug 5, 2011 at 7:07 PM, David Winsemius > wrote: I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T) Model Likelihood

Re: [R] a question

2011-08-05 Thread array chip
Nice guess Duncan! Otherwise, I can't think of other ways to get that number. Thanks John - Original Message - From: Duncan Murdoch To: array chip Cc: r-help Sent: Friday, August 5, 2011 11:21 AM Subject: Re: [R] a question On 05/08/2011 2:19 PM, array chip wrote: > Hi, I read on

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 2:29 PM, Paul Smith wrote: On Fri, Aug 5, 2011 at 7:07 PM, David Winsemius > wrote: I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T) Model Likelihood

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 7:07 PM, David Winsemius wrote: >> I have just estimated this model: >> --- >> Logistic Regression Model >> >> lrm(formula = Y ~ X16, x = T, y = T) >> >>                  Model Likelihood    

Re: [R] a question

2011-08-05 Thread Duncan Murdoch
On 05/08/2011 2:19 PM, array chip wrote: Hi, I read on a paper the below statement, don't know how that was calculated. Basically, there are 2 continuous variables x1 and x2, as independent variable for predicting cancer recurrence. So this is a survival analysis. Now the author try to check t

Re: [R] Loop: noob question

2011-08-05 Thread William Dunlap
I don't think the "use replicate" answer is necessarily "wrong". Making a matrix of all the random numbers you plan on using and then using apply on it requires that you have memory for all those random numbers. Generating a batch of random numbers, running quantile on them, then discarding the ra

[R] a question

2011-08-05 Thread array chip
Hi, I read on a paper the below statement, don't know how that was calculated. Basically, there are 2 continuous variables x1 and x2, as independent variable for predicting cancer recurrence. So this is a survival analysis. Now the author try to check the correlation between x1 and x2. He calcul

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 12:53 PM, Paul Smith wrote: On Fri, Aug 5, 2011 at 5:35 PM, David Winsemius > wrote: I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T) Model Likeliho

Re: [R] Loop: noob question

2011-08-05 Thread Bert Gunter
I think that Josh may have inadvertently left out Venables's and Ripley"s MASS (the book), which is what I would choose if I were marooned on a desert island with my computer, a power supply, and unlimited mai tai's. Also Mozart's Piano Concerti if I had to limit my music to just one composer ( :-)

Re: [R] summing columns with NAs present

2011-08-05 Thread Jorge Ivan Velez
Try test$Sum <- rowSums(test, na.rm = TRUE) test HTH, Jorge On Fri, Aug 5, 2011 at 2:01 PM, Dimitri Liakhovitski <> wrote: > Hello! > > I have a data frame with some NAs. > test<-data.frame(a=c(1,2,NA),b=c(10,NA,20)) > > I need to sum up values in 2 variables. However: > test$a+test$b > procud

Re: [R] summing columns with NAs present

2011-08-05 Thread Dimitri Liakhovitski
Sorry, never mind - I have to use rowSums with na.rm=T Dimitri On Fri, Aug 5, 2011 at 2:01 PM, Dimitri Liakhovitski wrote: > Hello! > > I have a data frame with some NAs. > test<-data.frame(a=c(1,2,NA),b=c(10,NA,20)) > > I need to sum up values in 2 variables. However: > test$a+test$b > procudes

[R] summing columns with NAs present

2011-08-05 Thread Dimitri Liakhovitski
Hello! I have a data frame with some NAs. test<-data.frame(a=c(1,2,NA),b=c(10,NA,20)) I need to sum up values in 2 variables. However: test$a+test$b procudes NAs in rows that have NAs. How could I sum up columns while ignoring NAs (the way the function sum(..., na.rm=T) works? Thank you! -- Dim

Re: [R] Loop: noob question

2011-08-05 Thread Ken H
That's a good point Josh is correct, Its the R Bible because its the size of the Bible and serves as a very good reference. I agree that it is definitely not a first blush kind of book. I second the regression book, it is excellent. Cryer and Chan Time Series Analysis with Applications in R is pret

Re: [R] Very silent R

2011-08-05 Thread jim holtman
Run it without any packages loaded (--vanilla) to see if it happens. On Fri, Aug 5, 2011 at 9:54 AM, khadeeja ismail wrote: > Hi, > > I'm using R-2.13.1 (2011-07-08) on Ubuntu. > > I have tried options("show.error.messages"=TRUE), but no change. > >> options(show.error.messages) >> options("show.

Re: [R] Displaying a summary in graphics

2011-08-05 Thread Jean V Adams
A search of the R-help archives may provide some help. See, for example, http://r.789695.n4.nabble.com/including-tabular-information-with-a-plot-in-R-Graphics-tt885431.html Jean `·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º> Jean V. Adams Statistician U.S. Geological Survey Great Lakes Scie

Re: [R] Loop: noob question

2011-08-05 Thread Bert Gunter
Inline below. On Fri, Aug 5, 2011 at 10:23 AM, R. Michael Weylandt wrote: > Bert, > > You are absolutely correct: I was wrong not to vectorize in this case. > No. That wasn't my point at all. In this case, vectorizing doesn't seem to help because you still must do a loop (via *ply) in R. My poin

[R] Displaying a summary in graphics

2011-08-05 Thread Aram Fingal
I'm writing a script which puts together a bunch of graphs and outputs them to a graphics device. One of the things I want to add is ANOVA summaries but I'm having trouble with formatting them for graphics. I do this: anova_summary <- summary(aov(concentration~inhibition*genotype, data =drug

Re: [R] Text annotation of a graph

2011-08-05 Thread Benno Pütz
Hi Lisa, On 4.Aug.2011, at 22:24, Lisa wrote: > Dear All, > > I am trying to add some text annotation to a graph using matplot() as > follows: > > vars <- c("v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v8", "v10") > id <- seq(5.000, 0.001, by = -0.001) > sid <- c(4.997, 3.901, 2.339, 0

Re: [R] Loop: noob question

2011-08-05 Thread R. Michael Weylandt
Bert, You are absolutely correct: I was wrong not to vectorize in this case. I am surprised, however, by your remark that sapply() (or really lapply()) is faster than apply() -- is there a reason for this? I would have guessed that the major difference between the two would have been memory manag

Re: [R] Sweave - landscape figure

2011-08-05 Thread Eduardo M. A. M. Mendes
Hi there This is what I did: <>= print(xyplot(data.flow,xlab="Time",ylab="Flow")) @ \begin{figure} \includegraphics[angle=90,width=0.8\textheight]{Myfig1} \caption{First Data} \end{figure} and here is the latex error. ! LaTeX Error: File `Myfig1' not found. See the LaTeX manual or LaTeX Comp

Re: [R] Loop: noob question

2011-08-05 Thread Joshua Wiley
On Fri, Aug 5, 2011 at 9:20 AM, Ken H wrote: [snip] >   And that should be it, as far as relevant reading > Peter Daalgard's Introductory Statistics with R is very good if you do not > know other programming languages. I would strongly second this. It is a very nice book. What book to read depe

Re: [R] a question on list manipulation

2011-08-05 Thread zhenjiang xu
Exactly! Sorry I get others misunderstood. The uppercase/lowercase is only a toy example (and a bad one; yours is better than mine). My question is a more general one: a list is basically a one-to-many matching, from the names of a list to the elements belonging to each name. I'd like to reverse th

Re: [R] Aggregating data

2011-08-05 Thread Sarah Goslee
split() might be useful. On Fri, Aug 5, 2011 at 12:55 PM, Jeffrey Joh wrote: > > > I aggregated my data: aggresults <-aggregate(results, by=list(results$a, > results$b, results$c), FUN=mean, na.rm=TRUE) > > > > results has about 8000 lines of data, and aggresults has about 80 lines.  I > woul

Re: [R] a question on list manipulation

2011-08-05 Thread Duncan Murdoch
On 05/08/2011 12:05 PM, zhenjiang xu wrote: Hi R users, I have a list: > x $A [1] "a" "b" "c" $B [1] "b" "c" $C [1] "c" I want to convert it to a lowercase-to-uppercase list like this: > y $a [1] "A" $b [1] "A" "B" $c [1] "A" "B" "C" In a word, I want to reverse the list names and the

[R] Aggregating data

2011-08-05 Thread Jeffrey Joh
I aggregated my data: aggresults <-aggregate(results, by=list(results$a, results$b, results$c), FUN=mean, na.rm=TRUE) results has about 8000 lines of data, and aggresults has about 80 lines. I would like to create a separate variable for each of the 80 aggregates, each containing the 100

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 5:35 PM, David Winsemius wrote: I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T)                   Model Likelihood     Discriminati

Re: [R] Loop: noob question

2011-08-05 Thread Bert Gunter
Michael: I'm sorry, but this "advice" is wrong. replicate() **IS** essentially a loop: it uses sapply(), which is basically an interpreted loop (with suitable caveats that R experts can provide). The correct advice is: whenever possible, move the loops down to underlying C code by vectorizing. In

Re: [R] a question on list manipulation

2011-08-05 Thread Jannis
toupper()/tolower() are the functions to convert the letters. lapply() can be used to apply this to different list elements and names() is helpfull to convert the names of your list. HTH Jannis On 08/05/2011 06:05 PM, zhenjiang xu wrote: Hi R users, I have a list: x $A [1] "a" "b" "

Re: [R] a question on list manipulation

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 12:05 PM, zhenjiang xu wrote: Hi R users, I have a list: x $A [1] "a" "b" "c" $B [1] "b" "c" $C [1] "c" I want to convert it to a lowercase-to-uppercase list like this: y $a [1] "A" $b [1] "A" "B" $c [1] "A" "B" "C" In a word, I want to reverse the list names and

Re: [R] a question on list manipulation

2011-08-05 Thread R. Michael Weylandt
There are a few moving pieces to do this: 1) the toupper and tolower functions. These can do almost everything you need: x = lapply(x,toupper) ## This changes the things inside x but won't change the names 2) Now, there are two ways to think about getting the elements from one list to another: I

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 12:21 PM, Paul Smith wrote: On Fri, Aug 5, 2011 at 4:54 PM, David Winsemius > wrote: I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T) Model Likelih

Re: [R] Limited number of principal components in PCA

2011-08-05 Thread Joshua Wiley
Hi Billy, Thanks for posting your data. Okay, first off as Michael pointed out: > table(complete.cases(Q)) FALSE TRUE 1254 shows that of the 66 rows in your data set, only 54 of them are complete. That means when you use na = na.omit, you are actually only passing a data frame with 54

Re: [R] how to control to save plots to which dev

2011-08-05 Thread zhenjiang xu
Yes, but I thought the parameter to dev.set() should only be the value returned by dev.next()/dev.prev(). So I read the help page again. It's a little embarrassing - I missed the sentence "Devices are associated with ... a number in the range 1 to 63". I should have read the help page more carefull

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread Paul Smith
On Fri, Aug 5, 2011 at 4:54 PM, David Winsemius wrote: >> I have just estimated this model: >> --- >> Logistic Regression Model >> >> lrm(formula = Y ~ X16, x = T, y = T) >> >>                    Model Likelihood     Discrimination    Rank Di

Re: [R] [?]apply functions or for loop

2011-08-05 Thread R. Michael Weylandt
You should have been able to discern from the help pages that the generic "apply" will do it. E.g., apply(x,1,rank) Now, you'll probably want to transpose the output of apply: it's a R quirk/feature/bug/idiosyncrasy that apply(x,1,FUN) transposes the output and most of the time I wind up switchi

Re: [R] Very silent R

2011-08-05 Thread Michael Sumner
Does the problem persist in a fresh session? I have seen this in Windows R during long running sessions, but not found anything repeatable or that was not fixed by restarting R. Mike On Friday, August 5, 2011, khadeeja ismail wrote: > Hi, > > I'm using R-2.13.1 (2011-07-08) on Ubuntu. > > I have

Re: [R] Loop: noob question

2011-08-05 Thread Ken H
Hey, no problem! We all have to start somewhere, welcome to R! The structure of the for loop is as follows: First lets define the number you want, say >vector.size = 10 First allocate an empty vector to store the results, you could do this like so > V95.Vector<-c() But I recommend you do

Re: [R] Loop: noob question

2011-08-05 Thread R. Michael Weylandt
This is a textbook of when NOT to use a loop in R: rather make a function that does what you want and use the replicate function to do it repeatedly. f <- function(){ return(-1000*quantile(rnorm(250,0,0.2),0.95) } x = replicate(1e5,f()) There are your desired numbers. Some general coding princi

Re: [R] question

2011-08-05 Thread Duncan Murdoch
On 05/08/2011 10:46 AM, Angel Valverde Portal wrote: Hi everybody, How can I transform a 0/1 matrix into a TRUE/FALSE matrix, and vice versa? If A is your matrix, and you really want 0 to be TRUE (a little weird...), just use A == 0 and you get a logical matrix. To go the other way, as.num

[R] a question on list manipulation

2011-08-05 Thread zhenjiang xu
Hi R users, I have a list: > x $A [1] "a" "b" "c" $B [1] "b" "c" $C [1] "c" I want to convert it to a lowercase-to-uppercase list like this: > y $a [1] "A" $b [1] "A" "B" $c [1] "A" "B" "C" In a word, I want to reverse the list names and the elements under each list name. Is there any quic

Re: [R] how to control to save plots to which dev

2011-08-05 Thread Duncan Murdoch
On 05/08/2011 11:49 AM, zhenjiang xu wrote: Thanks, Prof Ripley. I was using dev.next(), dev.prev(),, but I am wondering, instead of switching the current dev, is there a way to more directly print plot A into file connection A, plot B into file connection B...? Because if coding with more then t

[R] [?]apply functions or for loop

2011-08-05 Thread Ben qant
Hello, First time posting to this mail list. I'd like to use R in the most efficient way. I'm accomplishing what I want, but feel there is a more R'ish way to do it. Just learning R. *My goal: get ranks of value across rows with row names and column names intact.* I'm guessing one of the [?]app

[R] error message in BGM

2011-08-05 Thread Stéphanie D'agata
Hello, I am an intern and I am using BRTs to model functional diversity of reef fish. I am testing several values of lr and tc together so I can find optimal settings for y models. for some of my data, I get the folowwing error message : "restart model with a smaller learning rate or smaller step

Re: [R] Very silent R

2011-08-05 Thread khadeeja ismail
Hi, I'm using R-2.13.1 (2011-07-08) on Ubuntu. I have tried options("show.error.messages"=TRUE), but no change. > options(show.error.messages) > options("show.error.messages") $show.error.messages [1] TRUE Here is the session info: > sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64

[R] question

2011-08-05 Thread Angel Valverde Portal
Hi everybody, How can I transform a 0/1 matrix into a TRUE/FALSE matrix, and vice versa? Many thanks __ Angel Valverde Portal avalverdepor...@yahoo.es [[alternative HTML version deleted]] __ R-help@r-project.org mailing li

[R] Loop: noob question

2011-08-05 Thread UnitRoot
Hi, Can someone help me out to create a (for?) loop for the following procedure: x=rnorm(250,0,0.02) library(timeSeries) x=timeSeries(x) P=1000

Re: [R] Dichotomous variables

2011-08-05 Thread Sarah Goslee
Hi Marco, On Fri, Aug 5, 2011 at 11:53 AM, marco wrote: > Hi everyone, > Have sample of items for each one, a set of 20 dichotomous (absent-present) > variables are expressed. I'm trying to understand how to explore the > co-occurence of each variable. > Read some papers concerning smallest space

Re: [R] Goodness of fit of binary logistic model

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 9:47 AM, Paul Smith wrote: Dear All, I have just estimated this model: --- Logistic Regression Model lrm(formula = Y ~ X16, x = T, y = T) Model Likelihood DiscriminationRank Discrim.

[R] Dichotomous variables

2011-08-05 Thread marco
Hi everyone, Have sample of items for each one, a set of 20 dichotomous (absent-present) variables are expressed. I'm trying to understand how to explore the co-occurence of each variable. Read some papers concerning smallest space analysis, but it does not seems implemented in any R package (and

Re: [R] how to control to save plots to which dev

2011-08-05 Thread zhenjiang xu
Thanks, Prof Ripley. I was using dev.next(), dev.prev(),, but I am wondering, instead of switching the current dev, is there a way to more directly print plot A into file connection A, plot B into file connection B...? Because if coding with more then two dev simultaniously, one could easily get co

Re: [R] plot the implicit function

2011-08-05 Thread David Winsemius
On Aug 5, 2011, at 11:23 AM, KnifeBoot wrote: Is there anybody willing to help me with the method of plot. please show me the command lines to plot the implicit function "x^4+y^3=x^2+y" and "x=(sin[t])^3 y=(cos[t])^3 t :[0,2*pi] " I can learn how to plot implicit functions from your comma

Re: [R] Limited number of principal components in PCA

2011-08-05 Thread Michael Dewey
At 19:07 04/08/2011, William Armstrong wrote: David and Josh, Thank you for the suggestions. I have attached a file ('q_values.txt') that contains the values of the 'Q' variable. David -- I am attempting an 'S' mode PCA, where the columns are actually the cases (different stream gaging station

Re: [R] plot the implicit function

2011-08-05 Thread Duncan Murdoch
On 05/08/2011 11:23 AM, KnifeBoot wrote: Is there anybody willing to help me with the method of plot. please show me the command lines to plot the implicit function "x^4+y^3=x^2+y" You were already told how to do this: use contour. The help page explains how. and "x=(sin[t])^3 y=(cos[t]

Re: [R] problemsn in using nls

2011-08-05 Thread Jean V Adams
Paola, It sounds like one or both of your exponents (v2_h and v5_h) are getting too large. I tried fitting the model without those exponents, then I used the estimates from that simpler model as starting parameters for the full model, and it worked. nov2hv5h <- nls(slope_pp2_mrna ~ ( (k1*v2_K

Re: [R] problemsn in using nls

2011-08-05 Thread Jeff Newmiller
Suggestion: read the posting guide and tell us enough information to interpret your problem. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (

[R] plot the implicit function

2011-08-05 Thread KnifeBoot
Is there anybody willing to help me with the method of plot. please show me the command lines to plot the implicit function "x^4+y^3=x^2+y" and "x=(sin[t])^3 y=(cos[t])^3 t :[0,2*pi] " I can learn how to plot implicit functions from your command lines. Thanks a lot KnifeBoot [[alterna

  1   2   >