Re: [R] [OT] book on Linux scripting

2009-09-02 Thread Noah Silverman
Erin, Linux supports many scripting languages. Which language are you interested in: Perl, PHP, Bash, Python, etc??? -- Noah On 9/2/09 10:35 PM, Erin Hodgess wrote: > Dear R People: > > I know that this is off topic, but could anyone recommend a good book > on Linux scripting please? > > Any he

[R] Subsetting Data Frame based On Specified K Value

2009-09-02 Thread Gundala Viswanath
I have a data that looks like this: http://dpaste.com/88988/plain/ How can I extract/subset the data frame based on selected uniq ID. Let's say I want the first K uniq ID. I want to be able to specify the parameter "K" here, (i.e. given K=3, we hope to extract dat$V2 = 0,1,2). I'm stuck with thi

[R] Zoomable graphs with multiple plots

2009-09-02 Thread Tim Shephard
Hi folks, I was wondering if anyone could confirm/deny whether there exists any kind of package to facilitate zoomable graphs with multiple plots (eg, plot(..) and then points(..)).I've tried zoom from IDPmisc, and iplot from the iplot and iplot extreme packages, but as far I can tell, neithe

[R] goodness of "prediction" using a model (lm, glm, gam, brt, regression tree .... )

2009-09-02 Thread Corrado
Dear R-friends, How do you test the goodness of prediction of a model, when you predict on a set of data DIFFERENT from the training set? I explain myself: you train your model M (e.g. glm,gam,regression tree, brt) on a set of data A with a response variable Y. You then predict the value of th

[R] [OT] book on Linux scripting

2009-09-02 Thread Erin Hodgess
Dear R People: I know that this is off topic, but could anyone recommend a good book on Linux scripting please? Any help would be much appreciated! Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.

Re: [R] How to do rotation for polygon?

2009-09-02 Thread milton ruser
Hi there, require(maptools) ?elide good luck milton On Thu, Sep 3, 2009 at 1:04 AM, Hemavathi Ramulu wrote: > Hi everyone, > I have coding for repeating pentagon as below: > > plot(0:11,type="n") > for (i in 1:10 )polygon(rep(c(4,5,7,8,6)), i*c(.5,.3,.3,.5,.7), bor=2) > > which are increasing ve

Re: [R] abind, but on lists?

2009-09-02 Thread Peter Meilstrup
On Sep 2, 2009, at 8:47 PM, Richard M. Heiberger wrote: Almost certainly, abind is what you need for the task. Please dput() your matlab objects and send that to the list. That will make your example reproducible. Rich From the documentation and behavior, abind seems to really not want to

[R] "panel.first" passed to plot() in "..."

2009-09-02 Thread Yihui Xie
Hi everyone, The code below will only draw grid lines in the *first* plot because 'panel.first' has already been evaluated (and hence it's NULL) after the first plot is drawn: devAskNewPage(TRUE) f = function(...) { for (i in 1:5) plot(rnorm(10), ...) } f(panel.first = grid()) For i in 2:5,

[R] How to do rotation for polygon?

2009-09-02 Thread Hemavathi Ramulu
Hi everyone, I have coding for repeating pentagon as below: plot(0:11,type="n") for (i in 1:10 )polygon(rep(c(4,5,7,8,6)), i*c(.5,.3,.3,.5,.7), bor=2) which are increasing vertically. Now, I want to know how to rotate the pentagon, so that I will get pattern like flower. Basicly, repeating penta

Re: [R] variable selection in logistic

2009-09-02 Thread Frank E Harrell Jr
annie Zhang wrote: Hi, Frank, You mean the backward and forward stepwise selection is bad? You also suggest the penalized logistic regression is the best choice? Is there any function to do it as well as selecting the best penalty? Annie All variable selection is bad unless its in the con

Re: [R] abind, but on lists?

2009-09-02 Thread Richard M. Heiberger
Almost certainly, abind is what you need for the task. Please dput() your matlab objects and send that to the list. That will make your example reproducible. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] abind, but on lists?

2009-09-02 Thread David Winsemius
On Sep 2, 2009, at 10:50 PM, Peter Meilstrup wrote: I'm trying to massage some data from Matlab into R. The matlab file has a "struct array" which when imported into R using the R.matlab package, becomes an R list with 3+ dimensions, the first of which corresponds to the structure fields,

Re: [R] variable selection in logistic

2009-09-02 Thread annie Zhang
Hi, Frank, You mean the backward and forward stepwise selection is bad? You also suggest the penalized logistic regression is the best choice? Is there any function to do it as well as selecting the best penalty? Annie On Wed, Sep 2, 2009 at 7:41 PM, Frank E Harrell Jr wrote: > David Winsemiu

