Re: [R] Converting Factor to Vector

2009-01-12 Thread David Winsemius
But repo is a dataframe. AAA is a factor within repo. You probably need to apply as.character to repo$AAA. -- David Winsemius On Jan 13, 2009, at 12:50 AM, Gundala Viswanath wrote: Hi Bill, However with as.character it fail show the actual strings. It gives this: new_repo <- as.characte

Re: [R] Converting Factor to Vector

2009-01-12 Thread Gundala Viswanath
Hi Bill, However with as.character it fail show the actual strings. It gives this: > new_repo <- as.character(repo) > str(new_repo) chr "1:32267" > print(new_repo) [1] "1:32267" Instead of >> str(new_repo) > chr [1:100] "AAA" "AAT" "AAC" "AAG" "ATA" "ATT"... > >> print(new_repo) > [1] "AAA" "

Re: [R] Converting Factor to Vector

2009-01-12 Thread Bill.Venables
as.character() Bill Venables http://www.cmis.csiro.au/bill.venables/ -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gundala Viswanath Sent: Tuesday, 13 January 2009 3:25 PM To: r-h...@stat.math.ethz.ch Subject: [R] Converting

[R] Converting Factor to Vector

2009-01-12 Thread Gundala Viswanath
Hi all, How can I convert factor like this: > str(repo) 'data.frame': 1000 obs. of 1 variable: $ AAA: Factor w/ 1000 levels "AAT","AAC",..: 1 2 3 4 5 6 7 8 9 10 ... > print(repo) AAA 1 AAA 2 AAT 3 AAC ... into to simple vector > str(new_repo) chr [1:100] "AAA" "AAT" "AAC" "AAG" "ATA" "AT

Re: [R] Returning Non-Unique Index with Which (alternatives?)

2009-01-12 Thread Jorge Ivan Velez
Dear Gundala, As Jim Holtman suggested in a previous post, match() should do the job: repo <- c("AAA", "AAT", "AAC", "AAG", "ATA", "ATT") qr <- c("AAC", "ATT", "ATT") match(qr,repo) [1] 3 6 6 HTH, Jorge On Mon, Jan 12, 2009 at 9:41 PM, Gundala Viswanath wrote: > Dear all, > > > I tried to fi

Re: [R] basic sweave question

2009-01-12 Thread markleeds
Martin Morgan kindly explained to me off-list that I need to use R CMD pdflatex mark-example.tex. That fixed my problem. On Mon, Jan 12, 2009 at 11:25 PM, markle...@verizon.net wrote: In my original message, I forot to include my Session Info so it is below. I apologize for that. sessio

Re: [R] basic sweave question

