Re: [R] how to retrieve user coordinates in xyplot

2010-10-08 Thread Deepayan Sarkar
On Fri, Oct 8, 2010 at 3:52 PM, array chip wrote: > Hi, is there a way to retrieve the extremes of the user coordinates of the > plotting region, like what par("usr") does in general graphics? I'd like to > use > them to print additional texts at certain place inside each panel. Thanks ?current.

Re: [R] point characters THICKER in xyplot()

2010-10-08 Thread Deepayan Sarkar
On Fri, Oct 8, 2010 at 5:19 PM, array chip wrote: > Hi, how can I make the point characters thicker (NOT larger) in xyplot when > groups= argument is used? > > dat<-data.frame(x=1:100,y=1:100,group=rep(LETTERS[1:5],each=20)) > >    ### lwd=2 doesn't work here > xyplot(y~x,groups=group,data=dat,col

Re: [R] own TAB expansion

2010-10-08 Thread Deepayan Sarkar
On Fri, Oct 8, 2010 at 6:19 AM, Sebastian Gibb wrote: > Hello Duncan, > > thank for your advice, but it doesn't work like expected: > > setClass(Class="A", representation=representation(slotA="numeric", > slotB="numeric")); > setMethod("$", "A", function(x, name) {return(slot(x, name));}) > setGen

Re: [R] Error message in as.brob Usage

2010-10-08 Thread HC
Thank you very much Josh. Yes, I notice that there is indeed some NAs going into the as.brob function that I was using. I think I have to resolve that before invoking the as.brob function. Thanks again. Chow -- View this message in context: http://r.789695.n4.nabble.com/Error-message-in-as-brob

Re: [R] Memory management in R

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 9:19 PM, Mike Marchywka wrote: From: dwinsem...@comcast.net To: lorenzo.ise...@gmail.com Date: Fri, 8 Oct 2010 19:30:45 -0400 CC: r-help@r-project.org Subject: Re: [R] Memory management in R On Oct 8, 2010, at 6:42 PM, Lorenzo Isella

Re: [R] Memory management in R

2010-10-08 Thread Mike Marchywka
> From: dwinsem...@comcast.net > To: lorenzo.ise...@gmail.com > Date: Fri, 8 Oct 2010 19:30:45 -0400 > CC: r-help@r-project.org > Subject: Re: [R] Memory management in R > > > On Oct 8, 2010, at 6:42 PM, Lorenzo Isella wrote: > > > Please find below

Re: [R] Bug in as.POSIXct regarding AM/PM