[R] abind, but on lists?

2009-09-02 Thread Peter Meilstrup
I'm trying to massage some data from Matlab into R. The matlab file has a "struct array" which when imported into R using the R.matlab package, becomes an R list with 3+ dimensions, the first of which corresponds to the structure fields, with corresponding row names, and the second and thi

Re: [R] variable selection in logistic

2009-09-02 Thread Ben Bolker
David Winsemius wrote: > > > On Sep 2, 2009, at 9:36 PM, annie Zhang wrote: > >> Hi, R users, >> >> What may be the best function in R to do variable selection in >> logistic >> regression? > > PhD theses, and books by famous statisticians have been pursuing the > answer to that question

Re: [R] variable selection in logistic

2009-09-02 Thread Frank E Harrell Jr
David Winsemius wrote: On Sep 2, 2009, at 9:36 PM, annie Zhang wrote: Hi, R users, What may be the best function in R to do variable selection in logistic regression? PhD theses, and books by famous statisticians have been pursuing the answer to that question for decades. I have the sam

Re: [R] Best option for exporting data frame to SPSS?

2009-09-02 Thread Wensui Liu
if i were you, i will use sqlite, as mentioned in your email already. spss should be able to read sqlite data easily through odbc. On Tue, Sep 1, 2009 at 11:11 AM, Fredrik Karlsson wrote: > Dear list, > > I am leaving my old position and now need to convert my R data frames > into a format that c

Re: [R] variable selection in logistic

2009-09-02 Thread David Winsemius
On Sep 2, 2009, at 9:36 PM, annie Zhang wrote: Hi, R users, What may be the best function in R to do variable selection in logistic regression? PhD theses, and books by famous statisticians have been pursuing the answer to that question for decades. I have the same number of variable

[R] variable selection in logistic

2009-09-02 Thread annie Zhang
Hi, R users, What may be the best function in R to do variable selection in logistic regression? I have the same number of variables as the number of samples, and I want to select the best variablesfor prediction. Is there any function doing forward selection followed by backward elimination in st

Re: [R] Grouping data in a data frame: is there an efficient way to do it?

2009-09-02 Thread milton ruser
Hi there, I think the option of 30 seconds is ok because it is less than each one expent reading the messages :-) Just kiding... bests milton On Wed, Sep 2, 2009 at 8:01 PM, Leo Alekseyev wrote: > Thanks everyone for the useful suggestions. The bottleneck might be > memory limitations of my

Re: [R] (no subject)

2009-09-02 Thread milton ruser
Hi Karen. If you are running windows, try: http://cran.r-project.org/bin/windows/base/ Case it is Vista, see some tips on the same link. cheers milton On Wed, Sep 2, 2009 at 8:13 PM, Karen Federico wrote: > I'm trying to download this program and I'm not sure how to do it. Can you > help m

Re: [R] diff of two timestamps

2009-09-02 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of sugo > Sent: Wednesday, September 02, 2009 4:51 PM > To: r-help@r-project.org > Subject: [R] diff of two timestamps > > > Hi all, > > I have the following problem: I have a csv

Re: [R] diff of two timestamps

2009-09-02 Thread Henrique Dallazuanna
Try this: dat <- read.table(textConnection("Timestamp1 Timestamp2 05:24:43 05:25:05 15:47:02 15:47:22 18:36:05 18:36:24 15:21:24 15:22:04"), T) closeAllConnections() Reduce("-", lapply(dat, strptime, format = "%H:%M:%S")) On Wed, Sep 2, 2009 at 8:50 PM, sugo wrote: > > Hi all, > > I have the f

[R] (no subject)

2009-09-02 Thread Karen Federico
I'm trying to download this program and I'm not sure how to do it. Can you help me with that? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

Re: [R] diff of two timestamps

2009-09-02 Thread Duncan Mackay
Try require(chron) dat <- read.table(textConnection("Timestamp1 Timestamp2 05:24:43 05:25:05 15:47:02 15:47:22 18:36:05 18:36:24 15:21:24 15:22:04"), T) closeAllConnections() str(dat) dat[,1] <- times(dat[,1]) dat[,2] <- times(dat[,2]) # numeric as.numeric(dat[,2] <- times(dat[,2]) ) # test t

Re: [R] diff of two timestamps

2009-09-02 Thread Gabor Grothendieck
Try this: > Lines <- "Timestamp1;Timestamp2; + 05:24:43;05:25:05; + 15:47:02;15:47:22; + 18:36:05;18:36:24; + 15:21:24;15:22:04;" > > library(chron) > DF <- read.csv(textConnection(Lines), sep = ";", as.is = TRUE) > times(DF$Timestamp2) - times(DF$Timestamp1) [1] 00:00:22 00:00:20 00:00:19 00:00:4