2009-01-12 Thread Yihui Xie
"Sweave.sty" is in the directory file.path(R.home(), 'share', 'texmf') Regards, Yihui -- Yihui Xie Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of China, Beijing,

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
Thanks for the info, Jim. - GV On Tue, Jan 13, 2009 at 12:27 PM, jim holtman wrote: > Is this fast enough for you; matches of 2000 against 2M tags takes 0.2 > seconds: > >> str(x) > chr [1:2000] "EAEDC" "DACCD" "BEAAD" "CDDDA" "ABDCA" "ACACC" "DADAA" > "ABCAD" ... >> str(z) > chr [1:200

Re: [R] basic sweave question

2009-01-12 Thread markleeds
In my original message, I forot to include my Session Info so it is below. I apologize for that. sessionInfo() R version 2.8.0 (2008-10-20) i386-redhat-linux-gnu locale: LC_CTYPE=en_US.utf8;LC_NUMERIC=C;LC_TIME=en_US.utf8;LC_COLLATE=en_US.utf8;LC_MONETARY=C;LC_MESSAGES=en_US.utf8;LC_PAPER=en_

[R] basic sweave question

2009-01-12 Thread markleeds
I am trying to learn the basics of Sweave so I read some things and a friend gave me his Rnw file to play with. I am able to do R CMD Sweave mark-example.Rnw. That works. But, then when I do latex mark-example.tex, I get the message below. I looked in the archives and Martin Morgan mentioned som

Re: [R] crash on multiple queries to postgresql db [solved]

2009-01-12 Thread Dylan Beaudette
On Mon, Jan 12, 2009 at 6:31 PM, Martin Morgan wrote: > An off-list guess is, ironically, to NOT call dbDisconnect or gc(). > > The C code in the package registers a 'finalizer' that gets called when the > object is garbage collected. This is the same code that gets called by > dbDisconnect. Unfor

Re: [R] Returning Non-Unique Index with Which (alternatives?)

2009-01-12 Thread David Winsemius
> sapply(qr, function (x) which(repo %in% x) + ) AAC ATT ATT 3 6 6 On Jan 12, 2009, at 9:41 PM, Gundala Viswanath wrote: Dear all, I tried to find index in repo given a query with this: repo <- c("AAA", "AAT", "AAC", "AAG", "ATA", "ATT") qr <- c("AAC", "ATT", "ATT") which(repo%in%qr)

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread jim holtman
Is this fast enough for you; matches of 2000 against 2M tags takes 0.2 seconds: > str(x) chr [1:2000] "EAEDC" "DACCD" "BEAAD" "CDDDA" "ABDCA" "ACACC" "DADAA" "ABCAD" ... > str(z) chr [1:200] "EAEDC" "DACCD" "BEAAD" "CDDDA" "ABDCA" "ACACC" "DADAA" "ABCAD" ... > system.time(y <- match(x,z))

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
Yes Jim, exactly. BTW, I found from ?match " Matching for lists is potentially very slow and best avoided except in simple cases." Since I am doing this for million of tags. Is there a faster alternatives? - Gundala Viswanath Jakarta - Indonesia On Tue, Jan 13, 2009 at 12:14 PM, jim ho

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread jim holtman
Is this what you want: > repo <- c("AAA", "AAT", "AAC", "AAG", "ATA","ATT") > qr <- c("AAC", "ATT", "ATT","AAC", "ATT", "ATT", "AAT", "ATT", "ATT") > match(qr, repo) [1] 3 6 6 3 6 6 2 6 6 > On Mon, Jan 12, 2009 at 9:22 PM, Gundala Viswanath wrote: > Hi Jorge and all, > > How can I modified you

[R] Returning Non-Unique Index with Which (alternatives?)

2009-01-12 Thread Gundala Viswanath
Dear all, I tried to find index in repo given a query with this: > repo <- c("AAA", "AAT", "AAC", "AAG", "ATA", "ATT") > qr <- c("AAC", "ATT", "ATT") > which(repo%in%qr) [1] 3 6 Note that the query contain repeating elements, yet the output of which only returns unique. How can I make it ret

Re: [R] lm: how are polynomial functions interpreted?

2009-01-12 Thread Gabor Grothendieck
Try this to see the X matrix that its fitting y to: x <- 1:10 model.matrix(~ poly(x, 2)) model.matrix(~ I(x^2)) On Mon, Jan 12, 2009 at 9:01 PM, Carl Witthoft wrote: > damn. > My apologies to everyone -- I sent one message and it got destroyed somehow. > > Here's the part that was missing, whi

[R] polychoric correlation: issue with coefficient sign

2009-01-12 Thread Dorothee
Hello, I am running polychoric correlations on a dataset composed of 12 ordinal and binary variables (N =384), using the polycor package. One of the association (between 2 dichotomous variables) is very high using the 2-step estimate (0.933 when polychoric run only between the two variables; but

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
Hi Jorge and all, How can I modified your code when query size can be bigger than repository, meaning that it can contain repeats. e.g. qr <- c("AAC", "ATT", "ATT","AAC", "ATT", "ATT", "AAT", "ATT", "ATT", ) Sorry, I should have mentioned this earlier. - Gundala Viswanath Jakarta - Indonesi

Re: [R] Help needed for Loading "tm" package

2009-01-12 Thread Kum-Hoe Hwang
I appreciate alll helpers for R. I have struggled with Rweka problem related with "tm" text mining package in R. My problem was solved when I replaced RWeka_0.3-15.zip with RWeka_0.3-13.zip under the OS of Win XP. Now my tm package works fine in R. I don't know why it works. Thanks all who gave

[R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
Dear all, Suppose I have the following vector as repository: > repo <- c("AAA", "AAT", "AAC", "AAG", "ATA","ATT") Given another query vector > qr <- c("AAC", "ATT") is there a way I can find the query index in repository in a fast way. Giving: [1] 3 6 Typically the size of repo is around ~

Re: [R] lm: how are polynomial functions interpreted?

2009-01-12 Thread Carl Witthoft
damn. My apologies to everyone -- I sent one message and it got destroyed somehow. Here's the part that was missing, which led to rather a lot of confusion on all parts. The two recent responses to a question about lm suggested 1) lm(y~poly(x,2)) 2) lm(y~I(x^2)) So my question was *suppose

Re: [R] Can't Destroy Dim Names

2009-01-12 Thread Greg Snow
Your mat variable is not a matrix, but a vector (a named vector), therefore it does not have dimensions or dimnames. Try names(mat) <- NULL Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Messa

Re: [R] Can't Destroy Dim Names

2009-01-12 Thread jim holtman
Is this what you want: > x <- c(a=1, b=2, c=3) > str(x) Named num [1:3] 1 2 3 - attr(*, "names")= chr [1:3] "a" "b" "c" > names(x) <- NULL > x [1] 1 2 3 > On Mon, Jan 12, 2009 at 8:32 PM, Gundala Viswanath wrote: > Dear all, > > I have the following matrix: > >> str(mat) > Named chr [1:32268]

Re: [R] pmax and sort?

2009-01-12 Thread Greg Snow
Here are a couple of quick examples that may help: > 1:10 [1] 1 2 3 4 5 6 7 8 9 10 > 10:1 [1] 10 9 8 7 6 5 4 3 2 1 > pmax( 10:1, 1:10 ) [1] 10 9 8 7 6 6 7 8 9 10 > pmin( 1:10, 5 ) [1] 1 2 3 4 5 5 5 5 5 5 In the first example with pmax, there are 2 vectors being compa

[R] Can't Destroy Dim Names

2009-01-12 Thread Gundala Viswanath
Dear all, I have the following matrix: > str(mat) Named chr [1:32268] "yQAAA" "jQAAQ" "UQAAg" "FQAAw" "1QABA" ... - attr(*, "names")= chr [1:32268] "CA" "CC" "CG" "CT" ... I want to destroy the attribute yielding only this: > str(mat) Named chr [1:32268] "yQAAA

Re: [R] Drawing Polygons with xyplot in lattice

2009-01-12 Thread Gabor Grothendieck
There is an example in the example section of the ?xyplot.zoo help page in the zoo package. On Mon, Jan 12, 2009 at 8:16 PM, Josip Dasovic wrote: > Hello: > > I've come to a dead-end in my search for a solution to a graphing problem > that I am encountering. I have used xyplot (from the lattice

[R] Drawing Polygons with xyplot in lattice

2009-01-12 Thread Josip Dasovic
Hello: I've come to a dead-end in my search for a solution to a graphing problem that I am encountering. I have used xyplot (from the lattice package) successfully to plot 36 time-series plots (lines) of under-5 mortality for a set of countries in Sub-Sarahan Africa. What I would now like to

[R] pmax and sort?

2009-01-12 Thread rkevinburton
I am having a hard time understanding the documentation and I was wondering if there would be someone to help clear the cobwebs. The documentation for pmax states: pmax and pmin take one or more vectors (or matrices) as arguments and return a single vector giving the ‘parallel’ maxima (or mini

[R] pmax and sort?

2009-01-12 Thread rkevinburton
I am having a hard time understanding the documentation and I was wondering if there would be someone to help clear the cobwebs. The documentation for pmax states: pmax and pmin take one or more vectors (or matrices) as arguments and return a single vector giving the ‘parallel’ maxima (or mini

Re: [R] roll weekly data to monthly level

2009-01-12 Thread Gabor Grothendieck
Try this. First we read in the data. In reality you would use the commented out read line. Then use chron to convert the times to chron dates and as.yearmon from zoo to convert them to year/months. Finally aggregate and sort. > Lines <- "IDtime y + 12/01/20084 + 12/09

Re: [R] lm: how are polynomial functions interpreted?

2009-01-12 Thread Bill.Venables
I find the simplest way to interpret a *linear* model formula, as used by lm() and aov() is to take the left hand side as specifying the response variable (or variables) and to take the right hand side as specifying the *columns of the model matrix* in a coded way. Notice that the parameters ar

Re: [R] roll weekly data to monthly level

2009-01-12 Thread David Winsemius
I had trouble getting my output to look like yours until I realized that you did not want "to sum up the weekly data to the monthly level" but rather to sum up to the monthly *and* ID level. > dftag<-aggregate(dft$y, list(ID=dft$ID, Month=as.yearmon(dft$time, "%m/%d/%Y")), FUN=sum) # in Mo

Re: [R] roll weekly data to monthly level [SEC=UNCLASSIFIED]

2009-01-12 Thread Augusto.Sanabria
Julia, I had a similar query a while ago which I solved using a suggestion from Gabor, have a look at: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/69597.html Hope it helps, Augusto Augusto Sanabria. MSc, PhD. Mathematical Modeller Risk & Impact

Re: [R] lm: how are polynomial functions interpreted?

2009-01-12 Thread roger koenker
[E] Y = a + b*sin(d*x+phi) isn't a linear model and therefore can't be estimated with lm() -- you will need some heavier artillery. Linear as in lm() means "linear in parameters." (As it happens, I'm adapting Gordon Smyth's pronyfreq S code for the above problem this afternoon, and have

Re: [R] crash on multiple queries to postgresql db

2009-01-12 Thread Dylan Beaudette
On Friday 09 January 2009, Joe Conway wrote: > Dylan Beaudette wrote: > > Subsequent calls to: > > > > conn <- dbConnect(PgSQL(), host="localhost", dbname="xxx", user="xxx") > > query <- dbSendQuery(conn, query_text) > > res <- dbGetResult(query) > > > > are resulting in this: > > > > *** glibc det

Re: [R] lm: how are polynomial functions interpreted?

2009-01-12 Thread Carl Witthoft
Well. *_* , I think it should have been clear that this was not a question for which any code exists. In fact, I gave two very specific examples of function calls. The entire point of my question was not "what's up with my (putative) code and data " but rather to try to understand the o

Re: [R] Useful books for learning the R software and the S programming language

2009-01-12 Thread David Winsemius
On Jan 12, 2009, at 3:36 PM, Robert Wilk wrote: any useful books for learning the R statistical software? are they pricey? Compared to medical texts, they are dirt cheap. and if the books recommended focus on S, how compatible will they be for someone learning R? Many are available for

Re: [R] Useful books for learning the R software and the S programming language

2009-01-12 Thread Carlos Guerra
Robert, I have Peter's book and I think it can be a very good place to start from... dispite the discount... :) If you like spatial analysis you can try to look for Roger Bivand et al. "Applied Spatial Data Analysis with R", If you are into something else try the "Use R" collection from S

[R] roll weekly data to monthly level

2009-01-12 Thread liujb
Dear R users: I have a data set that looks something like this: IDtime y 12/01/20084 12/09/200812 19/01/20088 21/06/20083 23/01/20084 23/09/20089 26/03/20084 31/02/20083 31/10/20088 32/02/20087 32/10

Re: [R] help on nested mixed effects ANOVA

2009-01-12 Thread Ben Bolker
Mukta Chakraborty gmail.com> writes: > > Hello, > I am trying to run a mixed effects nested ANOVA but none of my codes > are giving me any meaningful results and I am not sure what I am doing > wrong. I am a new user on R and would appreciate some help. > The experimental design is that I have s

Re: [R] Useful books for learning the R software and the S programming language

2009-01-12 Thread Peter Dalgaard
Robert Wilk wrote: any useful books for learning the R statistical software? are they pricey? Many. "Useful" depends on the reader, though, so look around. Here's a starting point http://www.r-project.org/doc/bib/R-books.html (modesty should forbid me to point at item 18 on the list and the

Re: [R] re tail case-pack ordering problem - can R help?

2009-01-12 Thread Stephan Kolassa
Hi gbh22, your problem looks a lot like a Cutting Stock Problem, http://en.wikipedia.org/wiki/Cutting_stock_problem Here, a_ij is your case pack profiles (how many of size j are in case pack i), x_i counts how many units of case pack i you want, and q_j counts how many units of size j you want

Re: [R] Useful books for learning the R software and the S programming language

2009-01-12 Thread Steve_Friedman
Look here to start. http://www.r-project.org/doc/bib/R-books.html Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147

[R] re tail case-pack ordering problem - can R help?

2009-01-12 Thread gbh22
I'm a programmer, not a mathmatician. I heard about R, and I'm wondering if anyone can tell me if there is an existing R function that can help with a problem we're currently trying to find an algorithm for. If R is not the answer, but you can recommend a known algorithm, that would help a lot!

Re: [R] RMySQL crashes R

2009-01-12 Thread auburneconomics
Duncan Murdoch-2 wrote: > > On 1/12/2009 1:02 PM, auburneconomics wrote: >> This is similar to another current post about RMySQL crashing R, except >> on >> the other post it crashed on connection to the database. I can >> successfully >> connect, and even can do dbListTables(). But, if I sen

[R] GarchOxFit Interface

2009-01-12 Thread mohamed elbehi
please send me the GarchOxFit Interface thanks _ [[elided Hotmail spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mai

[R] Problems with RMySQL and MySQL server version 5.1

2009-01-12 Thread Jeffrey Horner
For those R user's who don't subscribe to R-sig-db and are having troubles with the latest RMySQL binary on CRAN, please read the email thread at the end of this message. RMySQL 0.7-2 does work with MySQL 5.1, however the CRAN binary is linked against the 5.0 version. Best, Jeff O

[R] Useful books for learning the R software and the S programming language

2009-01-12 Thread Robert Wilk
any useful books for learning the R statistical software? are they pricey? and if the books recommended focus on S, how compatible will they be for someone learning R? thank you in advance for your help. P.S. specialized survey statistical procedures? Is R good at that? [[alternative H

Re: [R] merge table rows (\multirow)

2009-01-12 Thread Felipe Carrillo
Thanks a lot Dieter, I'll play a little bit with it. Also thanks for the hint on how to post a latex reproducible example. --- On Mon, 1/12/09, Dieter Menne wrote: > From: Dieter Menne > Subject: Re: [R] merge table rows (\multirow) > To: r-help@r-project.org > Date: Monday, January 12, 2009

Re: [R] merge table rows (\multirow)

2009-01-12 Thread Gabor Grothendieck
Look at the rgroup and n.rgroup arguments of ?latex function in Hmisc package or ?print.xtable in xtable package. On Mon, Jan 12, 2009 at 1:48 PM, Felipe Carrillo wrote: > Hi: > This is what my table should look like: > > Month Week EstpassageMedFL > July-27456634 >

Re: [R] RMySQL crashes R

2009-01-12 Thread Duncan Murdoch
On 1/12/2009 1:02 PM, auburneconomics wrote: This is similar to another current post about RMySQL crashing R, except on the other post it crashed on connection to the database. I can successfully connect, and even can do dbListTables(). But, if I send a query or anything to actually see the dat

[R] rpart with interval censored data crashes R

2009-01-12 Thread Terry Therneau
Thank you for the input on rpart -- I just saw the message today. 1. You are right, it should not crash. Why it crashes rpart is simply that I (the author) never ever tried using interval censored data in the call. Real users try the most amazing things I'll fix it in my local versio

[R] merge table rows (\multirow)

2009-01-12 Thread Felipe Carrillo
Hi: This is what my table should look like: Month Week EstpassageMedFL July-27456634 -28256835 -29328736 -30462337 Aug--31863237 --32423638 --33--

[R] RMySQL crashes R

2009-01-12 Thread auburneconomics
This is similar to another current post about RMySQL crashing R, except on the other post it crashed on connection to the database. I can successfully connect, and even can do dbListTables(). But, if I send a query or anything to actually see the data, R crashes to desktop. I have tried this

[R] help on nested mixed effects ANOVA

2009-01-12 Thread Mukta Chakraborty
Hello, I am trying to run a mixed effects nested ANOVA but none of my codes are giving me any meaningful results and I am not sure what I am doing wrong. I am a new user on R and would appreciate some help. The experimental design is that I have some frogs that have been exposed to three acoustic T

[R] Two-way repeated measures anova with lme

2009-01-12 Thread Erich Studerus
Dear R-Users, I'm trying to set up a repeated measures anova with two within subjects factors. I tried it by 3 different anova functions: aov, Anova (from car package) and lme (from nlme package). I managed to get the same results with aov and Anova, but the results that I get from lme are slig

Re: [R] R2WinBUGS stopping execution

2009-01-12 Thread Ben Bolker
hsl.gov.uk> writes: > > Apologies if this isn't acceptable for the general help list. > > I'm running OpenBUGS model via the R2WinBUGS package interface, under > Windows. Is it possible to terminate running models, short of using the > Windows Task Manager to forcibly exit the program? >

Re: [R] lm: how are polynomial functions interpreted?

2009-01-12 Thread Charles C. Berry
On Mon, 12 Jan 2009, c...@witthoft.com wrote: [nothing deleted] matplot(1:100, lm(rnorm(100)~poly(1:100,4),x=T)$x ) # for example __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Help with storage of each matrix generated in a loop

2009-01-12 Thread David Winsemius
If you are satisfied with the structure of cusumA and just want 999 more randome realizations of the same, then try creating an empty list to hold the 1000 dataframes you are creating and then accumulate sequentially to the list. > mat <- matrix(data=rep(c(1,2,3,4,5), 16), nrow=16, ncol=5)

Re: [R] Determining variance components of classed covariates

2009-01-12 Thread Gabor Grothendieck
You might want to try the https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models list next time for mixed model questions. At any rate the Variance column figures are variances, not percentages. We can use anova with REML=FALSE to make comparisons among models. Below we find that removing the

[R] Help with storage of each matrix generated in a loop

2009-01-12 Thread rafamoral
I need to store each matrix generated in a loop. I've been working with the CUSUM algorithm and I've been trying to implement it in R. What I need to do with my dataset is to create 1000 randomized datasets and cumulative sum them all and store all of those randomized CUSUMed datasets for further

[R] lm: how are polynomial functions interpreted?

2009-01-12 Thread cgw
__ 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, minimal, self-contained, reproducible code.

Re: [R] Working with duplicated rows

2009-01-12 Thread David Winsemius
One of undoubtedly many ways: # kind of a pain to delete the blank rows. Try to give us full example next time? > txt<- "long lat value + 10 20 5 + 6 2 3 + 27-3 9 + 10 20 10 + 4 -1 0 + 6 2 9 + " > DF2 <- read.table(textConnection

Re: [R] problems with download.file() from ftp?

2009-01-12 Thread Tony Breyal
I ran your script on Windows Vista Ultimate, SP1 and it worked fine: ## R start... > url <- > 'ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho/13e19.txt' > dest <- "//PFO-SBS001/Redirected/tonyb/Desktop/test/downloadtest.txt" > download.file(url, dest) trying URL 'ftp://ftp.

Re: [R] problems with download.file() from ftp?

2009-01-12 Thread Prof Brian Ripley
First, try the example in the test file (tests/internet.R) read.table("ftp://ftp.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat";) or download.file("ftp://ftp.stats.ox.ac.uk/pub/datasets/csb/ch11b.dat";, "test" That is known to work on many, many R systems. I get the same error as you on that UR

[R] Determining variance components of classed covariates

2009-01-12 Thread Stephen Montgomery
Hi - I am interested in solving variance components for the data below with respect to the response variable, Expression within R. However, the covariates aren't independent and they also have a class (of which the total variance explained by covariates in that class I am most interested in). Ve

Re: [R] Working with duplicated rows

2009-01-12 Thread Steve Murray
Thanks - that's great! _ Choose the perfect PC or mobile phone for you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

[R] R2WinBUGS stopping execution

2009-01-12 Thread Richard . Cotton
Apologies if this isn't acceptable for the general help list. I'm running OpenBUGS model via the R2WinBUGS package interface, under Windows. Is it possible to terminate running models, short of using the Windows Task Manager to forcibly exit the program? Regards, Richie. Mathematical Sciences

Re: [R] merge table rows (\multirow)

2009-01-12 Thread Dieter Menne
Felipe Carrillo wrote: > > I am trying to merge the 'Month' column using \multirow. For example for > the column 'Week' I want July to be merged into one row(weeks 27,28,29,30) > and so on for the following weeks. > Below, I am creating a PDF using Sweave, MikTex,R-2.8.1 and windows XP to > sho

Re: [R] Interval censored Data in survreg() with zero values!

2009-01-12 Thread Geraldine Henningsen
Hello again, I studied your suggestion but still I disagree. You wrote: "From the way you wrote the problem I assumed that there is some number of n "looks" at the subject and then you count them up." But this is not the case. My data is clearly continuous quantities and no discrete choices

Re: [R] (no subject)

2009-01-12 Thread Ben Bolker
Mélanie-Louise Leblanc ulaval.ca> writes: > > hi, > > I'm looking for R codes that can do modified Pearson correlation that corrects > for spatially correlated variables. > > thanks, > > Mélanie-L. Le Blanc I think you may need to find the answer to the statistical/subject area question fi

Re: [R] for loop and if problem

2009-01-12 Thread Prof Brian Ripley
There is write.csv2 on the same help page as write.csv! 'write.csv' uses '"."' for the decimal point and a comma for the separator. 'write.csv2' uses a comma for the decimal point and a semicolon for the separator, the Excel convention for CSV files in some Western Europ

Re: [R] Working with duplicated rows

2009-01-12 Thread Dimitris Rizopoulos
try aggregate(), e.g., dat <- read.table(textConnection("long lat value 10 20 5 6 2 3 27-3 9 10 20 10 4 -1 0 6 2 9"), header = TRUE) closeAllConnections() aggregate(dat["value"], list(Long = dat$long, Lat = dat$lat), sum) I

Re: [R] for loop and if problem

2009-01-12 Thread David Winsemius
write.csv does exactly what you would expect ... creates a *Comma* Separated Values file. If you don't want a comma separated value format then use write.table with sep=";" You can still name it "whatever.csv". Or you if you also intend commas for decimal points, use write.csv2 as describ

Re: [R] assign a list using expression?

2009-01-12 Thread Gabor Grothendieck
This still isn't clear. In your post, values is already a list with the required names and values in it so the whole exercise is pointless -- you are starting out with the answer. Just guessing, but maybe your setup is a set of variables in your workspace and a vector of their names with the outp

Re: [R] Working with duplicated rows

2009-01-12 Thread Henrique Dallazuanna
Try this: aggregate(dt$value, list(long = dt$long, lat = dt$lat), FUN = sum) On Mon, Jan 12, 2009 at 1:52 PM, Steve Murray wrote: > > Dear all, > > > > I have a dataframe of 3 columns, consisting of 'longitude', 'latitude' > and a corresponding 'value'. Where identical 'longitude' and 'latitude'

Re: [R] assign a list using expression?

2009-01-12 Thread Henrique Dallazuanna
Try using do.call: do.call(list, as.list(mycommand)) On Mon, Jan 12, 2009 at 1:58 PM, Skotara wrote: > Thank you Patrick and Gabor! > Sorry, I think I have not explainend it well. > The purpose is as follows: > names <- letters[1:3] > values <- data.frame(a = 1:3, b = 4:6, c = 7:9) > With mo

Re: [R] for loop and if problem

2009-01-12 Thread jim holtman
Try using: write.table(..., sep=";") write.csv just calls write.table On Mon, Jan 12, 2009 at 6:38 AM, Sake wrote: > > I have one final question... > How can I save a CSV ifile with ; separation in stead of , separation? > I know the write.csv(file="filename.csv") an that you can use sep=";" wh

Re: [R] assign a list using expression?

2009-01-12 Thread Skotara
Thank you Patrick and Gabor! Sorry, I think I have not explainend it well. The purpose is as follows: names <- letters[1:3] values <- data.frame(a = 1:3, b = 4:6, c = 7:9) With more complicated objects similar to 'names' and 'values' I wrote the following line to assign the elements of the

[R] Working with duplicated rows

2009-01-12 Thread Steve Murray
Dear all, I have a dataframe of 3 columns, consisting of 'longitude', 'latitude' and a corresponding 'value'. Where identical 'longitude' and 'latitude' pairs occur more than once, I want their corresponding 'value' to be summed and the 'pair' to only appear once. For example: long lat

[R] (no subject)

2009-01-12 Thread Mélanie-Louise Leblanc
hi, I'm looking for R codes that can do modified Pearson correlation that corrects for spatially correlated variables. thanks, Mélanie-L. Le Blanc __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

[R] problems with download.file() from ftp?

2009-01-12 Thread zack holden
Dear list, I am trying to download a text file from an ftp site using download.file(). I used the following code: url <- "ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho/13e19.txt"; dest <- "c:/test/downloadtest.txt" download.file(url, dest) I get this error message, ind

[R] Error in svd(S) : infinite or missing values in 'x'

2009-01-12 Thread André Dias
Hi everyone. I was running correspondence analysis in R with the package 'ca' and I got a error message that I could not solve. > summary(ca(gui)) Error in svd(S) : infinite or missing values in 'x' #where gui is my dat table as follows: 0 90 1 1 0 90 0 0 0

Re: [R] for loop and if problem

2009-01-12 Thread Sake
I have one final question... How can I save a CSV ifile with ; separation in stead of , separation? I know the write.csv(file="filename.csv") an that you can use sep=";" when you open a .csv file, but that doesn't work with the write.csv command. -- View this message in context: http://www.nabbl

Re: [R] connecting boxplots

2009-01-12 Thread Michael A. Miller
> johnhj wrote: > Can you also describe me how to describe the standard > deviation of the boxplots/matrices ? Try tapply: > x <-read.table(file="test.txt") > x$group <- rep(1:8, each=5) > boxplot(V3~gruppe, data=x) with(x, tapply(V3, gruppe, sd)) Mike

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Well, that isn't ideal for my purposes. (A little context - basically I have a script that I'm running for a lot of simulations, which is kinda buggy, and what I'm doing is I'm having the script periodically save whatever it has done so far to an automatically named file. Then if something odd happ

Re: [R] assign a list using expression?

2009-01-12 Thread Gabor Grothendieck
The purpose of this is not clear but depending on what a and b are you might be able to use a data frame (which is a list): > a <- 1:2; b <- 3:4 > data.frame(a, b) a b 1 1 3 2 2 4 On Mon, Jan 12, 2009 at 9:42 AM, Skotara wrote: > Dear R-users, > > I would like to assign elements to a list in t

Re: [R] assign a list using expression?

2009-01-12 Thread Patrick Burns
I think this is glossing over 9.7 of 'The R Inferno'. You aren't telling us what you really want to achieve. It seems hard for me to believe that the approach you are taking is going to be the easiest route to whatever that is. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.b

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Gabor Grothendieck
Another possibility is to have a separate directory for each project and place an .RData file in each. Now just cd to whatever directory corresponds to the project you wish to work on and start R normally. No code is needed. On Mon, Jan 12, 2009 at 10:04 AM, Zhou Fang wrote: > Ok, looks like I ca

[R] Problems with impute function from Hmisc library

2009-01-12 Thread Erich Studerus
Hello I would like to use the transcan and impute functions from Hmisc library for single impution. library(Hmisc) m1<-data.frame(x1=rnorm(20),x2=rnorm(20),x3=rnorm(20)) m1[c(2,4),1]<-NA t1<-transcan(~x1+x2+x3,data=m1,imputed=T) impute(t1) Fehler in as.environment(pos) : kein Ein

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Ok, looks like I can do what I want with --args, commandArgs() and an appropiate .First. Thanks, Zhou On Mon, Jan 12, 2009 at 2:27 PM, David Winsemius wrote: > See if this material is helpful: > > http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line > > -- David W

[R] assign a list using expression?

2009-01-12 Thread Skotara
Dear R-users, I would like to assign elements to a list in the following manner: mylist <- list(a = a, b = b, c = c) To do this I tried myexpr <- expression(a = a, b = b, c = c) mylist <- list( eval(myexpr) ) It ends up by overwriting a when b is assigned and b when c is assigned. Additionally

Re: [R] How to get solution of following polynomial?

2009-01-12 Thread Ravi Varadhan
Hi Hans, I actaually meant the "polynom" package (not "polynomial", which was a typo). I am curious as to the main differences between "polynom" and "PolynomF". Ron - by vectorizing, I mean that the function fn() can take a vector as an input and return the function values at all the points in

Re: [R] Loading workspaces from the command line

2009-01-12 Thread David Winsemius
See if this material is helpful: http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line -- David Winsemius On Jan 12, 2009, at 7:24 AM, Zhou Fang wrote: That's not really what I meant by 'command line'. I meant, well, loading from e.g. a bash shell, not from wi

Re: [R] anova() or aov()?

2009-01-12 Thread Chuck Cleland
On 1/12/2009 8:57 AM, j...@in.gr wrote: > Dear all, > > I have a simple (I think) question that is troubling me lately: > > Is there any main difference between anova() command and aov() command when > performing an ANOVA in Experimental design > analyses? The main difference is that aov() *

[R] anova() or aov()?

2009-01-12 Thread jass
Dear all, I have a simple (I think) question that is troubling me lately: Is there any main difference between anova() command and aov() command when performing an ANOVA in Experimental design analyses? Thank you for your time, Ismini __ R-help@r-

Re: [R] Extraction from an output

2009-01-12 Thread Chuck Cleland
On 1/12/2009 6:42 AM, robert-mcfad...@o2.pl wrote: > Hello, > Would you tell my how to extract a result from a test - it's justified > because I need to run this test many times. Here is an example from authors' > test: > >> library("coin") >> lungtumor <- data.frame(dose = rep(c(0, 1, 2), c(40

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
That's not really what I meant by 'command line'. I meant, well, loading from e.g. a bash shell, not from within an interactive R session itself. Thanks anyways, Zhou (Possibly this email was sent twice. Apologies) On Mon, Jan 12, 2009 at 12:15 PM, Henrique Dallazuanna wrote: > See ?load > > O

Re: [R] Loading workspaces from the command line

2009-01-12 Thread Henrique Dallazuanna
See ?load On Mon, Jan 12, 2009 at 10:12 AM, Zhou Fang wrote: > Hi, > > Is there any way to load workspaces (e.g. stuff from save.image) from > the command line? I'm on Linux, and would find this very helpful. > > I'm guessing this functionality can be duplicated with a skillful bash > script to

  1   2   >