Re: [R] Keeping package sources for recompilation with new R version?

2009-10-25 Thread Rainer M Krug
2009/10/25 Uwe Ligges > > > Rainer M Krug wrote: > >> Hi >> >> I am using Ubuntu Hardy, and I installing many packages from source. I am >> keeping my R packages fairly up to date. >> >> My question is: is there a way, of keeping the source packages, so that >> when >> I am installing a new versi

[R] defining number of samples

2009-10-25 Thread ms.com
dear all i am trying to perform t-test (t.test) in R here i am putting the commands and answer i got > t.test(Ht_cm[from_treeline=='above'][type=='SD'],Ht_cm[from_treeline=='below'][type=='SD']) Welch Two Sample t-test data: Ht_cm[from_treeline == "above"][type == "SD"] and Ht_cm[from_tre

[R] lsfit residuals

2009-10-25 Thread Tanya Cashorali
I'm trying to extract the points above and below a particular lsfit. I can only get the residuals from the original fit though. x = runif(100, 0, 10) plot(x) abline(lsfit(1:100, test)) abline(lsfit(1:100, test + sd(test))) #I want the points above THIS line. Is there a way to use the coeffi

Re: [R] connecting to Oracle

2009-10-25 Thread whizvast
I found an old Internet posting and it solved my problem. For those who is suffering from the same problem, try this: channel <- odbcDriverConnect(connection="Driver={Microsoft ODBC for Oracle};DSN=abc;UID=abc;PWD=abc", case = 'oracle') x <- sqlQuery(channel, paste("select * from db_name.tbl_na

[R] Using WCSLIB in R

2009-10-25 Thread Lee Kelvin
Hello, I'm aware that not everyone who uses R is an astronomer, and so apologies in advance to those people for the nature of this email. I need to convert right-ascension and declination (RA & DEC) coordinates for an object on the sky into physical pixel positions in a FITS image in R. Th

Re: [R] agrep confusion

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 10:17 PM, Paul Galpern wrote: I am sure there is something I am just not understanding about agrep functionality. str1 <- c("ab","aba","abc") agrep("abc",str1, max.distance = list(insertions=0, substitutions=0, deletions=1), value=T) returns: [1] "ab" "aba" "abc" Why

Re: [R] rotate levelplot

2009-10-25 Thread Kang Min
Hi David, Thanks a lot for the simple but effective solution. I got what I wanted by doing a levelplot(t(q2)). Kang Min On Oct 25, 8:46 pm, David Winsemius wrote: > On Oct 25, 2009, at 1:51 AM, Kang Min wrote: > > > Hi Milton, > > > The matrix can be generated using > > > p = matrix(1:50, nrow=

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread Jim Lemon
Neil Stewart wrote: > > I'm wondering whether there is a character to let R know to expect > more input for a command on subsequent lines. Hi Neil, Not that I know of, but I use exactly the method you noticed, the trailing operator. There was a discussion similar to this not long ago about the

[R] agrep confusion

2009-10-25 Thread Paul Galpern
I am sure there is something I am just not understanding about agrep functionality. str1 <- c("ab","aba","abc") agrep("abc",str1, max.distance = list(insertions=0, substitutions=0, deletions=1), value=T) returns: [1] "ab" "aba" "abc" Why is "aba" a match? It seems to me that this should r

[R] Rounding error in seq(...)

2009-10-25 Thread David Airey
>> can you explain that a little more detailed? >> Perhaps I miss the background knowledge - but it seems just absurd to me. >> >> 0.1+0.1+0.1 is 0.3 - there is no rounding involved, is there? >> >> why is >> x <- 0.1 + 0.1 +0.1 >> not equal to >> y <- 0.3 > > Remember that this is in BINARY a

Re: [R] Memory Problems with CSV and Survey Objects

2009-10-25 Thread Gabor Grothendieck
Note that read.csv.sql in the sqldf package could be used to avoid most of the setup: library(sqldf) DF <- read.csv.sql("myfile.csv", sql = "select ...") It will setup the database, read the file into it, apply the select statement, place the result into data frame DF and destroy the database all

Re: [R] NULL elements in lists ... a nightmare

2009-10-25 Thread tlumley
It is perhaps also worth mentioning that this is the very first question in the actual R questions section of the R FAQ. 7.1 How can I set components of a list to NULL? You can use x[i] <- list(NULL) to set component i of the list x to NULL, similarly for named components. Do not set

Re: [R] Memory Problems with CSV and Survey Objects

2009-10-25 Thread tlumley
On Sat, 24 Oct 2009, Carlos J. Gil Bellosta wrote: Hello, Adding to Thomas' email, you could also use package colbycol which allows you to load into R files that a simple read.table cannot cope with, study columns independently, select those you are more interested in and, finally, set up a dat

Re: [R] row subtraction

2009-10-25 Thread Ben Bolker
Marsha Melnyk wrote: > > I don't know if there is a way to do this in R but I want to subtract > within the same column from different rows. I want to subtract > c(r)-c(r-1) and continue down the column until they are all calculated > and form another column. Again I don't know if R can do

[R] CRAN (and crantastic) updates this week

2009-10-25 Thread Crantastic
CRAN (and crantastic) updates this week New packages * cudaBayesreg (0.1-1) Adelino Ferreira da Silva http://crantastic.org/packages/cudaBayesreg Compute Unified Device Architecture (CUDA) is a software platform for massively parallel high-performance computing on NVIDIA GPU

Re: [R] Help with history() in Emacs/ESS

2009-10-25 Thread Marc Schwartz
On Oct 25, 2009, at 4:04 PM, Tariq Perwez wrote: Hi Everyone, I am a beginner running R 2.9.2 under Ubuntu and typically use Emacs w/ESS. However, I am confused with history() command. When I issue command history() in Emacs within an R session, this is what get: history() Error in savehi

Re: [R] Help with history() in Emacs/ESS

2009-10-25 Thread Richard M. Heiberger
Lines sent to R by C-c C-n and related commands are excluded from the R history. They appear only in the ESS history. This, along with everything else, is documented in the file /ess/doc/html/ess.html Questions on ESS should be sent to the ESS list ess-h...@stat.math.ethz.ch Rich

Re: [R] row subtraction

2009-10-25 Thread Ista Zahn
If I understand what you're asking this is one (although probably not the easiest or best) way: X <- as.data.frame(matrix(runif(50), nrow=10)) X.tmp <- rbind(rep(NA, dim(X)[2]), X[1:(dim(X)[1]-1),]) X.new <- X - X.tmp -Ista On Sun, Oct 25, 2009 at 5:45 PM, Marsha Melnyk wrote: > I don't know

Re: [R] Importing data from text file with mixed format

2009-10-25 Thread Gabor Grothendieck
This solution uses strapply in gsubfn. It assumes the timepoints are 1, 2, 3, ... (although later we remove this restriction just in case). The first line reads in myfile. The second line reads the numeric rows into matrix s. The third line reads in the column names. The fourth line converts to

Re: [R] Need help with reduced row echelon form

2009-10-25 Thread John Fox
Dear KS, Some time ago, I posted a solution to this problem (minus the ERO matrices) to the r-help list. You'll find the relevant functions at . Regards, John > -Original Message- > From: r-help-boun...@r-proj

[R] row subtraction

2009-10-25 Thread Marsha Melnyk
I don't know if there is a way to do this in R but I want to subtract within the same column from different rows. I want to subtract c(r)-c(r-1) and continue down the column until they are all calculated and form another column. Again I don't know if R can do this but I thought I would ask. T

Re: [R] Getting AIC from lrm in Design package

2009-10-25 Thread Kyle Werner
Dear David, Thank you for the reference to Frank Harrell's excellent text. I will read up to correct my statistical deficiencies offline. Thank you. On Sun, Oct 25, 2009 at 1:24 PM, David Winsemius wrote: > > On Oct 25, 2009, at 12:55 PM, Kyle Werner wrote: > >> David, >> >> Thank you for your

Re: [R] Importing data from text file with mixed format

2009-10-25 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of delnatan > Sent: Saturday, October 24, 2009 8:32 PM > To: r-help@r-project.org > Subject: [R] Importing data from text file with mixed format > > > Hi, > I'm having difficulty

Re: [R] Need help with reduced row echelon form

2009-10-25 Thread Ben Bolker
Kanchana Srinivasan wrote: > > Hello > > I have a 3x3 matrix (A), which I would have to reduce to Reduced Row > echelon form.  Besides, at every iteration k, the elementary row matrix Ek > has to be printed and also print the product of sum Ei (i=1 to k) and A. > > Can you convince us that

[R] Need help with reduced row echelon form

2009-10-25 Thread Kanchana Srinivasan
Hello I have a 3x3 matrix (A), which I would have to reduce to Reduced Row echelon form.  Besides, at every iteration k, the elementary row matrix Ek has to be printed and also print the product of sum Ei (i=1 to k) and A. Any ideas how to go about doing this. KS. [[alternati

[R] Help with history() in Emacs/ESS

2009-10-25 Thread Tariq Perwez
Hi Everyone, I am a beginner running R 2.9.2 under Ubuntu and typically use Emacs w/ESS. However, I am confused with history() command. When I issue command history() in Emacs within an R session, this is what get: > history() Error in savehistory(file) : no history available to save Similarly,

Re: [R] different plot symbols in key using xyplot

2009-10-25 Thread Peter Ehlers
Stephen Kennedy wrote: I'm using xyplot in a very simple way---a scatter plot of several data sets. I'm having a problem getting auto.key to display different point characters. The following produces a plot that employes different colors, all with pch(1), for the different groups, with a

Re: [R] Trying to save both an rgl plot and a bar plot errors

2009-10-25 Thread Duncan Murdoch
On 25/10/2009 9:10 AM, jamesgia...@aol.com wrote: Hello, I am basically using a script that is designed to first create an rgl 3d scatter plot followed by a barplot on the same data. After this is done, the program is to first save the barplot as a .tiff file then to save the rgl 3d graph as a

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread Peter Ehlers
Peter Ehlers wrote: As usual, you're Duncan. Should have tested it. Thanks for the correction. Well, at least I assume that you're still Duncan. Meant to say, of course: "as usual, you're _right_, Duncan". Particularly slow fingers today. Please accept apology. -Peter Ehlers -Peter Ehle

Re: [R] Keeping package sources for recompilation with new R version?

2009-10-25 Thread Uwe Ligges
Rainer M Krug wrote: Hi I am using Ubuntu Hardy, and I installing many packages from source. I am keeping my R packages fairly up to date. My question is: is there a way, of keeping the source packages, so that when I am installing a new version of R, an update.packages(checkBuilt=TRUE) will

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread Peter Ehlers
As usual, you're Duncan. Should have tested it. Thanks for the correction. -Peter Ehlers Duncan Murdoch wrote: On 25/10/2009 11:43 AM, Peter Ehlers wrote: Here are two ways: 1. wrap the line in braces: x <- { /...} That doesn't work. You're probably thinking of the way the

Re: [R] Bagging

2009-10-25 Thread Uwe Ligges
柯洁 wrote: Dear sir,I have a data set which name is "c78p",now I want to deal with it with bagging. % of data from c78p as training set is 50%,and number of bootstrap random samples with replacement from c78p is 5,use SVM in each run,can you help me to write the code?Thanks.Best regards,Jie

Re: [R] Getting AIC from lrm in Design package

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 12:55 PM, Kyle Werner wrote: David, Thank you for your reply. I am not using glm, but instead lrm. Does not matter. "lrm" is giving you the same output as would glm with a logistic link. I am consulting the documentation to try to parse out what the output "Model L.R

Re: [R] Importing data from text file with mixed format

2009-10-25 Thread jim holtman
try this: > # read in the file > x <- readLines(textConnection("#begin text file + Timepoint 1 + ObjectNumber Volume SurfaceArea + 1 5.3 9.7 + 2 4.9 8.3 + 3 5.0 9.1 + 4 3.5

Re: [R] Getting AIC from lrm in Design package

2009-10-25 Thread Kyle Werner
David, Thank you for your reply. I am not using glm, but instead lrm. I am consulting the documentation to try to parse out what the output "Model L.R." actually means: http://lib.stat.cmu.edu/S/Harrell/help/Design/html/lrm.fit.html ("model likelihood ratio chi-square") >From my read of the docum

Re: [R] Trying to save both an rgl plot and a bar plot errors

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 9:10 AM, jamesgia...@aol.com wrote: Hello, I am basically using a script that is designed to first create an rgl 3d scatter plot followed by a barplot on the same data. After this is done, the program is to first save the barplot as a .tiff file then to save the rgl 3d

[R] different plot symbols in key using xyplot

2009-10-25 Thread Stephen Kennedy
I'm using xyplot in a very simple way---a scatter plot of several data sets. I'm having a problem getting auto.key to display different point characters. The following produces a plot that employes different colors, all with pch(1), for the different groups, with a matching key. xyplot(For

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread Duncan Murdoch
On 25/10/2009 11:43 AM, Peter Ehlers wrote: Here are two ways: 1. wrap the line in braces: x <- { /...} That doesn't work. You're probably thinking of the way the parsing of if versus if/else depends on braces: if (TRUE) print("TRUE") else print("FALSE") is a syntax error

Re: [R] Trying to save both an rgl plot and a bar plot errors

2009-10-25 Thread Peter Ehlers
jamesgia...@aol.com wrote: Hello, I am basically using a script that is designed to first create an rgl 3d scatter plot followed by a barplot on the same data. After this is done, the program is to first save the barplot as a .tiff file then to save the rgl 3d graph as a .png file. Once this i

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread Peter Ehlers
Here are two ways: 1. wrap the line in braces: x <- { /...} 2. maybe more awkward in general, but sometimes useful: x <- `/`(... , ...) -Peter Ehlers Neil Stewart wrote: I'm wondering whether there is a character to let R know to expect more input for a command on subse

Re: [R] How to make XML support Expat?

2009-10-25 Thread Johannes Graumann
On Sunday 25 October 2009 00:38:54 you wrote: > xmlEventParse() is intended for handling files that we don't want to keep > in memory. The branches parameter does make it easier to deal with > sub-trees as the document is being parsed. And within these branches one > can use XPath. Very interes

[R] Trying to save both an rgl plot and a bar plot errors

2009-10-25 Thread jamesgiacmo
Hello, I am basically using a script that is designed to first create an rgl 3d scatter plot followed by a barplot on the same data. After this is done, the program is to first save the barplot as a .tiff file then to save the rgl 3d graph as a .png file. Once this is done, it is to repeat this

Re: [R] Fitting a Correlated Hazard Model???

2009-10-25 Thread David Winsemius
On Oct 24, 2009, at 8:13 PM, brett schug wrote: Hello: Is there an easy way to fit a correlated hazard model in R? Basically, I have two events of interest for each individual, and I suspect there is some correlation involved. I want to be able to fit two separate hazard models, allowin

Re: [R] Getting AIC from lrm in Design package

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 9:24 AM, Kyle Werner wrote: I am trying to obtain the AICc after performing logistic regression using the Design package. For simplicity, I'll talk about the AIC. I tried building a model with lrm, and then calculating the AIC as follows: likelihood.ratio <- unname(lrm(succ

Re: [R] Help with package reshape

2009-10-25 Thread Ista Zahn
Hi Murray, You were very close. cast(mexa2, ... ~ variable + census) Should do the trick. -Ista On Sun, Oct 25, 2009 at 5:10 AM, Murray Jorgensen wrote: > I have got part of the way to what I want by playing with a small example: > >> example2 > >   ano census total.pop class > 1  222     96  

[R] Getting AIC from lrm in Design package

2009-10-25 Thread Kyle Werner
I am trying to obtain the AICc after performing logistic regression using the Design package. For simplicity, I'll talk about the AIC. I tried building a model with lrm, and then calculating the AIC as follows: likelihood.ratio <- unname(lrm(succeeded~var1+var2,data=scenario,x=T,y=T)$stats["Model

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 8:53 AM, Neil Stewart wrote: I'm wondering whether there is a character to let R know to expect more input for a command on subsequent lines. Here is an example: test_1.R: x <- c(1,2,3,4) / c(1,2,3,4) x R CMD BATCh test_1.R produces test_1.Rout: x <- c(1,2,3,4) / c(

Re: [R] Multiple line commands in R scripting

2009-10-25 Thread Duncan Murdoch
On 25/10/2009 8:53 AM, Neil Stewart wrote: I'm wondering whether there is a character to let R know to expect more input for a command on subsequent lines. Here is an example: No, the rule R uses is to stop when the statement is complete. test_1.R: x <- c(1,2,3,4) / c(1,2,3,4) x The fir

Re: [R] Help with package reshape

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 5:07 AM, Murray Jorgensen wrote: I have got part of the way to what I want by playing with a small example: > example2 ano census total.pop class 1 222 96 113111 2 222 1 124512 3 239 96 392111 4 239 1 450312 5 2

[R] Multiple line commands in R scripting

2009-10-25 Thread Neil Stewart
I'm wondering whether there is a character to let R know to expect more input for a command on subsequent lines. Here is an example: test_1.R: x <- c(1,2,3,4) / c(1,2,3,4) x R CMD BATCh test_1.R produces test_1.Rout: > x <- c(1,2,3,4) > / c(1,2,3,4) Error: unexpected '/' in " /" Execution

Re: [R] rotate levelplot

2009-10-25 Thread David Winsemius
On Oct 25, 2009, at 1:51 AM, Kang Min wrote: Hi Milton, The matrix can be generated using p = matrix(1:50, nrow=5) If I just use levelplot(p), it gives me a graph that is vertical. How can I rotate it so it becomes horizontal? I cannot do q = t(p); levelplot(q) because this is representing

[R] storing initial path for tkgetOpenFile

2009-10-25 Thread Erich Studerus
Hi, I'd like to store the path from which I opened a file with tkgetOpenFile and use it as the initial path for the next function call of tkgetOpenFile. What is the best way of doing this? The following works fine on my Windows computer. However, I'm not sure if it works on other platforms.

[R] Help with package reshape

2009-10-25 Thread Murray Jorgensen
I have got part of the way to what I want by playing with a small example: > example2 ano census total.pop class 1 222 96 113111 2 222 1 124512 3 239 96 392111 4 239 1 450312 5 260 1 421811 6 269 1 118512 7

Re: [R] NULL elements in lists ... a nightmare

2009-10-25 Thread Jim Lemon
On 10/25/2009 03:43 PM, mau...@alice.it wrote: I can define a list containing NULL elements: myList<- list("aaa",NULL,TRUE) names(myList)<- c("first","second","third") myList $first [1] "aaa" $second NULL $third [1] TRUE length(myList) [1] 3 However, if I assign NULL to

Re: [R] NULL elements in lists ... a nightmare

2009-10-25 Thread Ted Harding
[Apologies -- I inadvertently omitted an example, essential for clarity, from the examples below. Now corrected.] On 25-Oct-09 09:30:51, Ted Harding wrote: > On 25-Oct-09 09:52:42, Patrick Burns wrote: >> 'The R Inferno' page 59. >> >> Patrick Burns >> patr...@burns-stat.com >> +44 (0)20 8525 069

Re: [R] NULL elements in lists ... a nightmare

2009-10-25 Thread Ted Harding
On 25-Oct-09 09:52:42, Patrick Burns wrote: > 'The R Inferno' page 59. > > Patrick Burns > patr...@burns-stat.com > +44 (0)20 8525 0696 > http://www.burns-stat.com > (home of "The R Inferno" and "A Guide for the Unwilling S User") Which essentially says that If you want the component [x1[comp

[R] Help with package reshape

2009-10-25 Thread Murray Jorgensen
I have got part of the way to what I want by playing with a small example: example2 ano census total.pop class 1 222 96 113111 2 222 1 124512 3 239 96 392111 4 239 1 450312 5 260 1 421811 6 269 1 118512 7

Re: [R] NULL elements in lists ... a nightmare

2009-10-25 Thread Patrick Burns
'The R Inferno' page 59. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of "The R Inferno" and "A Guide for the Unwilling S User") mau...@alice.it wrote: I can define a list containing NULL elements: myList <- list("aaa",NULL,TRUE) names(myList) <- c

Re: [R] Datasets for "The Statistical Sleuth"

2009-10-25 Thread Barry Rowlingson
On Sun, Oct 25, 2009 at 5:48 AM, Yihui Xie wrote: > Hi everyone, > > I wonder if there already exists any R packages containing all the > data sets for the book "The Statistical Sleuth" > (http://www.proaxis.com/~panorama/home.htm; also available at StatLib > http://lib.stat.cmu.edu/datasets/sleut

[R] Bagging

2009-10-25 Thread 柯洁
Dear sir,I have a data set which name is "c78p",now I want to deal with it with bagging. % of data from c78p as training set is 50%,and number of bootstrap random samples with replacement from c78p is 5,use SVM in each run,can you help me to write the code?Thanks.Best regards,Jie

Re: [R] How to make XML support Expat?

2009-10-25 Thread Johannes Graumann
Thanks for your input. If I understand correctly, XPath requires the whole document to be resident in memory. That is not an option given the size of documents I'm facing ... I'll go with the standard streaming implementation of the XML package and see how far I get. Thanks, Joh On Saturday 24

Re: [R] How to make XML support Expat?

2009-10-25 Thread Johannes Graumann
Hi, I had heard that Expat is was faster. Your mail actually made me go check google for some comparisons and that does not seem the case ... do you have any insight into this? Thanks, Joh On Saturday 24 October 2009 20:38:23 Duncan Temple Lang wrote: > Hi Joh. > > What particular aspects of

[R] Importing data from text file with mixed format

2009-10-25 Thread delnatan
Hi, I'm having difficulty importing my textfile that looks something like this: #begin text file Timepoint 1 ObjectNumber Volume SurfaceArea 1 5.3 9.7 2 4.9 8.3 3 5.0 9.1 4 3.5