Re: [R] creating matrices from lists

2010-09-20 Thread Peter Dalgaard
On 09/21/2010 05:02 AM, Gregory Ryslik wrote: > Hi, > > I think I've found away around that issue. The following works. If this method is inefficient and one has something faster, I'll appreciate it though! > > lapply(mylist, function(x) as.numeric(as.character(x))) You could avoid making them f

Re: [R] Error in eval(expr, envir, enclos)

2010-09-20 Thread Dennis Murphy
I don't see a data frame name in the rlm call... Dennis On Mon, Sep 20, 2010 at 7:08 PM, uttara_n wrote: > > I am absolutely new to R and I am aware of only a few basic command lines. > I > was running a robust regression in R, using the following command line > > library (MASS) > rfdmodel1 <-

Re: [R] ERROR: Object not found

2010-09-20 Thread Dejian Zhao
Error originates in the customized function ode. When IN!=0, You did not assign a value to dIN which is required in list(c(dP1,dP2,dIN)). On 2010-9-21 2:30, Tianchan Niu wrote: Dear All, I am trying to use ode solver "rk4" to solve an ODE system, however, it keeps saying: Error in eval(expr

[R] Combined plot: Scatter + density plot

2010-09-20 Thread Ralf B
Hi, in order to save space for a publication, it would be nice to have a combined scatter and density plot similar to what is shows on http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=78 I wonder if anybody perhaps has already developed code for this and is willing to share. This is

Re: [R] Estimating Weibull parameters by maximum liklihood - with censored and non censored data?

2010-09-20 Thread Bill.Venables
library(help = survival) help("survreg", package = "survival") -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Halabi, Anan Sent: Tuesday, 21 September 2010 3:12 PM To: r-help@r-project.org Subject: [R] Estimating Weibull paramete

[R] Estimating Weibull parameters by maximum liklihood - with censored and non censored data?

2010-09-20 Thread Halabi, Anan
Below my code: sampleSize <- 20 shape.true <- 1.82 scale.true <- 987 sampWB <- rweibull(sampleSize, shape=shape.true, scale=scale.true) print(sampWB) censidx <- sample(1:length(sampWB), length(sampWB)*0.3) Censored.data <- sampWB[censidx] print(Censored.data) NonCensored.data <- sampWB[-censidx] p

Re: [R] Adjusting Font Size: lattice / bwplot

2010-09-20 Thread David Winsemius
It took me several rounds of failed efforts before I came up with a perspective that was successful. One of the most informative exercises was to look at lattice plot objects with str(). It taught me to always try "packaging" arguments in nested list structures. I highly recommend examining

Re: [R] Lists with NULL entries

2010-09-20 Thread Peter Langfelder
Hi Joshua, thanks, I came up with that solution myself after a bit of thinking. Normally I wouldn't worry about NULL components of lists, but dimnames is a list and often some components are null and is therefore a bit tricky to manipulate... Peter On Mon, Sep 20, 2010 at 7:39 PM, Joshua Wiley

Re: [R] Adjusting Font Size: lattice / bwplot

2010-09-20 Thread Michael Just
Hello, I know I am supposed to get 'it' when I "?bwplot" but your example really made things clearer for me. Thanks, Cheers, Michael On Mon, Sep 20, 2010 at 12:50 AM, David Winsemius wrote: > > On Sep 20, 2010, at 12:43 AM, Michael Just wrote: > > Hello, >> If you run the following code with la

Re: [R] creating matrices from lists

2010-09-20 Thread Gregory Ryslik
Hi, I think I've found away around that issue. The following works. If this method is inefficient and one has something faster, I'll appreciate it though! lapply(mylist, function(x) as.numeric(as.character(x))) Cheers, Greg On Sep 20, 2010, at 10:48 PM, David Winsemius wrote: > > On Sep 20,

Re: [R] creating matrices from lists

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 10:28 PM, David Winsemius wrote: On Sep 20, 2010, at 10:12 PM, Gregory Ryslik wrote: Hi, I have a list of 5 main elements where each main element has 247 atomic entries either 0 or 1. I need to get this into a 247x5 matrix so I do "do.call(cbind, mylist)". However,

Re: [R] creating matrices from lists

2010-09-20 Thread Jorge Ivan Velez
Hi Gregory, May be this? # some data set.seed(123) x <- factor(sample(0:1, 20, TRUE)) x # [1] 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 1 # Levels: 0 1 as.numeric(as.factor(x)) # [1] 1 2 1 2 2 1 2 2 2 1 2 1 2 2 1 2 1 1 1 2 as.numeric(as.character(x)) [1] 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 1 HT

Re: [R] creating matrices from lists

2010-09-20 Thread Gregory Ryslik
Hm, Now that you mention it, I believe they are factors. They just appeared as 0 or 1 so I treated them as numbers. Once I found out they were factors I tried using the as.numeric() but that makes it 1 or 2 as before. How do I actually make it keep the factor number? Thanks, Greg On Sep 20, 2

Re: [R] Lists with NULL entries

2010-09-20 Thread Joshua Wiley
Sorry, that was a really half-hearted reply. This will create a new list that is the old list shifted down (and should be much faster than the for loop too). lst <- list(NULL,2) lst2 <- vector("list", length(lst) + 1) lst2[2:length(lst2)] <- lst lst lst2 If you really need to use a for loop, may

Re: [R] creating matrices from lists

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 10:12 PM, Gregory Ryslik wrote: Hi, I have a list of 5 main elements where each main element has 247 atomic entries either 0 or 1. I need to get this into a 247x5 matrix so I do "do.call(cbind, mylist)". However, it renumbers 0 to a 1 and the 1 to a 2 so that my matr

Re: [R] Lists with NULL entries

2010-09-20 Thread Joshua Wiley
Hello Peter, This is because assigning a value of NULL removes that element of the list. I am not quite sure what the reference for that is. I remember reading it in the documentation once though. I looked through ?list to no avail. At any rate, to avoid it, you would have to assign something

[R] Error in eval(expr, envir, enclos)

2010-09-20 Thread uttara_n
I am absolutely new to R and I am aware of only a few basic command lines. I was running a robust regression in R, using the following command line library (MASS) rfdmodel1 <- rlm (TotalEmployment_2004 ~ MISSISSIPPI + LOUISIANA + TotalEmployment_2000 + PCWhitePop_2004 + UnemploymentRate_2004 + P

[R] creating matrices from lists

2010-09-20 Thread Gregory Ryslik
Hi, I have a list of 5 main elements where each main element has 247 atomic entries either 0 or 1. I need to get this into a 247x5 matrix so I do "do.call(cbind, mylist)". However, it renumbers 0 to a 1 and the 1 to a 2 so that my matrix is filled with 1's and 2's. I understand I can fix it

[R] Lists with NULL entries

2010-09-20 Thread Peter Langfelder
Hello, I encountered a weird problem. Consider the following code that takes a list "lst" and shifts all elements one index up (for example, to make space for a new first element): lst = list(1,2) ll = length(lst); for (i in ll:1) lst[[i+1]] = lst[[i]]; lst If you run it, you get the expected

Re: [R] Composing Music - R Package

2010-09-20 Thread Wincent
I have been looking for R package for audio manipulation in order to extend RQDA's (http://rqda.r-forge.r-project.org/) capacity of handling audio files. The functions I need includes play, pause, get position information (where it is paused), and seek according to a position. However, such a pack

Re: [R] Doing operations by grouping variable

2010-09-20 Thread Bill.Venables
That's if the variables are visible. If they are only in the data frame it's not much more difficult d <- data.frame(group = rep(1:5, each=5), variable = rnorm(25)) with(d, tapply(variable, group, max)) (Tip: avoid using attach().) Bill Venables. -Original Message-

Re: [R] Doing operations by grouping variable

2010-09-20 Thread Michael Bedward
Not sure why you think tapply is "awkward". Your example would be... group <- rep(1:5, each=5) variable <- rnorm(25) tapply(variable, group, max) ...which looks quite elegant to me :) Meanwhile, the reason your expression doesn't work is that you are asking mistakenly for elements 1:5 repeatedly

[R] Aligned Rank transformation

2010-09-20 Thread Horacio Claudio Morales Torres
Hi everyone: I would like to know if there is a way of applying this kind of transformation in R (i mean aligned ranks). I read that this was a good way of analyzing interactions in data with outliers and a not normal distribution. The rank transformation is useful analyzing principal effects, b

[R] Doing operations by grouping variable

2010-09-20 Thread Seth W Bigelow
I'm writing an expression that requires searching a vector according to group. As an example, I want to find the maximum value in each of 5 groups. group=rep(1:5, each=5) # create grouping variable variable=rnorm(25) # generate data d <-

[R] Can ucminf be installed in 64 bit R and one more question?

2010-09-20 Thread Hey Sky
Hey, R Users my windows is 64 bit windows 7. I am trying to install the package ucminf into my 64 bit version R but cannot.  the package I downloaded is from http://cran.r-project.org/web/packages/ucminf/index.html and I installed it with the "install from local zip files", due to I did not co

Re: [R] Composing Music - R Package

2010-09-20 Thread Carl Witthoft
Not sure exactly what capabilities you're looking for. Just thought I'd put in a plug for a pretty decent, and free open source, app for generating the sheet music pages themselves. http://lilypond.org/ Carl __ R-help@r-project.org mailing list http

Re: [R] support for caron (hacek) symbol

2010-09-20 Thread Jonathan Callahan
Thanks all. I have also been able to get things to work on an Ubuntu system. I'll talk with the system guys for our server and see if I can get them excited about finding and installing the proper Slavic fonts. Cheers! 2010/9/20 Thomas Lumley > On Mon, 20 Sep 2010, Jonathan Callahan wrote: >

Re: [R] support for caron (hacek) symbol

2010-09-20 Thread Thomas Lumley
On Mon, 20 Sep 2010, Jonathan Callahan wrote: Awesome!  Can you tell me what version of R you are using and what operating system?  R does use system fonts, doesn't it?  Perhaps I just don't have the correct fonts installed -- I'm on CentOS. Yes, R uses the system fonts. I'm using Mac OS and

Re: [R] support for caron (hacek) symbol

2010-09-20 Thread Jonathan Callahan
Awesome! Can you tell me what version of R you are using and what operating system? R does use system fonts, doesn't it? Perhaps I just don't have the correct fonts installed -- I'm on CentOS. Jon 2010/9/20 Thomas Lumley > On Mon, 20 Sep 2010, Jonathan Callahan wrote: > > Can you -- or anyo

Re: [R] support for caron (hacek) symbol

2010-09-20 Thread Thomas Lumley
On Mon, 20 Sep 2010, Jonathan Callahan wrote: Can you -- or anyone else -- point me to some plots in R that have Czech, Slovak or Polish text on them? That would be the proof that it is possible. Then I would still need to figure out why my version fails to print this text properly. I have c

Re: [R] support for caron (hacek) symbol

2010-09-20 Thread Jonathan Callahan
Vojtěch, Thanks for responding. I should be clear that the web pages and server all support UTF-8 quite well. I am asking about using slavic letters with the caron/hacek symbol in R * plots*. Reading old messages I see that this has been a problem in past years. Can you -- or anyone else -- p

Re: [R] Help!

2010-09-20 Thread Bill.Venables
You could do most of this with the function lmList in the nlme package, but since you want both plots and summaries, you might as well do it in a more flexible loop. How about something like this: Code: ## This makes a single factor to define your groups BCI <- within(BCI, Sp_ind

Re: [R] Help!

2010-09-20 Thread Oyomoare Osazuwa-Peters
From: Oyomoare Osazuwa-Peters Subject: Re: [R] Help! To: "Erich Neuwirth" Date: Monday, September 20, 2010, 5:16 PM Thanks for responding to my request for help. I understand what you mean about the repeated measurements methods for the two cores. The thing though is to answer my research ques

Re: [R] Help!

2010-09-20 Thread Erich Neuwirth
If you assume that the variance is the same in all your subsets, you can do an lm analysis with your subset classification as a factor. You could also analyze the interaction between factors and between factors and your numeric independent variable. You also should consider repeated measurement met

Re: [R] Size of the legend

2010-09-20 Thread Dennis Murphy
Base graphics, ggplot2 or lattice? You need to be more specific. A reproducible example to illustrate your problem would be helpful. Dennis On Mon, Sep 20, 2010 at 1:07 PM, Mestat wrote: > > Hello, > Which would be the command to change the size of the legend. > I checked at the help and I foun

[R] Help!

2010-09-20 Thread Oyomoare Osazuwa-Peters
Please I need some help using R to analyze my data. What I would like to do is to repeat the same basic process (e.g. linear regression between wood density and distance from pith) for at least 240 data subsets within the main data-frame. Within the main data-frame, these data subsets will be de

Re: [R] Removing slected values from original vector and definning new vector with the rest?

2010-09-20 Thread Phil Spector
Anan - If you actually want the indices, you can use seq_along(sampWB)[-censidx] If you want the values themselves, then use sampWB[-censidx] - Phil Spector Statistical Computing Facility

[R] Removing slected values from original vector and definning new vector with the rest?

2010-09-20 Thread Halabi, Anan
sampleSize <- 20 shape.true <- 1.82 scale.true <- 987 sampWB <- rweibull(sampleSize, shape=shape.true, scale=scale.true) print(sampWB) censidx <- sample(1:length(sampWB), length(sampWB)*0.3) Censored.data <- sampWB[censidx] noncensidx <- defines the rest values of the vector which is not include

Re: [R] Rounding Elements of a Matrix

2010-09-20 Thread Raphael Fraser
Thank you all On Mon, Sep 20, 2010 at 12:53 PM, Zoppoli, Gabriele (NIH/NCI) [G] wrote: > see help(round) > > Gabriele Zoppoli, MD > Ph.D. Fellow, Experimental and Clinical Oncology and Hematology, University > of Genova, Genova, Italy > Guest Researcher, LMP, NCI, NIH, Bethesda MD > > Work: 301-

Re: [R] OT: Is randomization for targeted cancer therapies ethical?

2010-09-20 Thread JLucke
Clearly inferior treatments are unethical. Donald Berry at MD Anderson in Houston TX and Jay Kadane at Carnegie Mellon have been working on more ethical designs within the Bayesian framework. In particular, response adaptive designs reduce the assignment to and continuation of patients on in

Re: [R] Ask for help with Error: Object not found

2010-09-20 Thread Duncan Murdoch
On 20/09/2010 3:07 PM, Tianchan Niu wrote: Dear All, I am trying to use ode solver "rk4" to solve an ODE system, however, it keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found. The sample codes are enclosed as follows, please help me. Thank you very much! rm(list=ls(

[R] Size of the legend

2010-09-20 Thread Mestat
Hello, Which would be the command to change the size of the legend. I checked at the help and I found out something about TEXT.WIDTH, but I am not sure if is what I want. Any help! Thanks in advance, Marcio -- View this message in context: http://r.789695.n4.nabble.com/Size-of-the-legend-tp25476

Re: [R] lmer() vs. lme() gave different variance component estimates

2010-09-20 Thread array chip
Thank you Peter and Ben for your comments. John - Original Message From: Peter Dalgaard To: array chip Cc: r-help@r-project.org; r-sig-mixed-mod...@r-project.org Sent: Mon, September 20, 2010 12:28:43 PM Subject: Re: [R] lmer() vs. lme() gave different variance component estimates On

Re: [R] Sorting and subsetting

2010-09-20 Thread Peter Dalgaard
On 09/20/2010 08:01 PM, David Winsemius wrote: > indexfoo > 1.6 1 -3.0267759 > 1.7 1 -1.3725536 > 1.19 1 -1.1476048 > 1.16 1 -1.0963967 > 1.2 1 -1.0684793 > 2.29 2 -1.6601486 > 2.21 2 -1.2633632 > 2.22 2 -0.9875626 > 2.38 2 -0.9515301 > 2.30

Re: [R] lmer() vs. lme() gave different variance component estimates

2010-09-20 Thread Peter Dalgaard
On 09/20/2010 08:09 PM, array chip wrote: > Thank you Peter for your explanation of relationship between aov and lme. It > makes perfect sense. > > > When you said "you might have computed the average of all 8 > measurements on each animal and computed a 1-way ANOVA" for treatment effect, > wo

Re: [R] Is there a bisection method in R?

2010-09-20 Thread Matt Shotwell
I was just reading about the merge sort algorithm last night (BTW, here is a fun link http://www.youtube.com/watch?v=t8g-iYGHpEA). There are some interesting similarities in this context. Here's a recursive method for bisection: bisectMatt <- function(fn, lo, hi, tol = 1e-7, ...) { flo <- fn(

Re: [R] OT: Is randomization for targeted cancer therapies ethical?

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 2:28 PM, Charles C. Berry wrote: On Mon, 20 Sep 2010, Bert Gunter wrote: Hi Folks: **Off Topic** Those interested in clinical trials may find the following of interest: http://www.nytimes.com/2010/09/19/health/research/19trial.html It concerns the ethicality of rand

[R] Ask for help with Error: Object not found

2010-09-20 Thread Tianchan Niu
Dear All, I am trying to use ode solver "rk4" to solve an ODE system, however, it keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found. The sample codes are enclosed as follows, please help me. Thank you very much! rm(list=ls()) library(odesolve) # The ODE syste

Re: [R] how to seperate " "? or how to do regression on each variable when I have multiple variables?

2010-09-20 Thread Ista Zahn
Hi Soyeon, Here are a few options: ## Use get() to find the predictor r <- rep(0, 13) for(i in 1: 13) { r[i] <- summary(lm(MEDV ~ get(name[i]), data = boston))$r.squared } ## Use as.formula(paste()) to construction the model for(i in 1: 13) { r[i] <- summary(lm(as.formula(paste("MEDV ~ ", name[

Re: [R] how to seperate " "? or how to do regression on each variable when I have multiple variables?

2010-09-20 Thread Henrique Dallazuanna
Try this: lapply(names(boston), function(x)summary(update(lm(MEDV ~ 1, boston), ~ get(x On Mon, Sep 20, 2010 at 2:03 PM, Soyeon Kim wrote: > Dear All, > > I have data which contains 14 variables. And I have to regress one of > variables on each variable (simple 13 linear regressions) > > I

Re: [R] Sorting and subsetting

2010-09-20 Thread Joshua Wiley
On Mon, Sep 20, 2010 at 11:15 AM, David Winsemius wrote: > > On Sep 20, 2010, at 2:01 PM, David Winsemius wrote: > >> >> On Sep 20, 2010, at 1:40 PM, Joshua Wiley wrote: >> >>> On Mon, Sep 20, 2010 at 10:27 AM, Phil Spector >>> wrote: Harold -  Two ways that come to mind:

Re: [R] OT: Is randomization for targeted cancer therapies ethical?

2010-09-20 Thread Charles C. Berry
On Mon, 20 Sep 2010, Bert Gunter wrote: Hi Folks: **Off Topic** Those interested in clinical trials may find the following of interest: http://www.nytimes.com/2010/09/19/health/research/19trial.html It concerns the ethicality of randomizing those with life-threatening disease to relatively i

[R] ERROR: Object not found

2010-09-20 Thread Tianchan Niu
Dear All, I am trying to use ode solver "rk4" to solve an ODE system, however, it keeps saying: Error in eval(expr, envir, enclos) : object "dIN" not found. The sample codes are enclosed as follows, please help me. Thank you very much! rm(list=ls()) library(odesolve) # The ODE syste

[R] how to seperate " "? or how to do regression on each variable when I have multiple variables?

2010-09-20 Thread Soyeon Kim
Dear All, I have data which contains 14 variables. And I have to regress one of variables on each variable (simple 13 linear regressions) I try to make a loop and store only R-squared colnames(boston) [1] "CRIM""ZN" "INDUS" "CHAS""NOX" "RM" "AGE" [8] "DIS" "RAD"

Re: [R] Sorting and subsetting

2010-09-20 Thread William Dunlap
Richard Tan asked a very similar question last week ('get top n rows group by a column from a dataframe'). You could use ave() to make a sequence-number-within-group vector and choose rows with a small enough value there: tmp[ave(integer(nrow(tmp)), tmp$index, FUN=seq_along)<=N, ] If there are f

Re: [R] Sorting and subsetting

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 2:01 PM, David Winsemius wrote: On Sep 20, 2010, at 1:40 PM, Joshua Wiley wrote: On Mon, Sep 20, 2010 at 10:27 AM, Phil Spector wrote: Harold - Two ways that come to mind: 1) do.call(rbind,lapply(split(tmp,tmp$index),function(x)x[1:5,])) 2) subset(tmp,unlist(tapply(fo

Re: [R] lmer() vs. lme() gave different variance component estimates

2010-09-20 Thread array chip
Thank you Peter for your explanation of relationship between aov and lme. It makes perfect sense. When you said "you might have computed the average of all 8 measurements on each animal and computed a 1-way ANOVA" for treatment effect, would this be the case for balanced design, or it is also

Re: [R] Sorting and subsetting

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 1:40 PM, Joshua Wiley wrote: On Mon, Sep 20, 2010 at 10:27 AM, Phil Spector wrote: Harold - Two ways that come to mind: 1) do.call(rbind,lapply(split(tmp,tmp$index),function(x)x[1:5,])) 2) subset(tmp,unlist(tapply(foo,index,seq))<=5) 3) do.call(rbind, by(tmp, tmp$index

Re: [R] how to import this kind of data?

2010-09-20 Thread Brian Diggs
On 9/17/2010 4:39 PM, Phil Spector wrote: Soyeon - I think scan() (combined with matrix and data.frame) is the easiest way. Suppose your text file is called "data.txt". Then data.frame(matrix(scan('data.txt'),byrow=TRUE,ncol=14)) should give you what you want. - Phil Spector Statistical Computi

Re: [R] Sorting and subsetting

2010-09-20 Thread Peter Dalgaard
On 09/20/2010 07:16 PM, Doran, Harold wrote: > tmp1 <- tmp1[1:5,] > tmp2 <- tmp2[1:5,] > result <- rbind(tmp1, tmp2) > > Does anyone see a way to subset and subsequently bind without a loop? > > do.call(rbind,lapply(split(tmp,tmp$index),head,5)) indexfoo 1.11 1 -1.5124909 1.10

[R] Lempel-Ziv Entropy Estimator

2010-09-20 Thread Lorenzo Isella
Dear All, Does anyone know if there is any R implementation of the Lempel-Ziv entropy estimator? I searched for it in the entropy contributed package, but unsuccessfully. Cheers Lorenzo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] Sorting and subsetting

2010-09-20 Thread Joshua Wiley
On Mon, Sep 20, 2010 at 10:27 AM, Phil Spector wrote: > Harold - >   Two ways that come to mind: > > 1) do.call(rbind,lapply(split(tmp,tmp$index),function(x)x[1:5,])) > 2) subset(tmp,unlist(tapply(foo,index,seq))<=5) 3) do.call(rbind, by(tmp, tmp$index, .Primitive("["), 1:5, 1:2)) Josh > >      

Re: [R] Sorting and subsetting

2010-09-20 Thread Tal Galili
Hi Harold, I thought of one way to do this, but maybe (probably) there is a faster way: tmp <- data.frame(index = gl(3,20), foo = rnorm(60)) subset.first.x.elements <- function(INDEX, num.of.elements = 5) { t.INDEX <- table(factor(INDEX, levels = unique(INDEX))) running.indexes <- unlist(sappl

[R] OT: Is randomization for targeted cancer therapies ethical?

2010-09-20 Thread Bert Gunter
Hi Folks: **Off Topic** Those interested in clinical trials may find the following of interest: http://www.nytimes.com/2010/09/19/health/research/19trial.html It concerns the ethicality of randomizing those with life-threatening disease to relatively ineffective SOC when new "biologically targe

Re: [R] Sorting and subsetting

2010-09-20 Thread Doran, Harold
Very nice, Phil. Thank you. -Original Message- From: Phil Spector [mailto:spec...@stat.berkeley.edu] Sent: Monday, September 20, 2010 1:28 PM To: Doran, Harold Cc: R-help Subject: Re: [R] Sorting and subsetting Harold - Two ways that come to mind: 1) do.call(rbind,lapply(split(tmp,t

Re: [R] Sorting and subsetting

2010-09-20 Thread Phil Spector
Harold - Two ways that come to mind: 1) do.call(rbind,lapply(split(tmp,tmp$index),function(x)x[1:5,])) 2) subset(tmp,unlist(tapply(foo,index,seq))<=5) - Phil Spector Statistical Computing Facility

[R] Sorting and subsetting

2010-09-20 Thread Doran, Harold
Suppose I have a data frame, such as the one below: tmp <- data.frame(index = gl(2,20), foo = rnorm(40)) And further assume it is sorted by index and then by the variable foo. tmp <- tmp[order(tmp$index, tmp$foo) , ] Now, I want to grab the first N rows of tmp for each index. In the end, what I

Re: [R] Is there a bisection method in R?

2010-09-20 Thread Ravi Varadhan
I am glad, Greg, you did this. Peter is one of the backbones behind R, and has made enormous contributions to it. He deserves to be treated with respect. More to the point, Peter's comments are perfectly reasonable. People are motivated by different factors to go to extra lengths to help s

Re: [R] How to set the limit of abline (regression line of lm)

2010-09-20 Thread Greg Snow
Look at the clip function for one approach. You specify the clipping region, then do abline and it only shows up in the region specified. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-he

Re: [R] Is there a bisection method in R?

2010-09-20 Thread Gregory Gentlemen
Fair enough. I didn't intend to offend anyone. Please accept my apologies. Greg --- On Mon, 9/20/10, peter dalgaard wrote: From: peter dalgaard Subject: Re: [R] Is there a bisection method in R? To: "Gregory Gentlemen" Cc: "Ravi Varadhan" , r-help@r-project.org Received: Monday, September 20,

Re: [R] Is there a bisection method in R?

2010-09-20 Thread peter dalgaard
On Sep 20, 2010, at 18:15 , Gregory Gentlemen wrote: > Now that is a more useful reply than "Why do you assume there is one?". > Thanks a lot Ravi! > Well, maybe, but you can NOT expect that someone will go out of THEIR way to solve YOUR problem every time. Sometimes they will and sometimes t

Re: [R] Rounding Elements of a Matrix

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 12:25 PM, Joshua Wiley wrote: Hi Raphael, mat <- matrix(rnorm(100), ncol = 2) round(mat, 2) for documentation see ?round Thanks, Josh. I was having trouble a couple of minutes ago remembering this. Getting old, I guess. In constructing my thanks to Josh I tested: pr

[R] R/Finance 2011 - Call for Papers

2010-09-20 Thread Brian G. Peterson
Call for Papers: R/Finance 2011: Applied Finance with R April 29 and 30, 2011 Chicago, IL, USA The third annual R/Finance conference for applied finance using R will be held this spring in Chicago, IL, USA on April 29 and 30, 2011. The two-day conference will cover topics including portfolio ma

Re: [R] Rounding Elements of a Matrix

2010-09-20 Thread Joshua Wiley
Hi Raphael, mat <- matrix(rnorm(100), ncol = 2) round(mat, 2) for documentation see ?round Cheers, Josh On Mon, Sep 20, 2010 at 9:21 AM, Raphael Fraser wrote: > I have a 2x50 matrix and would like to round all the elements to 2 > decimal places. Can any one help? > > Thanks, > Raphael > > ___

Re: [R] contr.sum, model summaries and `missing' information

2010-09-20 Thread Greg Snow
Look at the functions dummy.coef, model.tables, and se.contrasts, they may help with what you want. You can also look at the multcomp package for another approach. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Origina

[R] Rounding Elements of a Matrix

2010-09-20 Thread Raphael Fraser
I have a 2x50 matrix and would like to round all the elements to 2 decimal places. Can any one help? Thanks, Raphael __ 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] Is there a bisection method in R?

2010-09-20 Thread Gregory Gentlemen
Now that is a more useful reply than "Why do you assume there is one?". Thanks a lot Ravi! --- On Fri, 9/17/10, Ravi Varadhan wrote: From: Ravi Varadhan Subject: RE: [R] Is there a bisection method in R? To: "'Peter Dalgaard'" , "'Gregory Gentlemen'" Cc: r-help@r-project.org Received: Frid

Re: [R] interpreting one-way anova tables

2010-09-20 Thread Thomas Lumley
On Mon, 20 Sep 2010, Jabez Wilson wrote: Hi, I am trying to reconcile anova table in R (summary(lm)) with individual t.test. datafilename="http://personality-project.org/R/datasets/R.appendix1.data"; data.ex1=read.table(datafilename,header=T) #read the data into a table summary(lm(Alertness~D

Re: [R] interpreting one-way anova tables

2010-09-20 Thread David Winsemius
On Sep 20, 2010, at 11:53 AM, Jabez Wilson wrote: Hi, I am trying to reconcile anova table in R (summary(lm)) with individual t.test. datafilename="http://personality-project.org/R/datasets/R.appendix1.data " data.ex1=read.table(datafilename,header=T) #read the data into a table summary(

Re: [R] support for caron (hacek) symbol

2010-09-20 Thread Vojtěch Zeisek
Hello Dne Po 20. září 2010 10:28:54 Jonathan Callahan napsal(a): > I am creating a Slovak translation of an interactive website ( > http://mazamascience.com/OilExport/index_sk.html ) and am running into > problems with R's lack of support for the caron found in the following > letters: Č/č, Å /

[R] interpreting one-way anova tables

2010-09-20 Thread Jabez Wilson
Hi, I am trying to reconcile anova table in R (summary(lm)) with individual t.test. datafilename="http://personality-project.org/R/datasets/R.appendix1.data"; data.ex1=read.table(datafilename,header=T) #read the data into a table summary(lm(Alertness~Dosage,data=data.ex1)) gives: Call: lm(form

[R] support for caron (hacek) symbol

2010-09-20 Thread Jonathan Callahan
I am creating a Slovak translation of an interactive website ( http://mazamascience.com/OilExport/index_sk.html ) and am running into problems with R's lack of support for the caron found in the following letters: Č/č, Š/š and Ž/ž. I am using R 2.6.1 running on a recent version of CentOS.

Re: [R] predict.lrm ( Design package)

2010-09-20 Thread Frank Harrell
Thanks Peter. I think you're right. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/predict-lrm-Design-package-tp2546894p2547146.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Depletion of small p values upon iterative testing of identical normal distributions

2010-09-20 Thread Thomas Lumley
On Mon, 20 Sep 2010, Duncan Murdoch wrote: On 20/09/2010 9:54 AM, A wrote: Dear all, I'm performing a t-test on two normal distributions with identical mean& standard deviation, and repeating this tests a very large number of times to describe an representative p value distribution in a null

[R] Advanced R Training - London

2010-09-20 Thread Sarah Lewis
Mango Solutions announce a public training course in ADVANCED R on the 6th and 7th October 2010 in London. This 2 day course is suitable for people with a working knowledge of R who want to extend their knowledge to take advantage of the fuller capabilities of R. Ideally, attendees should have

Re: [R] predict.lrm ( Design package)

2010-09-20 Thread Chris Mcowen
A few comments; sorry I don't have time for any more. - Combining categories is almost always a bad idea - It can be harder to discriminate more categories but that's only because the task is more difficult - Split-sample validation is not reliable unless you have say 10,000 samples to begin wit

Re: [R] Depletion of small p values upon iterative testing of id

2010-09-20 Thread Ted Harding
On 20-Sep-10 13:54:56, A wrote: > Dear all, > I'm performing a t-test on two normal distributions with identical > mean & standard deviation, and repeating this tests a very large > number of times to describe an representative p value distribution > in a null case. As a part of this, the program b

Re: [R] Depletion of small p values upon iterative testing of identical normal distributions

2010-09-20 Thread Ben Bolker
A gmail.com> writes: > > Dear all, [snip] > Here are two key parts of my code to show what functions I'm working with: > > #Calculating the p values > while(i Group1<-rnorm(6,-0.0065,0.0837) > Group2<-rnorm(6,-0.0065,0.0837) > PV<-t.test(Group1,Group2)$p.value > pscoresvector<-c(PV,pscoresve

Re: [R] Composing Music - R Package

2010-09-20 Thread Ben Bolker
C.H. gmail.com> writes: > http://r-forge.r-project.org/projects/tuner/ > > On Mon, Sep 20, 2010 at 8:35 AM, Deb Midya yahoo.com> wrote: [snip] > > 1.   Is there any R-package or if any to compose music? > > 2.   Is there any R-package or if any to analyse music? Also RSiteSearch("mu

Re: [R] predict.lrm ( Design package)

2010-09-20 Thread Peter Dalgaard
On Sep 20, 2010, at 15:50 , Frank Harrell wrote: > > You sent a private note about this which I just took the time to answer. > Please send only one note, and please post my reply to you to r-help. I have been annoyed by this at times as well. However, I have come to suspect that it is actual

Re: [R] Depletion of small p values upon iterative testing of identical normal distributions

2010-09-20 Thread Duncan Murdoch
On 20/09/2010 9:54 AM, A wrote: Dear all, I'm performing a t-test on two normal distributions with identical mean& standard deviation, and repeating this tests a very large number of times to describe an representative p value distribution in a null case. As a part of this, the program bins the

Re: [R] predict.lrm ( Design package)

2010-09-20 Thread Chris Mcowen
A few comments; sorry I don't have time for any more. - Combining categories is almost always a bad idea - It can be harder to discriminate more categories but that's only because the task is more difficult - Split-sample validation is not reliable unless you have say 10,000 samples to begin w

[R] Depletion of small p values upon iterative testing of identical normal distributions

2010-09-20 Thread A
Dear all, I'm performing a t-test on two normal distributions with identical mean & standard deviation, and repeating this tests a very large number of times to describe an representative p value distribution in a null case. As a part of this, the program bins these values in 10 evenly distributed

Re: [R] how to show the number of each axis interval (plot)

2010-09-20 Thread Ben Bolker
Duncan Murdoch gmail.com> writes: > > On 20/09/2010 9:44 AM, elaine kuo wrote: > > Dear List, > > > > I am using plot for homework. > > You should ask your instructor or teaching assistant for help on homework. > > Duncan Murdoch > > > The x-axis covered from 0 to 80, with 4 intervals. > >

Re: [R] predict.lrm ( Design package)

2010-09-20 Thread Frank Harrell
You sent a private note about this which I just took the time to answer. Please send only one note, and please post my reply to you to r-help. Frank - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/predict-lr

Re: [R] how to show the number of each axis interval (plot)

2010-09-20 Thread ONKELINX, Thierry
Have a look at ?axis ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quali

Re: [R] how to show the number of each axis interval (plot)

2010-09-20 Thread Duncan Murdoch
On 20/09/2010 9:44 AM, elaine kuo wrote: Dear List, I am using plot for homework. You should ask your instructor or teaching assistant for help on homework. Duncan Murdoch The x-axis covered from 0 to 80, with 4 intervals. However, the plot only showed 0, 40, 80. 20 and 60 disappeared. Pl

Re: [R] how to show the number of each axis interval (plot)

2010-09-20 Thread Ivan Calandra
Hi, The list is not made for helping students with their homeworks. I will just tell you this: there are graphic parameters for every single detail on a plot. Take a look at ?par Ivan Le 9/20/2010 15:44, elaine kuo a écrit : > Dear List, > > I am using plot for homework. > > The x-axis covere

[R] how to show the number of each axis interval (plot)

2010-09-20 Thread elaine kuo
Dear List, I am using plot for homework. The x-axis covered from 0 to 80, with 4 intervals. However, the plot only showed 0, 40, 80. 20 and 60 disappeared. Please kindly advise how to show 0, 20, 40, 60, 80 for the axis interval. Thank you. Elaine [[alternative HTML version deleted]]

[R] unz() ignores encoding argument

2010-09-20 Thread Stefan Evert
Hi! I'm trying to read individual files from a ZIP archive, using the unz() function. Some of the files contain non-ASCII characters and I'd like to avoid unpacking them in a temporary directory. My problem is that unz() seems to ignore the encoding="latin1" option I need to read the non-ASCI

  1   2   >