[R] Fwd: Functional programming and R: Recommendations?

2010-07-03 Thread schuster
Hello R list members, I have a good object-oriented programming and software engineering background (mostly Java) and know some R. I'd like to learn more about functional programming concepts and its support and application in R. Do you have any recommendations (books, links etc)? I read (a

[R] RCurl question

2010-07-03 Thread Brad McNeney
The following call to curl fetches me the information I want (as html) from a webserver: curl -F list_fi...@snptxt -F html_output=on http://integrin.ucd.ie/cgi-bin/rs2cm.cgi The file snptxt is a plain-text file in my working directory with the following two lines: rs6598 rs123456 In R I try to

[R] help with predict.lda

2010-07-03 Thread Changbin Du
HI, Dear community, I am using the linear discriminant analysis to build model and make new predictions: > dim(train) #training data [1] 1272 22 > dim(valid) # validation data [1] 140 22 lda.fit <- lda(out ~ ., data=train, na.action="na.omit", CV=TRUE) # model fitting of linear discriminan

Re: [R] How to generate longitudinal data using R

2010-07-03 Thread Charles C. Berry
On Sat, 3 Jul 2010, ZZY ZYBOYS wrote: How to generate the longitudinal data with correlation structure of independent , exchangeable and AR (1) through errors? Can someone provide some sample codes? See http://cran.r-project.org/web/views/Distributions.html Great appreciation! Th

[R] interval censored grouped data

2010-07-03 Thread Tims Corbett
Hi All, I have data in the following format: Inspection #failures Month/Year 01/99 5 02/99 20 06/993 01/02 3 for 11 years ... the prob of failure on demand per month pfd is #Total failures / sample size(=total components

Re: [R] PDFfontNumber bugs in devPS.c (Re: plain text in Chinese can not be set)

2010-07-03 Thread Paul Murrell
Hi Thanks very much for the report, diagnosis, and patch! I have implemented your fix in the development version of R. Paul Jinsong Zhao wrote: On 2010-7-1 15:24, Jinsong Zhao wrote: Read the source again more carefully. I think I get the solution: Change the following line in PDFfontNumber

[R] How to generate longitudinal data using R

2010-07-03 Thread ZZY ZYBOYS
How to generate the longitudinal data with correlation structure of independent , exchangeable and AR (1) through errors? Can someone provide some sample codes? Great appreciation! Thanks much, Yi [[alternative HTML version deleted]] __ R-help@

Re: [R] Change the frequency of a ts?

2010-07-03 Thread Nicholas R Frazier
Thanks, Stefan. I'm sure the difference between ts() and as.ts() seemed simple to everyone on the list, but I'd been staring at the help files for a long time and never made the connection. ts's make more sense now. Nick Frazier On Sat, Jul 3, 2010 at 8:10 AM, Stefan Grosse wrote: > Am 03.07

Re: [R] Best way to compute a sum

2010-07-03 Thread Bernardo Rangel Tura
On Fri, 2010-07-02 at 21:23 -0700, Roger Deangelis wrote: > > Although it does not apply to your series and is impractical, it seems to > me that the most accurate algorithm might be to add all the rational numbers > whose sum and components can be represented without error in binary first, >

Re: [R] Double Integration

2010-07-03 Thread Hans W Borchers
Bogaso Christofer gmail.com> writes: > > Hi Ravi, your suggestion helped me as well a lot. If I look into > that function, I see this function is calling another function : > > .Call("doCubature", as.integer(fDim), body(f.check), > as.double(lowerLimit), as.double(upperLimit), >

Re: [R] Assigning entries to categories

2010-07-03 Thread Charles C. Berry
On Sat, 3 Jul 2010, LogLord wrote: Thanks for your help! You are right it is not one-to-one assigned that would be indeed very easy... its more like assigning 1000 entries to 60 categories... Unfortunately, the ?match and ?merge did not help me a lot... I am a newbie to such programming stuff

Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)

