[R] R for Reuters

2006-12-29 Thread Shubha Vishwanath Karanth
Can we download data of Reuters from R? Just like we have RBloomberg, do we have something like RReuters? Is this under the developing stage? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list

Re: [R] t-test

2006-12-29 Thread Peter Dalgaard
John Mason wrote: I have downloaded the latest version of R and continue to have the same problem I did with the previuos version which is that I am unable to run a two-sample t-test in R-commander. I can run a paired t-test and a one sample t-test but not a two-sample t-test or one factor

[R] BradleyTerry subscript out of bounds

2006-12-29 Thread Jeff Newmiller
I don't see the problem with the following... the citations and baseball data work fine, but my simulated data seems to give BTm a headache. What am I missing? --- library(BradleyTerry) library(doBy) ng - 100 players - factor( sort( c( jeff, mike, paul, rich ) ) ) np - length( players ) p1 -

Re: [R] Help with histograms

2006-12-29 Thread Antony Unwin
The iPlots package provides interactive graphics. One way to to what you want to do would be to create a variable with all values and a second binary variable recording which are the 16 special cases. Draw an interactive histogram of the first with ihist and an interactive barchart of

[R] strange logical results

2006-12-29 Thread Erin Hodgess
Dear R People: I am getting some odd results when using logical operators: x - seq(from=-1,to=1,by=0.1) x [1] -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 [16] 0.5 0.6 0.7 0.8 0.9 1.0 x == -1 [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

Re: [R] strange logical results

2006-12-29 Thread Chuck Cleland
Erin Hodgess wrote: Dear R People: I am getting some odd results when using logical operators: x - seq(from=-1,to=1,by=0.1) x [1] -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 [16] 0.5 0.6 0.7 0.8 0.9 1.0 x == -1 [1] TRUE FALSE FALSE FALSE

Re: [R] Error message using normality test in vars

2006-12-29 Thread Pfaff, Bernhard Dr.
I'm running a vector-time series model with the vars package. When I test the univariate and multivariate normality of the residuals using normality(), I get the results, but also this warning Warning messages: 1: longer object length is not a multiple of shorter object length in: b2

[R] What's meaning of the lambda in nlrq output

2006-12-29 Thread Sun, Shuguang
I used the nlrq function in the package quantreg. There is a lambda in the output when I set trace=TRUE. With different start point, the results are converged, but the last lambda is different. I want to know the meaning lambda=1 and lambda=0. Many Thanks! Examples of output 1. Where the last

Re: [R] R for Reuters

2006-12-29 Thread ahmad ajakh
Hi Shubha, There is no reuter link in R. It does not exist in Splus either nor in matlab. Apparently this is a legal type of issue from reuter who is keeping its data proprietary. AA. - Original Message From: Shubha Vishwanath Karanth [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent:

Re: [R] CV by rpart/mvpart

2006-12-29 Thread Terry Therneau
The rpart function allows one to give the cross-validation groups explicitly. So if the number of observations was 10, you could use rpart( y ~ x1 + x2, data=mydata, xval=c(1,1,2,2,3,3,1,3,2,1)) which causes observations 1,2,7, and 10 to be left out of the first xval sample, 3,4, and 9 out

Re: [R] How to debug R program?

2006-12-29 Thread tfjbl
On Loops: The apply coomands are better, faster than loops. If there are lots of loops or nested loops then you should be able to replace some of the loops with an apply command. If you have nested loops I'd recommend replacing loops on the inside first. R seems better designed using the apply

[R] problems with arima()

2006-12-29 Thread Santiago Cilintano
Hi! I have problems with the function arima(), it takes too much time to run (15 minuts) it is normal? for example I put: a-arima(d7,c(0,0,5),seasonal=list(order=c(0,1,2),period=7)) where d7 is a daily time serie with 3600 observations Are there another function to modelize 2 seasonalities

Re: [R] strange logical results

2006-12-29 Thread Greg Snow
This is FAQ 7.31 in the R FAQ. Basically computers in general have problems exactly representing all but a few floating point numbers, so while 2 numbers may look the same when displayed (rounded to a couple of digits), they are different if you look at them in full precision due to different

[R] Why giving negative density when doing kernel density estimate?

2006-12-29 Thread 李俊杰
Why? And how to solve it? The code and result are following, data=rnorm(50) kde=density(data,n=20,from=-1,to=10) kde$x;kde$y [1] -1.000 -0.4210526 0.1578947 0.7368421 1.3157895 1.8947368 [7] 2.4736842 3.0526316 3.6315789 4.2105263 4.7894737 5.3684211 [13] 5.9473684

[R] coded to categorical variables in a large dataset

2006-12-29 Thread sj
I am working with a dataset where there are 5 possible outcomes (coded 1:5), I would like to create 5 categorical variables (event1...event5). I am using a for loop an if statements, but I have a large dataset( approx 100,000 rows) it takes quite a bit of time, is there a way to speed this up?

Re: [R] coded to categorical variables in a large dataset

2006-12-29 Thread Chuck Cleland
sj wrote: I am working with a dataset where there are 5 possible outcomes (coded 1:5), I would like to create 5 categorical variables (event1...event5). I am using a for loop an if statements, but I have a large dataset( approx 100,000 rows) it takes quite a bit of time, is there a way to

Re: [R] coded to categorical variables in a large dataset

2006-12-29 Thread Richard M. Heiberger
## The main reason for wanting such a coding is to use it in ## a linear model. Therefore, declare the variable to be a factor ## and use it directly. tmp - sample(1:5, 40, replace=TRUE) tmpf - factor(tmp) tmp.y - rnorm(40) tmp.aov - aov(tmp.y ~ tmpf) summary(tmp.aov) contrasts(tmpf)

Re: [R] coded to categorical variables in a large dataset

2006-12-29 Thread jim holtman
try this: test2 - rep(seq(1:5),2000) #setup a data frame and index into the columns result - data.frame(event1=rep(0,length(test2)), event2=rep(0,length(test2)), + event3=rep(0,length(test2)), event4=rep(0,length(test2)), event5=rep(0,length(test2))) for (i in seq(ncol(result))){ +

[R] Difference of array and vector

2006-12-29 Thread Geoffrey Zhu
Hi, I am really new at R. Does anyone know what is the real difference of vector and array, except that many operations that expect an array does not work on a vector? Thanks, Geoffrey ___=0A= =0A= =0A= The information in this email or in any

Re: [R] coded to categorical variables in a large dataset

2006-12-29 Thread Gabor Grothendieck
As Richard has already pointed out you may only need to convert your numeric vector to a factor but just in case here are a few direct answers: Using X from Chuck's post here are two ways of creating a 100x5 matrix of indicator variables: model.matrix(~ X-1, list(X = factor(X))) outer(X, 1:5,

Re: [R] OT: any recommendation for scripting language

2006-12-29 Thread Mike Prager
Wensui Liu [EMAIL PROTECTED] wrote: Right now, I am using SAS and S+/R. As a new year resolution, I am planning to learn a scripting language. from statisticians' point of view, which scripting language is worth to learn, perl, python, or any other recommendation? (Most likely, I will be

Re: [R] Difference of array and vector

2006-12-29 Thread Michael Kubovy
On Dec 29, 2006, at 2:16 PM, Geoffrey Zhu wrote: Does anyone know what is the real difference of vector and array? # Here's a vector: letv - letters is.vector(letv) # Here's an array: leta - as.array(letters) is.array(leta) attributes(letv) attributes(leta) To understand the importance of

[R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-29 Thread Talbot Katz
Hi. I am using R 2.3.1 on Windows XP. I had installed a library package into my first session and wanted the same package in my second session, so I went out to the CRAN mirror and tried to install the package, and got the following message:

[R] installation problems

2006-12-29 Thread Halim Damerdji
Hi, I installed R-2.4.0 and R-2.4.1 on linux redhat (RHEL 3.0), and am encountering the following messages below. I searched the R FAQs and over the net, but couldn't find helpful information. When I check-all I do see some diff's (e.g., for stats, nls.Rout and nls.Rout.save in

Re: [R] installation problems

2006-12-29 Thread Uwe Ligges
Halim Damerdji wrote: Hi, I installed R-2.4.0 and R-2.4.1 on linux redhat (RHEL 3.0), and am encountering the following messages below. I searched the R FAQs and over the net, but couldn't find helpful information. When I check-all I do see some diff's (e.g., for stats, nls.Rout and

Re: [R] Difference of array and vector

2006-12-29 Thread Farrel Buchinsky
I had had problems getting my head around what an array was as opposed to a data frame and where vectors fitted into the two. I found a useful URL on the same website eluded to below. http://www.burns-stat.com/pages/Tutor/unwilling_S.pdf Go to the heading The Look and Feel of Objects Farrel

Re: [R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-29 Thread Uwe Ligges
You can only expect that update / reinstall a ***package*** works if you have not yet loaded it into your R session. Hence close R, start it without loading the relevant package and then update/reinstall. Best, Uwe Ligges Talbot Katz wrote: Hi. I am using R 2.3.1 on Windows XP. I had

[R] Survfit with a coxph object

2006-12-29 Thread sj
I am fitting a coxph model on a large dataset (approx 100,000 patients), and then trying to estimate the survival curves for several new patients based on the coxph object using survfit. When I run coxph I get the coxph object back fairly quickly however when I try to run survfit it does not

Re: [R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-29 Thread Talbot Katz
Hi Uwe. Thank you so much for responding! I guess I wasn't entirely clear about the problem. If I make the mistake of trying to install a package from CRAN in a second session after I've already installed it in a previous session, it won't install in the second session, and even if I close

Re: [R] coded to categorical variables in a large dataset

2006-12-29 Thread Charles C. Berry
On Fri, 29 Dec 2006, sj wrote: I am working with a dataset where there are 5 possible outcomes (coded 1:5), I would like to create 5 categorical variables (event1...event5). I am using a for loop an if statements, but I have a large dataset( approx 100,000 rows) it takes quite a bit of time,

Re: [R] strange logical results

2006-12-29 Thread Bill.Venables
Hi Erin, You would be safe on a machine that represented floating point numbers in base 10, and I haven't seen one of those for such a long time... All modern machines use base 2 for floating point numbers. The moral of the story is not to believe what you see printed. The number you see

Re: [R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-29 Thread Henrik Bengtsson
Hi, it sounds like you mixing up the words install and load. Basically, you only have to *install* a package once on your computer, but have to load it for every R session which you are going to use it in. So, in your case install it once, using either install.packages(corpcor) or the

Re: [R] installation problems

2006-12-29 Thread Halim Damerdji
Hi Uwe, Thank you very much for the hint. I had a .Renviron in my home directory pointing to my 2.0.1 version. After removing that file, everything worked fine. Thanks again! Happy new year. Best regards, -Halim On 12/29/06, Uwe Ligges [EMAIL PROTECTED] wrote: Halim Damerdji wrote: Hi,

[R] wrapping mle()

2006-12-29 Thread Sebastian P. Luque
Hi, How can we set the environment for the minuslog function in mle()? The call in this code fails because the ll function cannot find the object 'y'. Modifying from the example in ?mle: library(stats4) ll - function(ymax=15, xhalf=6) { -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf),

Re: [R] wrapping mle()

2006-12-29 Thread Gabor Grothendieck
Add the line marked ### so that the environment of loglik.fun is reset to the environment within fit.mle so that it can find y there: library(stats4) ll - function(ymax=15, xhalf=6) { -sum(stats::dpois(y, lambda=ymax/(1+x/xhalf), log=TRUE)) } fit.mle - function(FUN, x, y) { loglik.fun -

Re: [R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-29 Thread Prof Brian Ripley
On Fri, 29 Dec 2006, Uwe Ligges wrote: You can only expect that update / reinstall a ***package*** works if you have not yet loaded it into your R session. Hence close R, start it without loading the relevant package and then update/reinstall. And for the record, this is answered in rw-FAQ

Re: [R] wrapping mle()

2006-12-29 Thread Prof Brian Ripley
On Fri, 29 Dec 2006, Sebastian P. Luque wrote: Hi, How can we set the environment for the minuslog function in mle()? The call in this code fails because the ll function cannot find the object 'y'. Modifying from the example in ?mle: library(stats4) ll - function(ymax=15, xhalf=6) {

Re: [R] Evaluating Entire Matlab code at a time

2006-12-29 Thread Henrik Bengtsson
Hi. On 12/30/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote: Dear Mr.Bengtsson, The steps you have suggested are working for single lines of matlab statements. But, as i mentioned earlier, If i want to see the output of an entire matlab code (say swissroll.m) then you suggested me to do res -