2010-10-08 Thread 曾振兴
My locale information is as follows: > sessionInfo() R version 2.11.1 (2010-05-31) i386-pc-mingw32 locale: [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936 [3] LC_MONETARY=Chinese (Simplified)_People's Republ

Re: [R] saving object function

2010-10-08 Thread Joe P King
That’s what I was wanting was nice output, I suppose I framed my query wrong, but this is what I wanted! Thank you. Joe King 206-913-2912 j...@joepking.com "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt -Original Message--

Re: [R] saving object function

2010-10-08 Thread Joshua Wiley
Hi Joe, There is an important distinction between working with data and presenting data. You do not want to change or get rid of the missing values in the actual data. Believe it or not, this buys you something important. Since appearance only matters for presentation, you can fudge what the da

Re: [R] saving object function

2010-10-08 Thread Joe P King
I did what you said and it worked perfectly, but I have tried to save some of my objects using paste because I want to limit the number of significant digits and one matrix has some empty spaces I use NA in, and I want those left blank, but when I paste into an object it doesn’t hold that format

[R] ncdf installation in R

2010-10-08 Thread Sashi Challa
Hi All, I am trying to install ncdf package on a Linux 64-bit machine. I successfully installed netcdf using this command, ./configure --prefix=/home/challar/netcdf/ --disable-netcdf4 I then tried to install ncdf package in R R CMD INSTALL --configure-args="-with-netcdf_incdir=/home/challar/ne

[R] question related to multiple regression

2010-10-08 Thread SNN
Hi, I am conducting an association analysis of genotype and a phenotype such as cholesterol level as an outcome and the genotype as a regressor using multiple linear regression. There are 3 possibilities for the genotype AA, AG, GG. There are 5 people with the AA genotype, 100 with the AG genoty

[R] [R-pkgs] update to exact2x2 package

2010-10-08 Thread Fay, Michael (NIH/NIAID) [E]
Hi all, I have updated the exact2x2 package. The update corrects an error that can sometimes occur in the confidence intervals when the number of counts are large and tsmethod="minlike". In addition to fixing the bug, the correction gives a much faster method for calculating the confidence inte

Re: [R] Memory management in R

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 6:42 PM, Lorenzo Isella wrote: Thanks for lending a helping hand. I put together a self-contained example. Basically, it all relies on a couple of functions, where one function simply iterates the application of the other function. I am trying to implement the so-called L

[R] experience with nvmax(max size of subsets to examine)

2010-10-08 Thread CZ
Hello, I am using regsubsets function in leaps package. And I did some experiments with the parameter nvmax( max size of subsets to examine) and got some weird observations. What I did is: I used around 100 or about 600 variables and called function regsubsets(data, nvmax=1...), I got a mat

[R] point characters THICKER in xyplot()

2010-10-08 Thread array chip
Hi, how can I make the point characters thicker (NOT larger) in xyplot when groups= argument is used? dat<-data.frame(x=1:100,y=1:100,group=rep(LETTERS[1:5],each=20)) ### lwd=2 doesn't work here xyplot(y~x,groups=group,data=dat,col=1:4,pch=1:4,lwd=2) ### lwd=2 works with panel.points(),

[R] Plot data on year/mon/day

2010-10-08 Thread Eric Hu
Hi, I am trying to use rect (R2.11) to plot a set of data as following Company Pt Pri Pub A W200 4/5/2009 3/11/2010 B W293 2/30/2003 3/24/2005 A W258 2/8/2008 8/17/2010 C W248 5/13/2009 1/2/2010 %y <- seq(0,0.5*(length(company)-1),0.5) %h <- 0.1 %rect(pri, y-h, pub, y+h, col=

[R] how to retrieve user coordinates in xyplot

2010-10-08 Thread array chip
Hi, is there a way to retrieve the extremes of the user coordinates of the plotting region, like what par("usr") does in general graphics? I'd like to use them to print additional texts at certain place inside each panel. Thanks John [[alternative HTML version deleted]] __

Re: [R] Memory management in R

2010-10-08 Thread Lorenzo Isella
Thanks for lending a helping hand. I put together a self-contained example. Basically, it all relies on a couple of functions, where one function simply iterates the application of the other function. I am trying to implement the so-called Lempel-Ziv entropy estimator. The idea is to choose a p

Re: [R] Efficiency Question - Nested lapply or nested for loop

2010-10-08 Thread Gabor Grothendieck
On Fri, Oct 8, 2010 at 12:47 PM, Gabor Grothendieck wrote: > On Fri, Oct 8, 2010 at 11:35 AM, epowell wrote: >> >> My data looks like this: >> >>> data >>  name G_hat_0_0 G_hat_1_0 G_hat_2_0 G_0 G_hat_0_1 G_hat_1_1 G_hat_2_1 G_1 >> 1  rs0  0.488000  0.448625  0.063375   1  0.480875  0.454500  0.0

Re: [R] Linux 64-bit R installation problem - "Failed dependencies"

2010-10-08 Thread noclue_
Hi. Marc, Thanks so much for your reply. Have a nice weekend! Tim -- Original Message -- From: "Marc Schwartz-3 [via R]" To: noclue_ Subject: Re: Linux 64-bit R installation problem - "Failed dependencies" Date: Thu, 7 Oct 2010 05:31:26 -0700 (PDT) On Oct 7, 2010, at 3:50 AM

Re: [R] incorrect number of levels

2010-10-08 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Chagaris, Dave > Sent: Friday, October 08, 2010 12:04 PM > To: r-help@r-project.org > Subject: [R] incorrect number of levels > > I have a data set 382 rows and 63 columns. On

[R] append rows to Sybase datatable using RJDBC function dbWriteTable

2010-10-08 Thread Li, Jing Yi
Does anyone have experience using RJDBC library to write to Sybase datatable? The jdbc driver I am using is jConnect 6.0. I can successfully write into a new datatable, but have problem appending rows to existing one. It either complains "Table *** already exists" or simply overwrite the existing o

Re: [R] Bug in as.POSIXct regarding AM/PM

2010-10-08 Thread Ei-ji Nakama
Hi, > Sys.setenv(TZ="PRC") > Sys.setlocale("LC_TIME", "Chinese") [1] "Chinese (Simplified)_People's Republic of China.936" > as.POSIXct("2009/03/26 01:00:00 上午" , format="%Y/%m/%d %I:%M:%S %p") [1] "2009-03-26 01:00:00 CST" > as.POSIXct("2009/03/26 01:00:00 下午" , format="%Y/%m/%d %I:%M:%S %p") [1]

Re: [R] incorrect number of levels

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 4:37 PM, David Winsemius wrote: On Oct 8, 2010, at 3:04 PM, Chagaris, Dave wrote: I have a data set 382 rows and 63 columns. One of the columns is bay, and there are 6 bays. But, the number of levels for this factor is 7 when it should be six because there is some 'b

Re: [R] incorrect number of levels

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 3:04 PM, Chagaris, Dave wrote: I have a data set 382 rows and 63 columns. One of the columns is bay, and there are 6 bays. But, the number of levels for this factor is 7 when it should be six because there is some 'blank' level "". When I subset for the blank level "

Re: [R] vector access

2010-10-08 Thread Joshua Wiley
Dear Xin, You really provided great information! You can use the function, names(). Here is an example: # mimic your data a <- c("ae21" = 1.863869) a names(a) # the result should be > names(a) [1] "ae21" Hope that helps, and thanks for making it easy to answer, Josh On Fri, Oct 8, 2010 at 11

Re: [R] Testing for existence of object within a function

2010-10-08 Thread Gabor Grothendieck
On Fri, Oct 8, 2010 at 4:05 PM, Eli Holmes wrote: > I'm still trying to sort out if I can tell the function not to use > values in the user workspace if they don't exist locally in a > function, i.e. a "use local variables only" option when defining a > function. Obviously, I could go to a style o

Re: [R] vector access

2010-10-08 Thread Henrique Dallazuanna
names(a) On Fri, Oct 8, 2010 at 3:07 PM, Xgong wrote: > > Hi, > > I have a question about vector access. sorry if it is too basic. > > > a > ae21 >1.863869 > > My question is how to retrieve "ae21" from vector "a". here is some other > information you might need. > > > str(a) > Named num 1.

[R] incorrect number of levels

2010-10-08 Thread Chagaris, Dave
I have a data set 382 rows and 63 columns. One of the columns is bay, and there are 6 bays. But, the number of levels for this factor is 7 when it should be six because there is some 'blank' level "". When I subset for the blank level "", I get 0 rows. What in my data could be causing this?

Re: [R] Memory management in R

2010-10-08 Thread Mike Marchywka
> Date: Fri, 8 Oct 2010 13:30:59 -0400 > From: jholt...@gmail.com > To: lorenzo.ise...@gmail.com > CC: r-help@r-project.org > Subject: Re: [R] Memory management in R > > More specificity: how long is the string, what is the pattern you are > matching a

[R] vector access

2010-10-08 Thread Xgong
Hi, I have a question about vector access. sorry if it is too basic. > a ae21 1.863869 My question is how to retrieve "ae21" from vector "a". here is some other information you might need. > str(a) Named num 1.86 - attr(*, "names")= chr"ae21" > class(a) [1] "numeric" > is.vector(a) [1

Re: [R] Time OffSet From GMT - Losing it

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 3:43 PM, rivercode wrote: Losing time offset from GMT: sTime = as.POSIXct(paste("2008-03-03","09:30:01"), origin="1970-01-01") sTime [1] "2008-03-03 09:30:01 EST" < 9.31am EST sTime [1] 1204554601 t = as.numeric(sTime) as.POSIXct(t, origin="1970-01-01") [1

Re: [R] Testing for existence of object within a function

2010-10-08 Thread Eli Holmes
Thanks for the help. After looking over the answers, I've come up with some revised code: # To simply test if an argument was passed in, missing() can be used # However, if arg defined later, missing() will return TRUE instead of false a=1 #put a in global environment tst <- function(a,b=1) { if

[R] Time OffSet From GMT - Losing it

2010-10-08 Thread rivercode
Losing time offset from GMT: > sTime = as.POSIXct(paste("2008-03-03","09:30:01"), origin="1970-01-01") > sTime [1] "2008-03-03 09:30:01 EST" < 9.31am EST > sTime [1] 1204554601 > t = as.numeric(sTime) > as.POSIXct(t, origin="1970-01-01") [1] "2008-03-03 14:30:01 EST" <- no tz option

Re: [R] Trapezoid Rule

2010-10-08 Thread Ravi Varadhan
I appreciate your honesty, but this is not a forum for getting your homework done. There is a reason why your professor assigns homework, which is for you to learn. By getting us to solve your homework problems, you are defeating that purpose, and more importantly, you are wasting your time, your

[R] Communicating with an R daemon from perl

2010-10-08 Thread Saeed Abu Nimeh
Is there a way to communicate with a running R daemon from perl. I tried RSPerl but the functions there initiate an R instance first. I would like to keep an R instance running in the background and communicate with it using Perl. The problem is due to a large object that we need which has to be lo

Re: [R] Can Sweave be instructed to use the cairo graphics device?

2010-10-08 Thread Duncan Murdoch
On 08/10/2010 2:45 PM, Levy, Roger wrote: I'm writing a book using Sweave which includes Unicode characters which R's postscript and pdf graphics devices don't handle properly. The cairo graphics device does handle these characters properly. Thus I'd like to be able to instruct Sweave to us

Re: [R] Odp: Vector replace 0 elements without using a loop

2010-10-08 Thread rivercode
Petr and Bill, Thanks for your replies. I have gone with Petr use of na.locf(), but expect I can use Bill's full function in the near future. Chris -- View this message in context: http://r.789695.n4.nabble.com/Vector-replace-0-elements-without-using-a-loop-tp2966191p2968909.html Sent from th

[R] Can Sweave be instructed to use the cairo graphics device?

2010-10-08 Thread Levy, Roger
I'm writing a book using Sweave which includes Unicode characters which R's postscript and pdf graphics devices don't handle properly. The cairo graphics device does handle these characters properly. Thus I'd like to be able to instruct Sweave to use cairo (either sometimes or always) to produ

Re: [R] tools:::fetchRdDB can't allocate memory block?

2010-10-08 Thread Ken Williams
On Oct 8, 11:32 am, Prof Brian Ripley wrote: > (1) Package development is an R-devel topic -- please see the posting > guide. I'll repost there, thanks. -Ken __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE d

Re: [R] saving object function

2010-10-08 Thread Joe P King
Thank you, well I have a table I am wanting to print, yet I want it in a matrix but it has different number of columns, so if I had a table of 1 1 1 2 2 Is there a way to get that table to print out as an object without having to put an NA or 0 in the last cell? Joe King 206-913-2912 j...@joe

Re: [R] many datasets run with one R script in a computer cluster

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 12:33 PM, Martin Hughes wrote: Hello Everyone I have an R script (and a source file which I keep my functions) that I need to run on 70 data sets (each consisting of a pair of files). I wish to run these data sets in a computer cluster that is run by my uni (HOWEVER

[R] Trapezoid Rule

2010-10-08 Thread craig
Dear R Users, I've never used R before and my professor has asked us to do some pretty intense programming (or it's intense to me at least). Here is the question: Modify the function myquadrature inside the script so that it returns the quadrature of descrete data using the trapezoidal rule

Re: [R] conditional replacement of contiguous values

2010-10-08 Thread Henrique Dallazuanna
Try this: replace(have, mapply(seq, which(have), which(have) + 3), TRUE) On Fri, Oct 8, 2010 at 2:07 PM, andrewjt wrote: > > Hello, > I need help getting from data$HAVE to data$NEED (see below). This requires > replacing every TRUE in data$HAVE with 4 TRUE(s) in data$NEED. > > Any ideas? It see

Re: [R] [Rd] Selecting multiple columns with same name

2010-10-08 Thread Steven McKinney
This is better suited for R-help than R-devel, so I'm copying to the R-help list: > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf Of Martin Kerr > Sent: October-08-10 3:09 AM > To: r-de...@r-project.org > Subject: [Rd] Selecti

[R] conditional replacement of contiguous values

2010-10-08 Thread andrewjt
Hello, I need help getting from data$HAVE to data$NEED (see below). This requires replacing every TRUE in data$HAVE with 4 TRUE(s) in data$NEED. Any ideas? It seems straight forward but I can't figure it out! Thanks in advance HAVE NEED 1 FALSE FALSE 2 FALSE

Re: [R] Memory management in R

2010-10-08 Thread jim holtman
More specificity: how long is the string, what is the pattern you are matching against? It sounds like you might have a complex pattern that in trying to match the string might be doing a lot of back tracking and such. There is an O'Reilly book on Mastering Regular Expression that might help you

[R] many datasets run with one R script in a computer cluster

2010-10-08 Thread Martin Hughes
Hello Everyone I have an R script (and a source file which I keep my functions) that I need to run on 70 data sets (each consisting of a pair of files). I wish to run these data sets in a computer cluster that is run by my uni (HOWEVER they cannot help me with this problem but say it is

[R] Heatmap/Color Selection(Key)

2010-10-08 Thread rashid kazmi
Hi I made heatmap of QTL based on Lod score. Where I have traits in columns and marker data (rows). I can not cluster both column and rows as I need the right order for marker data. Can someone suggest me better way of generating heatmaps especially the colour key I want to select to visualize th

Re: [R] Memory management in R

2010-10-08 Thread Doran, Harold
These questions are OS-specific. Please provide sessionInfo() or other details as needed -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Lorenzo Isella Sent: Friday, October 08, 2010 1:12 PM To: r-help Subject: [R] Memory managemen

Re: [R] Memory management in R

2010-10-08 Thread Lorenzo Isella
On 10/08/2010 07:25 PM, Doran, Harold wrote: These questions are OS-specific. Please provide sessionInfo() or other details as needed I see. I am running R on a 64 bit machine running Ubuntu 10.04 > sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_US

Re: [R] Error when using anova(lm())

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 1:17 PM, Alison Callahan wrote: Hi again On Fri, Oct 8, 2010 at 1:13 PM, David Winsemius > wrote: On Oct 8, 2010, at 1:09 PM, Alison Callahan wrote: See below. On Fri, Oct 8, 2010 at 1:01 PM, David Winsemius > wrote: On Oct 8, 2010, at 12:46 PM, Alison Callahan wrote

Re: [R] Error when using anova(lm())

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 1:09 PM, Alison Callahan wrote: See below. On Fri, Oct 8, 2010 at 1:01 PM, David Winsemius > wrote: On Oct 8, 2010, at 12:46 PM, Alison Callahan wrote: Hello all, I am trying to perform an ANOVA on some data in a data frame, but when I try to use lm(), I get the foll

[R] Memory management in R

2010-10-08 Thread Lorenzo Isella
Dear All, I am experiencing some problems with a script of mine. It crashes with this message Error in grepl(fut_string, past_string) : invalid regular expression '12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12653a6#12

Re: [R] Error when using anova(lm())

2010-10-08 Thread Alison Callahan
Hi again On Fri, Oct 8, 2010 at 1:13 PM, David Winsemius wrote: > > On Oct 8, 2010, at 1:09 PM, Alison Callahan wrote: > >> See below. >> >> On Fri, Oct 8, 2010 at 1:01 PM, David Winsemius >> wrote: >>> >>> On Oct 8, 2010, at 12:46 PM, Alison Callahan wrote: >>> Hello all, I am tr

Re: [R] Error when using anova(lm())

2010-10-08 Thread Alison Callahan
See below. On Fri, Oct 8, 2010 at 1:01 PM, David Winsemius wrote: > > On Oct 8, 2010, at 12:46 PM, Alison Callahan wrote: > >> Hello all, >> >> I am trying to perform an ANOVA on some data in a data frame, but when >> I try to use lm(), I get the following error: >> >> Error in storage.mode(y) <-

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Henrique Dallazuanna
Try this: aggregate(cbind(val, val2) ~ grp, cbind(grp, !is.na(dta[-1])), sum) On Fri, Oct 8, 2010 at 12:13 PM, Marcus Drescher wrote: > I am sorry for the typo, it is about counting two columns an skipping the > NAs. > > How would I have to set the formula if I would have two columns to count

Re: [R] Error when using anova(lm())

2010-10-08 Thread David Winsemius
On Oct 8, 2010, at 12:46 PM, Alison Callahan wrote: Hello all, I am trying to perform an ANOVA on some data in a data frame, but when I try to use lm(), I get the following error: Error in storage.mode(y) <- "double" : invalid to change the storage mode of a factor In addition: Warning messa

Re: [R] Efficiency Question - Nested lapply or nested for loop

2010-10-08 Thread Gabor Grothendieck
On Fri, Oct 8, 2010 at 11:35 AM, epowell wrote: > > My data looks like this: > >> data >  name G_hat_0_0 G_hat_1_0 G_hat_2_0 G_0 G_hat_0_1 G_hat_1_1 G_hat_2_1 G_1 > 1  rs0  0.488000  0.448625  0.063375   1  0.480875  0.454500  0.064625   1 > 2  rs1  0.002375  0.955375  0.042250   1  0.00  0.06

[R] Error when using anova(lm())

2010-10-08 Thread Alison Callahan
Hello all, I am trying to perform an ANOVA on some data in a data frame, but when I try to use lm(), I get the following error: Error in storage.mode(y) <- "double" : invalid to change the storage mode of a factor In addition: Warning message: In model.response(mf, "numeric") : using type="nu

Re: [R] R: Why this deosn't work?, matrix, rounding error?

2010-10-08 Thread skan
It's a problem much bigger. I use a matrix to store the results of a bigger problem. I loop through several variables and store the results of a computation on that matrix. At the beginning of the problem I initialize the matrix to zeros and I calculate its size from some input. And that seems no

Re: [R] tools:::fetchRdDB can't allocate memory block?

2010-10-08 Thread Prof Brian Ripley
On Fri, 8 Oct 2010, Ken Williams wrote: I'm developing an R package, and when I recompile (using Roxygen), detach, and re-load the package, I can't seem to look at some of its documented functions. When I try '?function.name', I get the following error: Error in tools:::fetchRdDB(RdDB, basena

Re: [R] Efficiency Question - Nested lapply or nested for loop

2010-10-08 Thread David Winsemius
You are loosing a lot of time by repeatedly calculating character indices with paste() in every iteration. Two options: -- 1) calculate these once outside the loop and then refer to them by index idx.names <- vector(mode="character", length=nind) for (i in (0:(nind-1))) {idx[i+1] <-# ne

Re: [R] Looking for a book/tutorial with the following context:

2010-10-08 Thread Hadley Wickham
> Do you also know more references about variables? Unfortunately this was a > little bit short so I do not feel 100% sure I completely got it. Try here: http://github.com/hadley/devtools/wiki/Scoping It's a work in progress. Hadley -- Assistant Professor / Dobelman Family Junior Chair Departm

Re: [R] Import Multiple csv files and merge into one Master file

2010-10-08 Thread Dennis Murphy
Hi: An alternative approach with a few less keystrokes, using the plyr package: library(plyr) # Create some example data files, populate them and write them out using write.csv: fnames <- c(paste('file0', 1:9, '.csv', sep = '')) for(i in seq_along(fnames)) { d <- data.frame(x = rnorm(3), y

Re: [R] Meta-analysis question

2010-10-08 Thread Joshua Wiley
Dear Jan, It depends what you are looking to do. For the studies that have given you means and standard deviations, if you want a d effect size, you should already be set (Mean1 - Mean2)/control standard deviation or the pooled standard deviation if you prefer. For the studies where you just hav

Re: [R] function using values separated by a comma

2010-10-08 Thread Jeffrey Spies
Here's another method without using any external regular expression libraries: dat <- read.table(tc <- textConnection( '0,1 1,3 40,10 0,0 20,5 4,2 10,40 10,0 0,11 1,2 120,10 0,0'), sep="") mat <- apply(dat, c(1,2), function(x){ temp <- as.numeric(unlist(strsplit(x, ','))) min(temp

Re: [R] Looking for a book/tutorial with the following context:

2010-10-08 Thread Greg Snow
A free book is available at: http://www.burns-stat.com/pages/spoetry.html Or the book S Programming by Venables and Ripley is another great source of information on programming in S/R. There are additional books listed at: http://www.r-project.org/doc/bib/R-books.html as well as much free docu

[R] tools:::fetchRdDB can't allocate memory block?

2010-10-08 Thread Ken Williams
I'm developing an R package, and when I recompile (using Roxygen), detach, and re-load the package, I can't seem to look at some of its documented functions. When I try '?function.name', I get the following error: Error in tools:::fetchRdDB(RdDB, basename(file)) : cannot allocate memory blo

Re: [R] Writing R code for "moments"

2010-10-08 Thread Ethan Brown
Hi July, You might want to check out the "moments" package. It has a couple functions, "all.moments()" and "moment()" that will compute these for you. By the way, "RSeek.org" is a great place to find packages like this; I searched for "sample moments" and clicked on the "functions" tab to find th

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Felipe Carrillo
Here is an option: grp = c(1,1,1, 1,2, 2,2)  val = c(2,1,5,NA,3,NA,1)  dta = data.frame(grp=grp, val=val) ddply(dta,"grp",summarise,count=length(na.omit(val)))   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA - Original

Re: [R] R: Why this deosn't work?, matrix, rounding error?

2010-10-08 Thread jim holtman
To make it "work", use "round" to take care of the issues in FAQ 7.31 resul <- matrix(rep(0,round(ncota*nslope*4)),round(ncota*nslope),4) On Fri, Oct 8, 2010 at 11:27 AM, skan wrote: > > Hello > > Why this works: > ncota <- 1 > nslope <- 29 > resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,

[R] extract data.table from XML

2010-10-08 Thread YuriWerewolf
Hi to all members of this list, i'm trying to parse an XML file and it seems that it's not very straightforward. I managed to get to the node that has a lot of sub nodes with similar format, i.e. : $Purchase -2000.1 29510.27 $Purchase -2000 29507.26 I was wondering what is the way to p

[R] Efficiency Question - Nested lapply or nested for loop

2010-10-08 Thread epowell
My data looks like this: > data name G_hat_0_0 G_hat_1_0 G_hat_2_0 G_0 G_hat_0_1 G_hat_1_1 G_hat_2_1 G_1 1 rs0 0.488000 0.448625 0.063375 1 0.480875 0.454500 0.064625 1 2 rs1 0.002375 0.955375 0.042250 1 0.00 0.062875 0.937125 2 3 rs2 0.050375 0.835875 0.113750

Re: [R] Import Multiple csv files and merge into one Master file

2010-10-08 Thread Joshua Wiley
Hi Xinli, You will probable have to tweak this some for it to work for you, but it at least gives you an idea. First put all your files in one directory, then you use the list.files() function to read into R the names of every file in that directory (this is easier than typing all 100 something n

Re: [R] R: Why this deosn't work?, matrix, rounding error?

2010-10-08 Thread jim holtman
FAQ 7.31 On Fri, Oct 8, 2010 at 11:27 AM, skan wrote: > > Hello > > Why this works: > ncota <- 1 > nslope <- 29 > resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4) > > > > But this doesn't? > ncota <- 1 > sini <- 0.1; sfin <- 1.5; spaso <- 0.05; nslope <- 1+((sfin-sini)/spaso) > resul <- matr

Re: [R] R CMD SHLIB changes function name when compiling

2010-10-08 Thread Steve Pederson
It seems that was the problem. My apologies as I was unaware of the difference between a .c file & a .C file. Thanks again for your help, Steve On 9/10/2010 1:37 AM, Prof Brian Ripley wrote: Is the file .c or .C? You said .c, but then you said a .C file worked (which it should not have), a

[R] R: Why this deosn't work?, matrix, rounding error?

2010-10-08 Thread skan
Hello Why this works: ncota <- 1 nslope <- 29 resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4) But this doesn't? ncota <- 1 sini <- 0.1; sfin <- 1.5; spaso <- 0.05; nslope <- 1+((sfin-sini)/spaso) resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4) I guess the problem is that the divi

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread ONKELINX, Thierry
Have a look at table table(na.omit(dta)$grp) Untested! ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Natur

[R] Meta-analysis question

2010-10-08 Thread kende jan
Dear all, I am trying to do meta-analysis of continuous outcome data. Twelve studies are selected but for six of them, i have only p-values and the six other means and standard deviation for the two groups (Experimental and Control). How can I do with R to take into account p-values and/or mean

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Marcus Drescher
I am sorry for the typo, it is about counting two columns an skipping the NAs. How would I have to set the formula if I would have two columns to count (val1 and val2)? Betreff: Re: [R] Count values in a dataframe with respect to groups Try this: aggregate(val ~ grp, dta, length) On Fri, Oct

Re: [R] R CMD SHLIB changes function name when compiling

2010-10-08 Thread Prof Brian Ripley
Is the file .c or .C? You said .c, but then you said a .C file worked (which it should not have), and I wonder if you have this backwards. A .c file is C, a .C file is C++ (in R 2.11.1 but not R 2.12.0). extern "C" would be required if this were a C++ source, but we were told otherwise. On

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Marcus Drescher
Thanks! It works great. One more question: how would I have to set the formula if I would have the columns to count (val1 and val2)? Betreff: Re: [R] Count values in a dataframe with respect to groups Try this: aggregate(val ~ grp, dta, length) On Fri, Oct 8, 2010 at 11:28 AM, Marcus Dresche

Re: [R] R CMD SHLIB changes function name when compiling

2010-10-08 Thread Mike Marchywka
> Date: Sat, 9 Oct 2010 01:21:47 +1030 > From: stephen.peder...@adelaide.edu.au > To: rip...@stats.ox.ac.uk > CC: r-help@r-project.org > Subject: Re: [R] R CMD SHLIB changes function name when compiling > > I think I should also add that I have comp

Re: [R] R CMD SHLIB changes function name when compiling

2010-10-08 Thread Steve Pederson
I think I should also add that I have compiled R from source so am pretty confident that I have the correct set of Rtools. On 8/10/2010 8:06 PM, Prof Brian Ripley wrote: On Fri, 8 Oct 2010, Steve Pederson wrote: Hi, I'm trying to write a function in C for implementation with .Call. When com

Re: [R] R CMD SHLIB changes function name when compiling

2010-10-08 Thread Steve Pederson
Hi Prof Ripley, Thanks for the response & the use of the correct terminology. I've checked the environment variables & there is none set called CC. The .dll was definitely compiled using R CMD SHLIB. I'm not quite sure what output you're referring to but at the command prompt when I enter:

Re: [R] function using values separated by a comma

2010-10-08 Thread Gabor Grothendieck
On Fri, Oct 8, 2010 at 10:18 AM, Gabor Grothendieck wrote: > On Fri, Oct 8, 2010 at 1:19 AM, burgundy wrote: >> >> Hello, >> >> I have a dataframe (tab separated file) which looks like the example below - >> two values separated by a comma, and tab separation between each of these. >> >>     [,1]

Re: [R] Count values in a dataframe with respect to groups

2010-10-08 Thread Henrique Dallazuanna
Try this: aggregate(val ~ grp, dta, length) On Fri, Oct 8, 2010 at 11:28 AM, Marcus Drescher wrote: > Dear all, > > I am looking for a function to count values belonging to a class within a > dataframe (and ignore NAs). > > grp = c(1,1,1, 1,2, 2,2) > val = c(2,1,5,NA,3,NA,1) > > dta = data.fra

Re: [R] MANCOVA

2010-10-08 Thread Jonathan DuBois
Thanks so much Peter, If doing linear regression with a similar goal - to determine a relationship corrected for age, is there a similar procedure? I have been using: >lm(Y~X+age) However, I am guessing from the previous response that this was simply including both X and age as independent varia

[R] Count values in a dataframe with respect to groups

2010-10-08 Thread Marcus Drescher
Dear all, I am looking for a function to count values belonging to a class within a dataframe (and ignore NAs). grp = c(1,1,1, 1,2, 2,2) val = c(2,1,5,NA,3,NA,1) dta = data.frame(grp=grp, val=val) The result should look like: grp count 13 22 At the moment, I am trying to find a fun

Re: [R] function using values separated by a comma

2010-10-08 Thread Gabor Grothendieck
On Fri, Oct 8, 2010 at 1:19 AM, burgundy wrote: > > Hello, > > I have a dataframe (tab separated file) which looks like the example below - > two values separated by a comma, and tab separation between each of these. > >     [,1]  [,2]  [,3]  [ ,4] > [1,] 0,1  1,3   40,10  0,0 > [2,] 20,5  4,2  10

Re: [R] Deleting observations - can't see the data after that

2010-10-08 Thread Schwab,Wilhelm K
Josh, How about the direct approach: grep or otherwise search the source? If you can guess the form of a printf()-like statement, then it might be easy to find. More likely, one would have to overlay results of a few different searches. Maybe someone who is actively working on the code will

Re: [R] Writing R code for "moments"

2010-10-08 Thread Ben Bolker
July gmail.com> writes: > (1) How can I write R code to compute the moments around zero of order one > to four? > > (2) How can I write R code to compute the moments around the mean of order > one to four? Just checking: is this homework? Why do you need to do this? What is your input: a li

Re: [R] confusion matrix

2010-10-08 Thread Claudia Beleites
Gregory Ryslik wrote: Hi, Thank you for the help! Would this imply then that if my "answers" and "predicted" are both matrices, I need to first make them into factors? I was hoping to avoid that step... Why are they matrices? What is the additional dimension? And: what should become of the addi

Re: [R] Bug in as.POSIXct regarding AM/PM

2010-10-08 Thread Prof Brian Ripley
On Fri, 8 Oct 2010, David Winsemius wrote: On Oct 8, 2010, at 5:54 AM, Ted Zeng (曾振兴) wrote: Dear All, I encounted in a problem with as.POSIXct() function. as.POSIXct("2009/03/26 01:00:00 AM" , format="%Y/%m/%d %I:%M:%S %p") [1] NA as.POSIXct("2009/03/26 02:00:00 PM" , format="%Y/%m/%d

Re: [R] confusion matrix

2010-10-08 Thread Claudia Beleites
Dear Greg, If it is only the NA that worries you: function table can deal with that. ? table and: example (table) If you want to make a confusion matrix that works also with fractional answers (e.g. 50% A, 50% B, a.k.a soft classification) then you can contact me and become test user of a pack

Re: [R] Bug in as.POSIXct regarding AM/PM

2010-10-08 Thread Gabor Grothendieck
On Fri, Oct 8, 2010 at 5:54 AM, Ted Zeng (曾振兴) wrote: > > Dear All, > > I encounted in a problem with as.POSIXct() function. > >> as.POSIXct("2009/03/26 01:00:00 AM" , format="%Y/%m/%d %I:%M:%S %p") > [1] NA >> as.POSIXct("2009/03/26 02:00:00 PM" , format="%Y/%m/%d %I:%M:%S %p") > [1] NA > > I hav

Re: [R] first post and bootstarpping problems

2010-10-08 Thread Tim Hesterberg
>I use R for a year now and am dealing with geometric morphometrics of deer >skulls. Yes, I am a biologist and my math skills are just beginning to brush >up. To cut to the chase... > >I have two groups in my data (males and females) and my data is in a simple >vector form. Now I need a bootstra

Re: [R] font question on pdf device

2010-10-08 Thread Ted Harding
On 08-Oct-10 12:44:12, Kari Ruohonen wrote: > Hi, > I wonder if this is something on my machine locally or R in general. > > When I do the following: >> plot(c(0,1),c(0,1),main=expression(paste(symbol("D"),"D",sep=""))) > > I get a plot with a title having uppercase delta followed by "D". But > i

  1   2   >