Re: [R] Help needed for Loading tm package

2009-01-12 Thread Prof Brian Ripley
How do you account for the fact that the package passed its checks on the build machine, e.g. http://cran.r-project.org/bin/windows/contrib/2.8/check/RWeka-check.log and no one else is reporting this? (And it does work for me.) Blaming your tools is easy, but doing so on a public forum is

Re: [R] connecting boxplots

2009-01-12 Thread johnhj
Thank you very much David... Can you also describe me how to describe the standard deviation of the boxplots/matrices ? David Winsemius wrote: You do not provide a workable example and it appears you may be conflating the German and English spellings of group, but perhaps this code

Re: [R] How to reference previous row?

2009-01-12 Thread Carlos J. Gil Bellosta
Hello, The solution to problem will seem far easier if you think in a different way. For instance, you may want to consider the extra dummy column previous.first.value - c( NA, first[ - length(first) ] ) Then you can horizontally compare first with it's previous value. Best regards, Carlos J.

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

2009-01-12 Thread Dieter Menne
Felipe Carrillo mazatlanmexico at yahoo.com writes: I need help merging rows. 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

Re: [R] connecting boxplots

2009-01-12 Thread David Hajage
Or with package ggplot2 : library(ggplot2) c - qplot(cyl, mpg, data=mtcars) c + geom_boxplot(aes(group = factor(cyl))) + stat_summary(fun = median, geom = line, colour = red) + stat_summary(fun = function(x) min(x), geom = line, colour = blue) + stat_summary(fun = function(x) max(x), geom

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

2009-01-12 Thread Hans W. Borchers
RON70 ron_michael70 at yahoo.com writes: Hi Ravi, Thanks for this reply. However I could not understand meaning of vectorizing the function. Can you please be little bit elaborate on that? Secondly the package polynomial is not available in CRAN it seems. What is the alternate package?

[R] Problem between panel.abline and log scales (lattice)

2009-01-12 Thread Ptit_Bleu
Hello and Happy New Year to all R-Users !!! I would like to plot a lattice graph with a logarthmic y axis and add two reference lines that is : ref-c(0.0070, 0.0096) graph1-xyplot(data$y1 ~ as.numeric(strptime(data$x1, format=%Y-%m-%d %H:%M:%S)) | as.character(data$Code), list(y = list(log =

Re: [R] calibrate function

2009-01-12 Thread Thomas Lumley
On Sun, 11 Jan 2009, [iso-8859-1] Elsa et Stéphane BOUEE wrote: Hi all, I have a question on the package « survey” Please don't send questions to the list and to me separately. Either one is ok, but not both. I have some difficulties to use the function ‘calibrate’. Although it works well

[R] Extraction from an output

2009-01-12 Thread robert-mcfadden
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, 50, 48)), tumor = c(rep(c(0, 1), c(38, 2)), rep(c(0, 1), c(43,

[R] Grayscale figures in odfWeave?

2009-01-12 Thread Fredrik Karlsson
Dear list, I am sorry if this is a FAQ, but I have just started using odfWeave for report construction and it seems not to behave exactly like Sweave. I want to get my figures in grayscale, but the tip given in the FAQ of Sweave http://www.stat.uni-muenchen.de/~leisch/Sweave/FAQ.html#x1-1A.8

[R] PRESS alternative

2009-01-12 Thread Andrej Kastrin
Dear all, Using lm models one can calculate predicted residual sum of squares (PRESS) statistic to select appropriate number of prediction variables in lm model. Is there any alternative to PRESS statistic for lda (linear discriminant analysis) model where predicted outcome variable is

Re: [R] How to reference previous row?

2009-01-12 Thread Henrique Dallazuanna
Try this: X$third - rep(X$second[which(!duplicated(X$first))], table(X$first)) On Mon, Jan 12, 2009 at 5:57 AM, Heston Capital hestoncapi...@gmail.comwrote: I am trying to write some code where the factor references its previous value, but can't find a solution searching through the archive.

[R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
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 rename the particular file to .RData (and then back once R terminates), but

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 zhou.zf...@gmail.com 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

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 www...@gmail.com wrote:

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, 50, 48)),

[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 __

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() *fits*

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

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 the

[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] 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 dwinsem...@comcast.net wrote: See if this material is helpful:

[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

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 zhou.zf...@gmail.com wrote:

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

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 nils.skot...@uni-hamburg.de wrote: Dear R-users, I would like to assign

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

Re: [R] connecting boxplots

2009-01-12 Thread Michael A. Miller
johnhj jhar...@web.de 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] 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:

[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

[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,

[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

[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

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

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 tlep.nav.e...@hccnet.nl 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

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 nils.skot...@uni-hamburg.dewrote: 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 =

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 smurray...@hotmail.comwrote: Dear all, I have a dataframe of 3 columns, consisting of 'longitude', 'latitude' and a corresponding 'value'. Where identical

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

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 described

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] (no subject)

2009-01-12 Thread Ben Bolker
Mélanie-Louise Leblanc melanie-louise.leblanc.1 at 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

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. I

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 show an

[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

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

[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).

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 URL,

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

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 -

[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.

[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

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

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] 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

Re: [R] R2WinBUGS stopping execution

2009-01-12 Thread Ben Bolker
Richard.Cotton at 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

[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

[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

[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] 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

[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

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

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 mazatlanmex...@yahoo.com wrote: Hi: This is what my table should look like: Month Week EstpassageMedFL

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 dieter.me...@menne-biomed.de wrote: From: Dieter Menne dieter.me...@menne-biomed.de Subject: Re: [R] merge table rows (\multirow) To:

[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

[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

[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

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 send a query

[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] 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

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

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] help on nested mixed effects ANOVA

2009-01-12 Thread Ben Bolker
Mukta Chakraborty chakraborty.mukta at 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

[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 3

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

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

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

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 detected ***

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] 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] 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 Month

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

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 + 1

[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

[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

[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

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 j...@sfu.ca 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

[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 jQAAQ UQAAg FQAAw

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 compared

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 gunda...@gmail.com wrote: Dear all, I have the following matrix: str(mat) Named chr [1:32268]

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

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

[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 ~12million element,

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

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 - Indonesia On Tue, Jan

[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] 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 c...@witthoft.com wrote: damn. My apologies to everyone -- I sent one message and it got destroyed somehow. Here's the part that was

[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 returning [1] 3 6 6

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 gunda...@gmail.com wrote: Hi Jorge and all, How can I modified your code when query

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

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)) user system elapsed 0.2

  1   2   >