Re: [R] Grouping data in a data frame: is there an efficient way to do it?

2009-09-02 Thread Leo Alekseyev
Thanks everyone for the useful suggestions. The bottleneck might be memory limitations of my machine (3.2GHz, 2 GB) and the fact that I am aggregating on a field that is a string. Using the suggested as.data.frame(table(my.df$my.field)) I do get a speedup, but the computation still takes 30 secon

[R] diff of two timestamps

2009-09-02 Thread sugo
Hi all, I have the following problem: I have a csv-file consisting of timestamp values (no dates), e.g.: Timestamp1;Timestamp2; 05:24:43;05:25:05; 15:47:02;15:47:22; 18:36:05;18:36:24; 15:21:24;15:22:04; I need a vector with the difference of the two timestamps, so I read the data with the read.

Re: [R] Grouping data in a data frame: is there an efficient way to do it?

2009-09-02 Thread David M Smith
You may want to try using isplit (from the iterators package). Combined with foreach, it's an efficient way of iterating through a data frame by groups of rows defined by common values of a columns (which I think is what you're after). You can speed things up further if you have a multiprocessor sy

Re: [R] understanding the output from gls

2009-09-02 Thread Kingsford Jones
On Wed, Sep 2, 2009 at 2:39 PM, wrote: > Kingsford, > > Thanks for the information. As you suggest, if I don't hear from anyone > else about the degrees of freedom issue in a couple days, I'll try r-devel. Determining denominator degrees of freedom for F tests in mixed models is an area of curren

Re: [R] Grouping data in a data frame: is there an efficient way to do it?

2009-09-02 Thread jim holtman
Take 0.6 seconds on my slow laptop: > n <- 1e6 > x <- data.frame(a=sample(LETTERS, n, TRUE)) > system.time(print(tapply(x$a, x$a, length))) A B C D E F G H I J K L M N O P Q 38555 38349 38647 38271 38456 38352 38644 38679 38575 38730

Re: [R] Grouping data in a data frame: is there an efficient way todo it?

2009-09-02 Thread Bert Gunter
table() and xtabs() are fast only because they are just doing counts. If you want the general case, you need ?tapply. aggregate() is basically a wrapper for lapply and so you may have the same performance issues with tapply . Try it to see. They are essentially doing the sort of hash table you desc

Re: [R] Grouping data in a data frame: is there an efficient way to do it?

2009-09-02 Thread David Winsemius
table is reasonably fast. I have more than 4 X 10^6 records and a 2D table takes very little time: nUA <- with (TRdta, table(URwbc, URrbc)) # both URwbc and URrbc are factors nUA This does the same thing and took about 5 seconds just now: xtabs( ~ URwbc + URrbc, data=TRdta) On Sep 2, 20

[R] Grouping data in a data frame: is there an efficient way to do it?

2009-09-02 Thread Leo Alekseyev
I have a data frame with about 10^6 rows; I want to group the data according to entries in one of the columns and do something with it. For instance, suppose I want to count up the number of elements in each group. I tried something like aggregate(my.df$my.field, list(my.df$my.field), length) but

Re: [R] problem in loop

2009-09-02 Thread Scott Sherrill-Mix
I'm not too familiar with geese but it looks like the summary(fit)$correlation would be a dataframe. Maybe try getting the first (or whatever row you're interested in): ... corr_gee<-summary(fit)$correlation[1,1] se_corrgee<-summary(fit)$correlation[1,2] est[i,]<-c(corr_gee, se_corrgee) ... Scott

Re: [R] PRoblem with paste function

2009-09-02 Thread jim holtman
Do str(f1) . What does it return? > paste("set @g1=", "244901_at") [1] "set @g1= 244901_at" works fine, so it must be your data is not what you think it is. On Wed, Sep 2, 2009 at 1:03 PM, Fahim Md wrote: > Hi there!!! > I am having trouble with *paste* function. I dont know how to proceed. I

Re: [R] X11 plot window sizes

2009-09-02 Thread Mark Knecht
On Wed, Sep 2, 2009 at 1:12 PM, Patrick Connolly wrote: > On Wed, 02-Sep-2009 at 07:02AM -0700, Mark Knecht wrote: > > |> On Tue, Sep 1, 2009 at 9:06 AM, Mark Knecht wrote: > |> > Hi, > |> >   I'm not understanding how the width & height parameters are > |> > supposed to work. When I execute the fo

Re: [R] problem in loop