2010-07-03 Thread Ryusuke Kenji
Hi Prof, Thank you for your reply. Sorry that I missed out the below information. >Sys.getlocale() [1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252" I have just noticed that tra

Re: [R] logistic regression - glm() - example in Dalgaard's book ISwR

2010-07-03 Thread Marc Schwartz
On Jul 3, 2010, at 9:00 AM, David Winsemius wrote: > > On Jul 2, 2010, at 11:33 PM, Paulo Barata wrote: > >> >> Dear R-list members, >> >> I would like to pose a question about the use and results >> of the glm() function for logistic regression calculations. >> >> The question is based on an

Re: [R] XML and RCurl: problem with encoding (htmlTreeParse)

2010-07-03 Thread Duncan Temple Lang
Hi Ryusuke I would use the encoding parameter of htmlParse() and download and parse the content in one operation: htmlParse("http://home.sina.com";, encoding = "UTF-8") If you want to use getURL() in RCurl, use the .encoding parameter You didn't tell us the output of Sys.getlocale()

Re: [R] logistic regression - glm() - example in Dalgaard's book ISwR

2010-07-03 Thread David Winsemius
On Jul 2, 2010, at 11:33 PM, Paulo Barata wrote: Dear R-list members, I would like to pose a question about the use and results of the glm() function for logistic regression calculations. The question is based on an example provided on p. 229 in P. Dalgaard, Introductory Statistics with R, 2

Re: [R] logistic regression - glm() - example in Dalgaard's book ISwR

2010-07-03 Thread Juliet Hannah
You may find both of Alan Agresti's books on categorcial data analysis useful. Try googling both books and then search the word "grouped" within each book. Agresti refers to the difference you describe as grouped versus ungrouped data. The likelihoods differ and all summaries based on the likelihoo

Re: [R] Double Integration

2010-07-03 Thread Prof Brian Ripley
On Sat, 3 Jul 2010, Christos Argyropoulos wrote: There used to be an "adapt" package with an "integrate" function (I inverted the function/package name by mistake) in CRAN but it has been removed. Anyone knows why? It lacked a valid licence. It wasn't actually removed, rather archived: see

Re: [R] Double Integration

2010-07-03 Thread Bogaso Christofer
Hi Ravi, your suggestion helped me as well a lot. If I look into that function, I see this function is calling another function : .Call("doCubature", as.integer(fDim), body(f.check), as.double(lowerLimit), as.double(upperLimit), as.integer(maxEval), as.double(absError), as.doubl

Re: [R] ggplot qplot bar removing bars when truncating scale

2010-07-03 Thread Hadley Wickham
This is possible in ggplot2, but it's an not appropriate use of a bar chart - because length is used to convey value, chopping the bottoms of the bars of will give a misleading impression of the data. Instead, use a dot plot: data$Q <- unlist(lapply(data$Q, function(x) paste(strwrap(x, 20), collap

[R] Non-exported data sets?

2010-07-03 Thread Hadley Wickham
> Sure.  The code uses objects() to find the exported objects in the > package, so I guess the offending object will be there.  You can check > for yourself by loading the package and calling objects() on the package > environment. So I guess my question then is how do data sets and namespaces int

Re: [R] Change the frequency of a ts?

2010-07-03 Thread Stefan Grosse
Am 03.07.2010 13:55, schrieb Nicholas R Frazier: > I'm trying to convert a column of a table into a ts object. The data is > monthly, so I want the ts frequency to be 12. > > I did this ... > >> filings.ts = as.ts(Filings.100K, frequency=12) try: filings.ts <- ts(Filings.100K, frequency=12) e

Re: [R] Odp: Problem with aggregating data across time points

2010-07-03 Thread Chris Beeley
Thanks for all your help, that has worked a treat. To answer your questions, I want to include the zero rows because I am going to analyse using mixed models (with dummies for day of week, location etc.) and I thought it was necessary to include a complete list of time variables, but now I'm won

Re: [R] Change the frequency of a ts?

2010-07-03 Thread Achim Zeileis
On Sat, 3 Jul 2010, Nicholas R Frazier wrote: I'm trying to convert a column of a table into a ts object. The data is monthly, so I want the ts frequency to be 12. I did this ... filings.ts = as.ts(Filings.100K, frequency=12) Use the constructor function ts(), not the coercion function as.

[R] Change the frequency of a ts?

2010-07-03 Thread Nicholas R Frazier
I'm trying to convert a column of a table into a ts object. The data is monthly, so I want the ts frequency to be 12. I did this ... > filings.ts = as.ts(Filings.100K, frequency=12) > filings.ts Time Series: Start = 1 End = 311 Frequency = 1 [1] 246.9336 305.6789 ... ... > tsp(filings.ts) [1

Re: [R] merging plot labels in a lattice plot

2010-07-03 Thread Dennis Murphy
Hi: On Fri, Jul 2, 2010 at 8:57 AM, Rajarshi Guha wrote: > Hi, I have a lattice lot conditioned on two variables. Example code is: > > library(lattice) > x <- data.frame(d=runif(100), >f1=sample(c('yes', 'no'),100,replace=TRUE), >f2=c(rep('Run1',30),rep('Run2',30),

Re: [R] Double Integration

2010-07-03 Thread Christos Argyropoulos
There used to be an "adapt" package with an "integrate" function (I inverted the function/package name by mistake) in CRAN but it has been removed. Anyone knows why? Christos > CC: argch...@hotmail.com; sarah_sanche...@yahoo.com; r-help@r-project.org > From: dwinsem...@comcast.net > To: rvarad.

Re: [R] conditional dataframe search and find

2010-07-03 Thread Allan Engelhardt
> ct.df[ct.df$conc < 25,"time"] [1] 10 11 12 13 14 15 > ct.df[ct.df$conc < 25,"time"][1] > df[df$conc < 25,"time"][1] [1] 10 See also help("order") if conc is not ordered. On 02/07/10 22:50, oscar linares wrote: time conc 1 0 164.495456 2 1 133.671185 3 2 10

[R] help on bar chart

2010-07-03 Thread ppcrystal
Hey guys, This is the bar chart that I am working on: library(lattice); data <- data.frame( X1 = c(2300, 1300, 1300, 450), X2 = c(2110, 2220, 1100, 660), Y = factor(c("sample1", "sample2", "sample3", "sample4")) ); barchart( Y ~ X1 + X2, data,

[R] Error in solve.default

2010-07-03 Thread Dmitrij Kudriavcev
Hello I use c++ program, what call R-project to solve matrix multiplications. Some times, I get an error in R: Error in solve.default(V, R) : system is computationally singular: reciprocal condition number = 2.20828e-19 Execution halted After that, the program crash. The code, what i execute,

Re: [R] Best way to compute a sum

2010-07-03 Thread Roger Deangelis
Although it does not apply to your series and is impractical, it seems to me that the most accurate algorithm might be to add all the rational numbers whose sum and components can be represented without error in binary first, ie 2.5 + .5 or 1/16 + 1/16 + 1/8. You could also get very clever

[R] conditional dataframe search and find

2010-07-03 Thread oscar linares
After some processing... ct.df<- data.frame(time,conc) ct.df gives time conc 1 0 164.495456 2 1 133.671185 3 2 108.622975 4 3 88.268468 5 4 71.728126 6 5 58.287225 7 6 47.364971 8 7 38.489403 9 8 31.27699

Re: [R] Assigning entries to categories

2010-07-03 Thread LogLord
Thanks for your help! You are right it is not one-to-one assigned that would be indeed very easy... its more like assigning 1000 entries to 60 categories... Unfortunately, the ?match and ?merge did not help me a lot... I am a newbie to such programming stuff in R. It would be great if you could

Re: [R] Inverting a scale(X)

2010-07-03 Thread Peter Ehlers
On 2010-07-03 0:05, Godfrey van der Linden wrote: G'day, All. I have been trying to trackdown a problem in my R analysis script. I perform a scale() operation on a matrix then do further work. Is there any way of inverting the scale() such that sX<- scale(X) Xprime<- inv.scale(x);