[R] how to get design matrix?

2009-05-09 Thread linakpl
How do you get the design matrix R used when calculating ANOVA? -- View this message in context: http://www.nabble.com/how-to-get-design-matrix--tp23464638p23464638.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] Sweave \Sexpr{} advice please

2009-05-09 Thread Kyle Matoba
Dear List, First off, my deepest gratitude to the Sweave developers: this tool has improved my quality greatly. A question in my work I use \Sexpr{} statements scalar values and the xtable package for all manner of tables. What I'd like to do is to use a vector inline, rather than a whole separa

[R] What does it mean by skip=2 and skip=7?

2009-05-09 Thread Tung86
Can anyone tell me what is skip=2, skip =7 and %in% mean here? fromcsv=read.csv ('2_2005_top200_postdoc.csv',header=FALSE,skip=7,stringsAsFactors=FALSE) fromreadxls = read.xls ('2_2005_top200_postdoc.xls',stringsAsFactors=FALSE,header=FALSE,skip=2) fromreadxls = fromreadxls[fromreadxls$V7 %in

Re: [R] Beyond double-precision?

2009-05-09 Thread joaks1
Thanks Berwin, Spencer, and Gabor!!! Berwin A Turlach wrote: > > G'day all, > > On Sat, 09 May 2009 08:01:40 -0700 > spencerg wrote: > >> The harmonic mean is exp(mean(logs)). Therefore, log(harmonic >> mean) = mean(logs). >> >> Does this make sense? > > I think you are talk

Re: [R] Comparing COXPH models, one with age as a continuous variable, one with age as a three-level factor

2009-05-09 Thread Greg Finak
?anova.coxph will tell you that there's an additional parameter, test, taking values "F", "Cp", or "Chisq" which instructs the anova method to perform the stated test comparing the two models and spit out a p- value (for F and Chisq at least). example(anova.chisq) provides some examples. Che

Re: [R] I don't see libR.so in my installation directory

2009-05-09 Thread Dirk Eddelbuettel
On 8 May 2009 at 16:17, Tena Sakai wrote: | Maybe I know the answer to my own question. | When I built R 2.9.0, I didn't say: | | ./configure --enable-R-shlib | | I know I have given "--prefix" flag, but that's | the only flag I used. | | I would appreciate it, if someone would give me | a de

[R] Comparing COXPH models, one with age as a continuous variable, one with age as a three-level factor

2009-05-09 Thread John Sorkin
Windows XP R 2.8.1 I am trying to use anova(fitCont,fitCat) to compare two Cox models (coxph) one in which age is entered as a continuous variable, and a second where age is entered as a three-level factor (young, middle, old). The Analysis of Deviance Table produced by anova does not give a p

Re: [R] how to get design matrix?

2009-05-09 Thread David Winsemius
Got code? On May 9, 2009, at 10:29 PM, linakpl wrote: If I was doing an ANOVA analysis how can I get the design matrix R used? -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.et

[R] how to get design matrix?

2009-05-09 Thread linakpl
If I was doing an ANOVA analysis how can I get the design matrix R used? -- View this message in context: http://www.nabble.com/how-to-get-design-matrix--tp23466549p23466549.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] Reading large files quickly

2009-05-09 Thread jim holtman
Since you are reading it in chunks, I assume that you are writing out each segment as you read it in. How are you writing it out to save it? Is the time you are quoting both the reading and the writing? If so, can you break down the differences in what these operations are taking? How do you pl

Re: [R] Reading large files quickly

2009-05-09 Thread Rob Steele
Thanks guys, good suggestions. To clarify, I'm running on a fast multi-core server with 16 GB RAM under 64 bit CentOS 5 and R 2.8.1. Paging shouldn't be an issue since I'm reading in chunks and not trying to store the whole file in memory at once. Thanks again. Rob Steele wrote: > I'm finding th

Re: [R] I don't see libR.so in my installation directory

2009-05-09 Thread cls59
Tena Sakai wrote: > > > > I became aware of such as I was preparing for > an installation of little r. The installation > material stated to look for libR.so, and I want > to make sure that the one I installed (2.9.0) > is used by little r. > > > little r... do you mean the scripting fr

Re: [R] Reading large files quickly

2009-05-09 Thread Jakson Alves de Aquino
Rob Steele wrote: > I'm finding that readLines() and read.fwf() take nearly two hours to > work through a 3.5 GB file, even when reading in large (100 MB) chunks. > The unix command wc by contrast processes the same file in three > minutes. Is there a faster way to read files in R? I use statist

[R] Spatstat

2009-05-09 Thread Richard Chirgwin
Hi all, I am trying to install Spatstat on OpenSUSE 11.1. install.packages("spatstat", dependencies = TRUE) fails on the basis of various compiler packages (full message below). I have gcc version 4.3.2, which should include gfortran and g++ - so I'm not sure what to do!

Re: [R] Citing R/Packages Question

2009-05-09 Thread Achim Zeileis
On Sat, 9 May 2009, roger koenker wrote: I've had an email exchange with the authors of a recent paper in Nature who also made a good faith effort to cite both R and the quantreg package, and were told that the Nature "house style" didn't allow such citations so they were dropped from the publis

Re: [R] Generating a "conditional time" variable

2009-05-09 Thread jim holtman
Corrected version. I forgot the the count had to change 'after' eif==1: #Simulated data frame: year from 1990 to 2003, for 5 different ids, each having one or two eif "events" test<-data.frame(year=rep(1990:2003,5),id=gl(5,length(1990:2003)), eif=as.vector(sapply(1:5,function(z){ a<-r

Re: [R] Generating a "conditional time" variable

2009-05-09 Thread jim holtman
Here is yet another way of doing it (always the case in R): #Simulated data frame: year from 1990 to 2003, for 5 different ids, each having one or two eif "events" test<-data.frame(year=rep(1990:2003,5),id=gl(5,length(1990:2003)), eif=as.vector(sapply(1:5,function(z){ a<-rep(0,length(1

Re: [R] Reading large files quickly

2009-05-09 Thread jim holtman
First 'wc' and readLines are doing vastly different functions. 'wc' is just reading through the file without having to allocate memory to it; 'readLines' is actually storing the data in memory. I have a 150MB file I was trying it on, and here is what 'wc' did on my Windows system: /cygdrive/c: t

Re: [R] Reading large files quickly

2009-05-09 Thread Gabor Grothendieck
You could try it with sqldf and see if that is any faster. It use RSQLite/sqlite to read the data into a database without going through R and from there it reads all or a portion as specified into R. It requires two lines of code of the form: f < file("myfile.dat") DF <- sqldf("select * from f",

Re: [R] Histogram frequencies with a normal pdf curve overlay

2009-05-09 Thread S Ellison
Assuming a constant bin width, you need to multiply the density by n*binwidth, where the bin width is (obviously!) the width of the histogram bins. >>> Jacques Wagnor 05/09/09 5:10 PM >>> Dear List, When I plot a histogram with 'freq=FALSE' and overlay the histogram with a normal pdf curve, ev

[R] clump of binary pixels on raster

2009-05-09 Thread milton ruser
Dear all, I have a set od 30,000 binary landscapes, which represent habitat and non-habitat cover. I need to generate images that identify those neighbour (rule 8) pixels as one patch ID, and a different patch ID for each clump of pixels. I coded it using labcon(adehabitat), but as some of my land

[R] Reading large files quickly

2009-05-09 Thread Rob Steele
I'm finding that readLines() and read.fwf() take nearly two hours to work through a 3.5 GB file, even when reading in large (100 MB) chunks. The unix command wc by contrast processes the same file in three minutes. Is there a faster way to read files in R? Thanks! __

Re: [R] Generating a "conditional time" variable

2009-05-09 Thread William Dunlap
You might try the following function. First it identifies the last element in each run, then the length of each run, then calls sequence() to generate the within-run sequence numbers. my.sequence is a version of sequence that is more efficient (less time, less memory) than sequence when there

Re: [R] a general way to select a subset of matrix rows?

2009-05-09 Thread Henrique Dallazuanna
Yes, use the drop argument; apply(x[rows,,drop=F],2,mean) On Sat, May 9, 2009 at 2:33 PM, Peter Kharchenko < peter.kharche...@post.harvard.edu> wrote: > Dear fellow R users, > I can't figure out how to do a simple thing properly: apply an operation to > matrix columns on a selected subset of r

Re: [R] need help with chisq

2009-05-09 Thread David Winsemius
On May 9, 2009, at 4:53 PM, JC wrote: I am very new to R. I have some data from a CVS stored in vdata with 4 columns labeled: X08, Y08, X09, Y09. I have created two new "columns" like so: Z08 <- (vdata$X08-vdata$Y08) Z09 <- (vdata$X09-vdata$Y09) I would like to use chisq.test for each "row

[R] need help with chisq

2009-05-09 Thread JC
I am very new to R. I have some data from a CVS stored in vdata with 4 columns labeled: X08, Y08, X09, Y09. I have created two new "columns" like so: Z08 <- (vdata$X08-vdata$Y08) Z09 <- (vdata$X09-vdata$Y09) I would like to use chisq.test for each "row" and output the p-value for each in a sto

Re: [R] Generating a "conditional time" variable

2009-05-09 Thread Finak Greg
That will teach me to post without a double-check. On 09/05/09 3:11 PM, "Finak Greg" wrote: Assuming the year column has complete data and doesn't skip a year, the following should take care of 1) #Simulated data frame: year from 1990 to 2003, for 5 different ids, each having one or two eif "

[R] pointers needed to expected values of fractions

2009-05-09 Thread ivo welch
I apologize in advance for a more statistical question. I am trying to find out whether a transformation of two random variables X and Y ( z= g(X,Y) ) exists whose expected value is E(X)/E(Y). obviously, it ain't E(X/Y). is there a book or place where I could learn this? (Also, I would be intere

Re: [R] Generating a "conditional time" variable

2009-05-09 Thread Finak Greg
Assuming the year column has complete data and doesn't skip a year, the following should take care of 1) #Simulated data frame: year from 1990 to 2003, for 5 different ids, each having one or two eif "events" test<-data.frame(year=rep(1990:2003,5),id=gl(5,length(1990:2003)),eif=as.vector(sapply(

[R] "Overloading" some non-dispatched S3 methods for new classes

2009-05-09 Thread Carlos J. Gil Bellosta
Hello, I am building a package that creates a new kind of object not unlike a dataframe. However, it is not an extension of a dataframe, as the data themselves reside elsewhere. It only contains "metadata". I would like to be able to retrieve data from my objects such as the number of rows, the n

[R] sqlSave()

2009-05-09 Thread Felipe Carrillo
Sorry, I'am resending it because I forgot to send my system info(below) Hi all: I have created a MS Access table named 'PredictedValues' through the statement below: myDB <- odbcConnectAccess("C:/Documents and Settings/Owner/Desktop/Rpond Farming.mdb",uid="admin",pwd="") sqlSave(myDB,Predi

[R] sqlSave()

2009-05-09 Thread Felipe Carrillo
Hi all: I have created a MS Access table named 'PredictedValues' through the statement below: myDB <- odbcConnectAccess("C:/Documents and Settings/Owner/Desktop/Rpond Farming.mdb",uid="admin",pwd="") sqlSave(myDB,PredictedValues,rownames=FALSE) close(myDB) But if I run the code again

[R] R package for estimating markov transition matrix from observations + confidence?

2009-05-09 Thread U.H
Dear R gurus, I have data for which I want to estimate the markov transition matrix that generated the sequence, and preferably obtain some measure of confidence for that estimation. e.g., for a series such as 1 3 4 1 2 3 1 2 1 3 4 3 2 4 2 1 4 1 2 4 1 2 4 1 2 1 2 1 3 1 I would want to get an es

[R] a general way to select a subset of matrix rows?

2009-05-09 Thread Peter Kharchenko
Dear fellow R users, I can't figure out how to do a simple thing properly: apply an operation to matrix columns on a selected subset of rows. Things go wrong when only one row is being selected. I am sure there's a way to do this properly. Here's an example: # define a 3-by-4 matrix x > x <-

[R] Generating a "conditional time" variable

2009-05-09 Thread Vincent Arel-Bundock
Hi everyone, Please forgive me if my question is simple and my code terrible, I'm new to R. I am not looking for a ready-made answer, but I would really appreciate it if someone could share conceptual hints for programming, or point me toward an R function/package that could speed up my processin

Re: [R] I'm offering $300 for someone who know R-programming to do the assignments for me.

2009-05-09 Thread markleeds
I hate to start a whole war about this but isn't there some percent chance ( not much but non zero ) that she's willing to pay the 300.00 so that she can get a nice solution that she can then learn from ? I'm definitely guilty of this behavior as a non-student and i forget to

Re: [R] I'm offering $300 for someone who know R-programming to do the assignments for me.

2009-05-09 Thread Wensui Liu
my guess he might ask for production code but just didn't want to tell the truth here. in some software forums, this kind of things happen all the time :-) On Fri, May 8, 2009 at 12:36 PM, Wacek Kusnierczyk wrote: > Simon Pickett wrote: >> I bet at least a few people offered their services! It mi

Re: [R] Rmysql linking to an old-ish mysql build

2009-05-09 Thread Prof Brian Ripley
This topic is usually covered on R-sig-db, so its archives will give more information (and as I recall, so would the R-help archives, not least in pointing you to R-sig-db). On Sat, 9 May 2009, Uwe Ligges wrote: Jose Quesada wrote: Hi, I'm trying to get Rmysql to work o windows server 2008

Re: [R] Histogram frequencies with a normal pdf curve overlay

2009-05-09 Thread Jacques Wagnor
Thank you! On Sat, May 9, 2009 at 11:31 AM, Ted Harding wrote: > On 09-May-09 16:10:42, Jacques Wagnor wrote: >> Dear List, >> When I plot a histogram with 'freq=FALSE' and overlay the >> histogram with a normal pdf curve, everything looks as expected, >> as follows: >> >> x <- rnorm(1000) >> his

Re: [R] Histogram frequencies with a normal pdf curve overlay

2009-05-09 Thread Ted Harding
On 09-May-09 16:10:42, Jacques Wagnor wrote: > Dear List, > When I plot a histogram with 'freq=FALSE' and overlay the > histogram with a normal pdf curve, everything looks as expected, > as follows: > > x <- rnorm(1000) > hist(x, freq=FALSE) > curve(dnorm(x), add=TRUE, col="blue") > > What do I n

Re: [R] Beyond double-precision?

2009-05-09 Thread Gabor Grothendieck
The following packages support high precision precision arithmetic (and the last two also support exact arithmetic): bc - interface to bc calculator http://r-bc.googlecode.com gmp - interface to gmp (gnu multiple precision) http://cran.r-project.org/web/packages/gmp rSymPy - interface to sympy c

Re: [R] Beyond double-precision?

2009-05-09 Thread spencerg
Dear Berwin: Thanks for the elegant correction. Spencer Berwin A Turlach wrote: G'day all, On Sat, 09 May 2009 08:01:40 -0700 spencerg wrote: The harmonic mean is exp(mean(logs)). Therefore, log(harmonic mean) = mean(logs). Does this make sense? I think you are tal

Re: [R] I'm offering $300 for someone who know R-programming to do the assignments for me.

2009-05-09 Thread Gábor Csárdi
That's typical, my profs used to do this to me all the time. G. On Sat, May 9, 2009 at 6:17 PM, Carl Witthoft wrote: > Sorry, but your professor offered me $500 NOT to do your assignments. > > __ > R-help@r-project.org mailing list > https://stat.ethz.

Re: [R] Beyond double-precision?

2009-05-09 Thread Berwin A Turlach
G'day all, On Sat, 09 May 2009 08:01:40 -0700 spencerg wrote: > The harmonic mean is exp(mean(logs)). Therefore, log(harmonic > mean) = mean(logs). > > Does this make sense? I think you are talking here about the geometric mean and not the harmonic mean. :) The harmonic mean is

Re: [R] I'm offering $300 for someone who know R-programming to do the assignments for me.

2009-05-09 Thread Carl Witthoft
Sorry, but your professor offered me $500 NOT to do your assignments. __ 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.org/posting-guide.html and provide commented, m

[R] Histogram frequencies with a normal pdf curve overlay

2009-05-09 Thread Jacques Wagnor
Dear List, When I plot a histogram with 'freq=FALSE' and overlay the histogram with a normal pdf curve, everything looks as expected, as follows: x <- rnorm(1000) hist(x, freq=FALSE) curve(dnorm(x), add=TRUE, col="blue") What do I need to do if I want to show the frequencies (freq=TRUE) with the

Re: [R] Problem with package SNOW on MacOS X 10.5.5

2009-05-09 Thread Rainer Machne
Hi Greg, I don't know if this is related to your problem, but I get the same error (on both ubuntu and fedora linux, R 2.9) and just found a very curious behaviour - snowfall apply functions don't like the variable name "c". E.g.: c<-1 sfLapply(1:10, exp) issues the same error you had poste

Re: [R] for loop

2009-05-09 Thread Uwe Ligges
aledanda wrote: Hi, I need your help. I have a vector of numbers reflecting the switch in the perception of a figure. For a certain period I have positive numbers (which reflect the perception A) then the perception changes and I have negative numbers (perception B), and so on for 4 iterati

Re: [R] Beyond double-precision?

2009-05-09 Thread spencerg
Dear Jamie: The harmonic mean is exp(mean(logs)). Therefore, log(harmonic mean) = mean(logs). Does this make sense? Best Wishes, Spencer joaks1 wrote: Yes, all of the numbers are positive. I actually have a Bayesian posterior sample of log likelihoods [i.e. thous

Re: [R] Rmysql linking to an old-ish mysql build

2009-05-09 Thread Uwe Ligges
Jose Quesada wrote: Hi, I'm trying to get Rmysql to work o windows server 2008 64-bit. I have the latest build of mysql installed (mysql-5.1.34-winx64). Independent of the version number of MySQL (which is less than 6 months old): If you are talking about the RMySQL binary build on CRAN: I

[R] for loop

2009-05-09 Thread aledanda
Hi, I need your help. I have a vector of numbers reflecting the switch in the perception of a figure. For a certain period I have positive numbers (which reflect the perception A) then the perception changes and I have negative numbers (perception B), and so on for 4 iterations. I need to take

Re: [R] Vim R plugin-2

2009-05-09 Thread Leo
> Any alternative ways of sending info both ways from R to any open > process (vim) > in windows? On windows, I'd rather use ole automation. A few years ago I successfully used this plugin: http://www.vim.org/scripts/script.php?script_id=889 I haven't used it since though. _

Re: [R] Citing R/Packages Question

2009-05-09 Thread roger koenker
I've had an email exchange with the authors of a recent paper in Nature who also made a good faith effort to cite both R and the quantreg package, and were told that the Nature "house style" didn't allow such citations so they were dropped from the published paper and the "supplementary materia

Re: [R] Beyond double-precision?

2009-05-09 Thread joaks1
Yes, all of the numbers are positive. I actually have a Bayesian posterior sample of log likelihoods [i.e. thousands of ln(likelihood) scores]. I want to calculate the harmonic mean of these likelihoods, which means I need to convert them back into likelihoods [i.e. e^ln(likelihood)], calculate

Re: [R] Vim R plugin-2

2009-05-09 Thread Tobias Verbeke
Hi Jose, Jose Quesada wrote: In my view, R as a language is very good but the tools around it are not good. When a matlab person tries R, their first comments are always how poor the environment is. Sure, one can have a debugger (with a crappy GUI in TK), and there's some editor support, but

Re: [R] Vim R plugin-2

2009-05-09 Thread Jose Quesada
Jakson Alves de Aquino wrote: > Jose Quesada wrote: > >> I'll try to look at it and see if I can port it so it works on windows. >> But the >> current communication method I use there are just the clipboard, not sure if >> it'll be possible. >> > > Unfortunately, I cannot help on Windows en

Re: [R] (no subject)

2009-05-09 Thread David Winsemius
On May 9, 2009, at 5:39 AM, Jaana Kettunen wrote: Could you help me with a problem? I should put non-linear variables into zelig-model, how can that be done? I'm dealing with air pollution data, trying to find out daily associations between mortality and air pollutants. Weather variabl

Re: [R] Gantt chart but slightly different

2009-05-09 Thread Jim Lemon
Beata Czyz wrote: Hello, I am new to this list and rather new to graphics with R. I would like to make a chart like Gantt chart, something like that: ... but I would like to fill the different blocks of tasks with different pattern i.e. first blocks of Male 1 and Male 2 with pattern 1, second blo

Re: [R] Merging two data frames with 3 common variables makes duplicated rows

2009-05-09 Thread Rocko22
Thomas, You are very clever! The "meil2" data frame has twice the common variable combinations: > meil2 dist sexe style meil 138F clas 02:43:17 238F free 02:24:46 338H clas 02:37:36 438H free 01:59:35 545F clas 03:46:15 645F free 02:20

[R] pdf transparency not working with Latex documents. Solved

2009-05-09 Thread jgarcia
Hi, I've found that after the call to pdf(), I had a posterior line: par(bg="white") that was creating this white background. Setting this to transparent works fine. Thanks, Javier ... > Hello, > I' using the pdf() device with bg="transparent" to create plots to be used > within a latex (beamer) p

[R] pdf transparency not working with Latex documents

2009-05-09 Thread jgarcia
Hello, I' using the pdf() device with bg="transparent" to create plots to be used within a latex (beamer) presentation. Later on, I see that the background of my pdf() graphics is solid white in the final presentation. I'm using R-2.6.0, and I have also tried to set the version argument in pdf()

[R] Strip labels: use xyplot() to plot columns in parallel with outer=TRUE

2009-05-09 Thread John Maindonald
The following tinkers with the strip labels, where the different panels are for different levelf of a conditioning factor. tau <- (0:5)/2.5; m <- length(tau); n <- 200; SD <- 2 x0 <- rnorm(n, mean=12.5, sd=SD) matdf <- data.frame( x = as.vector(sapply((0:5)/2.5, function(s)x0+rnorm(n, sd=2*s))

Re: [R] new book on (Perl and) R for computational biology

2009-05-09 Thread Daniel Viar
It looks like the correct link is: http://www.crcpress.com/product/isbn/9781420069730 On Fri, May 8, 2009 at 6:49 PM, Gabriel Valiente wrote: > There is a new book on (Perl and) R for computational biology, > > G. Valiente. Combinatorial Pattern Matching Algorithms in Computational > Biology us

[R] (no subject)

2009-05-09 Thread Jaana Kettunen
Could you help me with a problem? I should put non-linear variables into zelig-model, how can that be done? I'm dealing with air pollution data, trying to find out daily associations between mortality and air pollutants. Weather variables used as confounders are in some cases non-linear. Sin

Re: [R] caching of the .Rprofile file

2009-05-09 Thread Tobias Verbeke
Hi Tom, It seems that if I make a change to the .Rprofile file in my working directory, it is not immediately reflected when the session is restarted. (I am using statET and rJava) Is that something I should expect? No. Is your launch configuration of R in StatET configured such that it take

Re: [R] Vim R plugin-2

2009-05-09 Thread Jose Quesada
Jakson A. Aquino gmail.com> writes: > > Dear R users, > > People who uses vim in Linux/Unix may be interested in checking the > plugin for R that I'm developing: > > http://www.vim.org/scripts/script.php?script_id=2628 > > The plugin includes omni completion for R objects, code indentation > an