2009-09-02 Thread milton ruser
Hi there, and how about this: nsim<-500 est<-NULL for(i in 1:nsim){ fit <- geese(x ~ trt, id=subject, data=data_gee, family=binomial, corstr="exch", scale.fix=TRUE) . corr_gee<-summary(fit)$correlation[1] se_corrgee<-summary(fit)$correlation[2] est<-data.frame(rbind(est,cbind(corr_gee

Re: [R] understanding the output from gls

2009-09-02 Thread Timothy_Handley
Kingsford, Thanks for the information. As you suggest, if I don't hear from anyone else about the degrees of freedom issue in a couple days, I'll try r-devel. Also, while I appreciate your explanation of the correlation matrix produced by summary.gls, I'm afriad I don't have the statistical backg

Re: [R] [Rd] Installing rJava RJDBC bad interpreter: Permission denied

2009-09-02 Thread Matias Silva
William, thank you so much! /tmp has noexec in the fstab and doesn't allow any file to be executable. I temporary changed those settings and I was able to install rJava and RJDBC. Perhaps the installation routine shouldn't use /tmp and use /var/tmp instead. Many thanks, Matt -Original Mes

[R] problem in loop

2009-09-02 Thread Seunghee Baek
Hi R-users, I have a problem for updating the estimates of correlation coefficient in simulation loop. I want to get the matrix of correlation coefficients (matrix, name: est) from geese by using loop(500 times) . I used following code to update, nsim<-500 est<-matrix(ncol=2, nrow=nsim) for(i in

[R] Implementing timeouts or multithreading in R to solve hanging network problem? (Snowfall)

2009-09-02 Thread bstriegs
Hello, I'm new to R and I'm building a system that uses a cluster of computers to parallelize computations. To handle cluster setup I'm using the R package Snowfall, but knowledge of Snowfall may not be necessary to answer my question. I'm using a socket-based approach to cluster setup, so all I n

[R] PRoblem with paste function

2009-09-02 Thread Fahim Mohammad
I am having trouble with paste function. I dont know how to proceed. I tried many options but i failed miserably. I am using a variable f1 to assign a string as below: f1=dataLine[locAffyProbeID]; ( the value of f1 is 244901_at ) Then I am using the paste function paste("set @g1=", f1); in

Re: [R] cbind objects using character vectors

2009-09-02 Thread jonas garcia
Thanks Erik and Henrique, That's what I was after. Jonas On Tue, Sep 1, 2009 at 8:08 PM, Henrique Dallazuanna wrote: > Try this: > > > sapply(vec.names, get) > > But for this example, you don't need for, try: > > > dat - 1 > > On Tue, Sep 1, 2009 at 2:52 PM, jonas garcia < > garcia.jona...@g

Re: [R] X11 plot window sizes

2009-09-02 Thread Patrick Connolly
On Wed, 02-Sep-2009 at 07:02AM -0700, Mark Knecht wrote: |> On Tue, Sep 1, 2009 at 9:06 AM, Mark Knecht wrote: |> > Hi, |> >   I'm not understanding how the width & height parameters are |> > supposed to work. When I execute the following 4 commands: |> > |> > X11() |> > X11(width=20, height=20) |

Re: [R] problem with paste function

2009-09-02 Thread Duncan Murdoch
On 9/2/2009 1:28 PM, Phil Spector wrote: Fahim - Apparently dataline is a factor, so you'd need to use paste('set g=',as.character(f1)) That shouldn't be necessary: > f1 <- factor("abc") > paste('set g=', f1) [1] "set g= abc" I think we need reproducible code to diagnose this one.

Re: [R] within: order of newly added variables

2009-09-02 Thread Duncan Murdoch
On 9/2/2009 1:31 PM, Peter Ehlers wrote: Heinrich, You could create your own function mywithin() by inserting a couple of rev()'s in within.data.frame(). In within.data.frame(), replace the two commented lines with those immediately following: mywithin <- function (data, expr, ...) { pare

Re: [R] plotting vector of symbols

2009-09-02 Thread stephen sefick
I did something very similar in ggplot2 about a year ago. Use the unique sampling location from the species count data (rownames) as a factor column, and then use that in a geom_color or geom_shape add on to qplot untested: library ggplot2 a <- metaMDS(foo, k=3) b <- rownames(foo) d <- data.fram

Re: [R] combining grid.text, expression and variables

2009-09-02 Thread baptiste auguie
Good point, I failed to spot this kink. You might be interested in a recent discussion on r-help and r-devel, http://markmail.org/message/4hvdmwqjyqwprbwf Best, baptiste 2009/9/2 Sebastien Bihorel > Hi Baptiste, > > Thank for the help. One thing though that I found while transposing your > s

Re: [R] within: order of newly added variables

2009-09-02 Thread Gabor Grothendieck
On Wed, Sep 2, 2009 at 9:27 AM, RINNER Heinrich wrote: > Dear R community, > > I am using function 'within' in R.2.9.1 to add variables to an existing > data.frame. This works wonderful, except for one minor point: The new > variables are added to the data in reverse order. > > For example: > x <

Re: [R] "simple" 3-dimensional plots?

2009-09-02 Thread Ben Bolker
I think install.packages("akima") library(akima) example(interp) would be most useful. -- View this message in context: http://www.nabble.com/%22simple%22-3-dimensional-plots--tp25247706p25262822.html Sent from the R help mailing list archive at Nabble.com.

[R] plotting vector of symbols

2009-09-02 Thread Wade Wall
Hi all, Is there a way in R to plot points using symbols as defined in another vector without adding a separate points line for each symbol? For example, I have the results from an ordination with ~ 35 points and an associated vector that corresponds to different symbols in pch for the 35 symbols

[R] "as.is" for dbGetQuery?

2009-09-02 Thread Jim Porzak
Hello, I'm using RJDBC/DBI to query a MS SQL DB that looks like: YMDHMs Num1stsAboveBaseline 2009-05-18 00:001 2009-05-18 00:012 2009-05-18 00:022 ... The first column will get converted to POSIXct. However, dbGetQuery converts the first column to a facto

Re: [R] within: order of newly added variables

2009-09-02 Thread Peter Ehlers
Heinrich, You could create your own function mywithin() by inserting a couple of rev()'s in within.data.frame(). In within.data.frame(), replace the two commented lines with those immediately following: mywithin <- function (data, expr, ...) { parent <- parent.frame() #e <- evalq(enviro

Re: [R] pruning data

2009-09-02 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Payam Minoofar > Sent: Wednesday, September 02, 2009 10:09 AM > To: r-help@r-project.org > Subject: [R] pruning data > > Hello everyone, > > I am trying to prune a data frame fo

Re: [R] pruning data

2009-09-02 Thread Phil Spector
Payam - Take a look at na.omit . This is exactly what it was written for. - Phil On Wed, 2 Sep 2009, Payam Minoofar wrote: Hello everyone, I am trying to prune a data frame for partial least squares analysis. I need to delete an entire row if one cell i

Re: [R] within: order of newly added variables

2009-09-02 Thread Duncan Murdoch
On 9/2/2009 9:27 AM, RINNER Heinrich wrote: Dear R community, I am using function 'within' in R.2.9.1 to add variables to an existing data.frame. This works wonderful, except for one minor point: The new variables are added to the data in reverse order. For example: x <- data.frame(a = 1:3, b

Re: [R] problem with paste function

2009-09-02 Thread Phil Spector
Fahim - Apparently dataline is a factor, so you'd need to use paste('set g=',as.character(f1)) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] pruning data

2009-09-02 Thread Henrique Dallazuanna
Try this: DF[complete.cases(DF),] On Wed, Sep 2, 2009 at 2:09 PM, Payam Minoofar wrote: > Hello everyone, > > I am trying to prune a data frame for partial least squares analysis. > I need to delete an entire row if one cell in the row contains a NA. > > Presently, I am running a loop that is su

Re: [R] combining grid.text, expression and variables

2009-09-02 Thread Sebastien Bihorel
Hi Baptiste, Thank for the help. One thing though that I found while transposing your syntax to my problem: lab must be of class expression for your syntax to work. For instance, if one replaces the second elements of the lab variables by a simple integer, lab is not more of class expression,

Re: [R] pruning data

2009-09-02 Thread Jorge Ivan Velez
Dear Payam, Here is a suggestion: index <- apply(yourdata, 1, function(x) any( is.na(x) ) ) yourdata[ !index, ] Above creates an index (TRUE) when any row of the data contains a missing value. Then it filters up (extract) the rows that have complete observations. See ?any, ?is.na, ?"!" and ?appl

Re: [R] pruning data

2009-09-02 Thread stephen sefick
?is.na ?sum ?if ?else I think that is how I would approach it, but I could be far off. On Wed, Sep 2, 2009 at 12:09 PM, Payam Minoofar wrote: > Hello everyone, > > I am trying to prune a data frame for partial least squares analysis. > I need to delete an entire row if one cell in the row contain

[R] problem with paste function

2009-09-02 Thread Fahim Md
Hi there!! I am having trouble with *paste* function. I dont know how to proceed. I tried many options but i failed miserably. I am using a variable f1 to assign a string as below: f1=dataLine[locAffyProbeID]; ( the value of f1 is *244901_at* ) Then I am using the paste function paste("set g=",

[R] pruning data

2009-09-02 Thread Payam Minoofar
Hello everyone, I am trying to prune a data frame for partial least squares analysis. I need to delete an entire row if one cell in the row contains a NA. Presently, I am running a loop that is supposed to extract the rows that are full of numbers into a second data frame and skips the rows

[R] Revolutions blog: August roundup

2009-09-02 Thread David M Smith
I write about R every weekday at the Revolutions blog: http://blog.revolution-computing.com In case you missed them, here are some articles from last month of particular interest to R users. http://bit.ly/11YkB0 listed seven reasons of an anthropology professor for using R. http://bit.ly/9sbno l

Re: [R] within: order of newly added variables

2009-09-02 Thread Henrique Dallazuanna
Try this: transform(transform(x, c = a ^ 2, d = b ^2), e = c + d) On Wed, Sep 2, 2009 at 10:27 AM, RINNER Heinrich < heinrich.rin...@tirol.gv.at> wrote: > Dear R community, > > I am using function 'within' in R.2.9.1 to add variables to an existing > data.frame. This works wonderful, except for

[R] PRoblem with paste function

2009-09-02 Thread Fahim Md
Hi there!!! I am having trouble with *paste* function. I dont know how to proceed. I tried many options but i failed miserably. I am using a variable f1 to assign a string as below: f1=dataLine[locAffyProbeID]; ( the value of f1 is *244901_at* ) Then I am using the paste function paste("set @g

Re: [R] Normalized Y-axis for Histogram Density Plot

2009-09-02 Thread Greg Snow
Your data ranges from 0.67 to 1.21, just to simplify things let's assume the that the histogram will go from the pretty numbers of 0.65 to 1.25 for a total width of 0.6. Now consider the simplest histogram consisting of 1 single bar going from 0.65 to 1.25 (very uninteresting histogram, but goo

Re: [R] Avoiding loops

2009-09-02 Thread William Dunlap
Martin, Thanks for showing the timing tests. It is important to see how the time (and memory usage) grows with the size of the problem, where size may be the number of rows or length of the lag. Here is another function to toss in the hat. It uses no loops and does all the sum by diff'ing a

Re: [R] Problem at subsetting matrix by using dimnames

2009-09-02 Thread Henrique Dallazuanna
Try this: mapply(function(x, y)mitest[x, y], c("a", "b", "c"), c("b", "c", "b")) or diag(`[`(mitest, i = c("a", "b", "c"), j = c("b", "c", "b"))) On Wed, Sep 2, 2009 at 6:57 AM, Agustin Lobo wrote: > Given: > > > mitest <- matrix(1:16,ncol=4) > > dimnames(mitest)[[1]] <- c("a","b","c","d")

Re: [R] get function to return object "name"?

2009-09-02 Thread baptiste auguie
Hi, Try this, myplot <- function(subject) { plot(subject, main=deparse(substitute(subject))) } s1 <- c(200,200,190,180) myplot(s1) see ?deparse HTH, baptiste 2009/9/2 Marianne Promberger > Dear list, > > I've written a function that plots subjects. Something like: > > myplot <- functi

Re: [R] Ability Estimates for Repeated Measurements in the eRm Package

2009-09-02 Thread Doran, Harold
Not sure I completely understand what you want. You might try looking at the irt.ability() function in the MiscPscyho package for ability estimates. > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Tessari > Sent: Wednesday, Se

Re: [R] combining grid.text, expression and variables

2009-09-02 Thread baptiste auguie
Hi, Try this, library(grid) value <- c(0.1) lab <- c("test", expression(bquote(paste(.(value[1]*100), " and percentiles1", sep=""))), bquote(expression(.(value[1]*100)*" and percentiles2")), bquote(paste(.(value[1]*100), " and percentiles3", sep="")) ) grid.newpage

Re: [R] a question for beginner

2009-09-02 Thread Tal Galili
Hi miksanta. They seem to be ordered variables (with specific notation for NA). Some are qualitative and some quantitative On Wed, Sep 2, 2009 at 4:19 PM, wrote: > Hello, > > i have this dataset > http://www.umass.edu/statdata/statdata/data/pharynx.txt. > > the variables GRADE, T_STAGE anda N

[R] get function to return object "name"?

2009-09-02 Thread Marianne Promberger
Dear list, I've written a function that plots subjects. Something like: myplot <- function(subject) { plot(subject) } Subjects are vectors, e.g. ... s1 <- c(200,200,190,180) ... and plotting them works fine, e.g. ... myplot(s1) Now I want to have "s1" etc appear in the plot title, but I don't

Re: [R] read and sac files from windows 07

2009-09-02 Thread John Kane
R Import and Export manual on the R site is a start. Also what kind of data are you trying to read? given a simple csv file called sss.csv like this   a, b, c   1,2,3   4,5,6 on your C drive you can read it into R with read.csv("C:/sss.csv") See ?read.table for more information --- On Tue, 9/

[R] combining grid.text, expression and variables

2009-09-02 Thread Sebastien Bihorel
Dear R-users, I am trying to use the grid.text and expression functions to display several character strings and plotmath text on a viewport. Some strings can include a variable portion (PI.limits in the following example), which I thought could be implemented by combining the bquote and the

Re: [R] Avoiding loops

2009-09-02 Thread Martin Morgan
Alexander Shenkin wrote: > Though, from my limited understanding, the 'apply' family of functions > are actually just loops. Please correct me if I'm wrong. So, while > more readable (which is important), they're not necessarily more > efficient than explicit 'for' loops. Hi Allie -- This uses a

[R] Ability Estimates for Repeated Measurements in the eRm Package

2009-09-02 Thread Tessari
Dear R Users, I am using the LLTM and the LRSM functions in the eRm package to do repeated measurements where there are 2 measurement points for a list of 10 items. I am trying to get ability estimates but am having trouble. I don't think that it is appropriate to use the pmat function since t

Re: [R] foreach + snowfall for multicore situations

2009-09-02 Thread Tal Galili
Hi Steve, Thanks for asking - I forgot to mention I use windows XP. And the only support foreach has for windows (as far as I read from the manuals so far) - is for the snow package. Cheers, Tal On Wed, Sep 2, 2009 at 6:57 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > Hi Tal

Re: [R] foreach + snowfall for multicore situations

2009-09-02 Thread Steve Lianoglou
Hi Tal, On Sep 2, 2009, at 11:52 AM, Tal Galili wrote: Hello dear R community. I just started playing with the snowfall package (a wrapper for the snow package), and found it very convenient. (See also this great website: http://www.imbi.uni-freiburg.de/parallel/ ) I was wondering if it is

[R] foreach + snowfall for multicore situations

2009-09-02 Thread Tal Galili
Hello dear R community. I just started playing with the snowfall package (a wrapper for the snow package), and found it very convenient. (See also this great website: http://www.imbi.uni-freiburg.de/parallel/ ) I was wondering if it is possible to connect snowfall with the foreach package (since

Re: [R] Avoiding loops

2009-09-02 Thread Charles C. Berry
On Tue, 1 Sep 2009, dolar wrote: Would like some tips on how to avoid loops as I know they are slow in R If I understand your criterion (and calling your data.frame 'dat'): criterion <- as.matrix(dist(dat$a)) <= 5 & outer(dat$a,dat$a,">=") criterion %*% as.matrix(dat[, c("b","c")]) b

Re: [R] how to save an updated dataset

2009-09-02 Thread Steve Lianoglou
Hi, See: ?system.file -steve On Sep 2, 2009, at 11:39 AM, jbryer wrote: I too am looking to do the same thing. Anyone have any insight as to this can be done? Thanks, Jason Chris Stubben wrote: I wrote a package which includes a number of genome sequencing project statistics on th

Re: [R] Howto fit normal curve into histogram using GGPLOT2

2009-09-02 Thread John Kane
Crudely but I think it works x <- data.frame(aa <- mtcars$mpg) b <- ggplot(x, aes(aa)) + geom_histogram(aes(y=..density..)) + stat_function(fun=dnorm, args=list(mean=mean(x$aa), sd=sd(x$aa))) b --- On Wed, 9/2/09, Gundala Viswanath wrote: > From: Gundala Viswanath > Subject: [R] How

Re: [R] how to save an updated dataset

2009-09-02 Thread jbryer
I too am looking to do the same thing. Anyone have any insight as to this can be done? Thanks, Jason Chris Stubben wrote: > > I wrote a package which includes a number of genome sequencing project > statistics on the web like http://www.ncbi.nlm.nih.gov/genomes/lproks.cgi. > I included some g

Re: [R] Ellipse: Major Axis Minor Axis

2009-09-02 Thread Vishal
I forgot to mention that the ellipse has a rotation. It's horizontal axis is not parallel to the x-axis. Just repeating, when I try to draw a circuit keeping the center same as the ellipse, and radius equal to the first value returned by > sqrt(eigen(cov.trob(mydataforellipse)$cov)$values) taking

[R] within: order of newly added variables

2009-09-02 Thread RINNER Heinrich
Dear R community, I am using function 'within' in R.2.9.1 to add variables to an existing data.frame. This works wonderful, except for one minor point: The new variables are added to the data in reverse order. For example: x <- data.frame(a = 1:3, b = 4:6) y <- within(x, { c = a^2 d =

Re: [R] R 2.9.1: Error building target 'front'

2009-09-02 Thread Loris Bennett
Loris Bennett writes: I get the same problem using R version 2.9.2. I would be very grateful if anyone could shed some light on this issue. Regards Loris > loris.benn...@fu-berlin.de (Loris Bennett) writes: > >> Hi, >> >> I am getting the following error >> >># (R-2.9.1/src/library/me

Re: [R] Ellipse: Major Axis Minor Axis

2009-09-02 Thread Vishal
Jari, thanks for the quick answer. > sqrt(eigen(cov.trob(mydataforellipse)$cov)$values) what will this return? For my data, I get: > sqrt(eigen(cov.trob(r)$cov)$values) [1] 1.857733e-05 4.953181e-06 Is this Left hand value the major or the semi major length? I also try to plot a circuit keepi

Re: [R] package installation error

2009-09-02 Thread Haynes, Maurice (NIH/NICHD) [E]
Hi, Thank you for your responses. Héctor, I had also discovered the solution you suggested. However, when I install files from a list (such as pckg.list), failure in the installation of one package in the list results in none of the packages later in the list being installed. After moving th

[R] Problems with Boxplot

2009-09-02 Thread gug
Hello, I have been having difficulty getting boxplot to give the output I want - probably a result of the way I have been handling the data. The data is arranged in columns: each date has two sets of data. The number of data points varies with the date, so each column is of different length. I

[R] Problem at subsetting matrix by using dimnames

2009-09-02 Thread Agustin Lobo
Given: > mitest <- matrix(1:16,ncol=4) > dimnames(mitest)[[1]] <- c("a","b","c","d") > dimnames(mitest)[[2]] <- c("a","b","c","d") > mitest a b c d a 1 5 9 13 b 2 6 10 14 c 3 7 11 15 d 4 8 12 16 I can do: > mitest[cbind(c(1,2,3),c(2,3,2))] [1] 5 10 7 but using the names does not work: > m

Re: [R] Avoiding loops

2009-09-02 Thread Phil Spector
Another advantage of the apply family of functions is that they determine the size and type of their output in an efficient way, which is sometimes tricky when you write the loop yourself. - Phil Spector Statistica

Re: [R] Howto fit normal curve into histogram using GGPLOT2

2009-09-02 Thread ONKELINX, Thierry
That is not very complex with densities instead of counts. library(ggplot2) ggplot(mtcars, aes(x = mpg)) + geom_histogram(aes(y = ..density..), fill = "red") + stat_function( fun = dnorm, args = with(mtcars, c(mean = mean(mpg), sd = sd(mpg)))

[R] Trouble building R 2.9.2 under solaris 10

2009-09-02 Thread Frank Carreiro
I've been trying to compile 2.9.2 under solaris 10 the last couple days without success. configure runs fine and I'm using GNU Make. We're trying to build under 64 bit (and I'm wondering if this might be part of our problem). Here is the output from the make... ld: warning: file /usr/local/

[R] Howto fit normal curve into histogram using GGPLOT2

2009-09-02 Thread Gundala Viswanath
Currently, I am doing it this way. x <- mtcars$mpg h<-hist(x, breaks=10, col="red", xlab="Miles Per Gallon", main="Histogram with Normal Curve") xfit<-seq(min(x),max(x),length=40) yfit<-dnorm(xfit,mean=mean(x),sd=sd(x)) yfit <- yfit*diff(h$mids[1:2])*length(x) lines(xfit, yfit, col="blue", lwd=

Re: [R] Avoiding loops

2009-09-02 Thread stephen sefick
If you can do it- try a for loop and another solution to prove this to yourself. A for loop can get a little unwieldy for a novice like me to understand the code, but doable. The simpler the better, but they are not terribly slow. I have run into a couple of situations where a vectorized solutio

Re: [R] Avoiding loops

2009-09-02 Thread hadley wickham
> Would like some tips on how to avoid loops as I know they are slow in R They are not slow. They are slower than vectorised equivalents, but not slower than apply and friends. Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https:/

Re: [R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
Thanks a million Thierry. I solved the problem with new installation. I apologize for troubling you in this trivial matter. - G.V. On Wed, Sep 2, 2009 at 10:26 PM, ONKELINX, Thierry wrote: > I'm using the latest version: 0.8.3 on R 2.9.2 > > > -

  1   2   >