[R] how to access Internet from within R?

2009-06-26 Thread Michael
Let's say I have some automation tasks where I have to fill a table field on a webpage, and then submit it to the server, and then obtain the returned value (a typical web query), how to do that in R? Thanks a lot! __ R-help@r-project.org mailing list

Re: [R] how to access Internet from within R?

2009-06-26 Thread Barry Rowlingson
On Fri, Jun 26, 2009 at 7:21 AM, Michaelcomtech@gmail.com wrote: Let's say I have some automation tasks where I have to fill a table field on a webpage, and then submit it to the server, and then obtain the returned value (a typical web query), how to do that in R? The RCurl package will

Re: [R] what happened to the xlsReadWrite package

2009-06-26 Thread Prof Brian Ripley
On Fri, 26 Jun 2009, David Scott wrote: Andrew Yee wrote: A naive question: what happened to the xlsReadWrite package? http://cran.r-project.org/web/packages/xlsReadWrite/ It says that it was removed from the CRAN repository. Note that it was archived, not removed entirely. That is done

[R] multiple figure windows

2009-06-26 Thread Nattu
Hi, Is it possible to plot in multiple windows. for example Figure 1 in one window and Figure 2 in seperate window simultanously ? thanks, Nataraju -- No relationship is Static .. You either Step up or Step down [[alternative HTML version deleted]]

[R] Optimization and Linear Programming in R

2009-06-26 Thread Chris.Wilcox
Dear List, My student and I are looking for an optimizer for a nonlinear optimization problem we are working on. The problem we are working on is to try to pick a set of islands on which to eradicate rats for seabird conservation. We have about 50 islands, each of which has some subset of 17

[R] Batch problem

2009-06-26 Thread Alain Guillet
Hi, I want to make my R program run in batch under Windows XP. To do so, I create a bat file with the command RCMD BATCH --vanilla program.R program.out and I use the bat file with the scheduled task of Windows XP. Then I log off. It works up to the log off of another user on the same

Re: [R] Calculating home ranges using mcp in adehabitat

2009-06-26 Thread Eric R.
Tom: The structure of your dataframe (mydata) differs from the structure of the example dataframe (puechabon) in that the example dataframe has the structure 'locs' in which resides the x,y data and the individual identifier. The clue to your difficulty could be found when you asked to see the

Re: [R] Converting S-plus project folders to R

2009-06-26 Thread Uwe Ligges
dbosley wrote: I have many S-plus project folders that I need to convert to R workspaces. For the smaller project folders ( 200MB), using data.dump with oldStyle = T and data.restore (in the foreign package) within R seems to work fine. However, I have several project folders that are quite

Re: [R] multiple figure windows

2009-06-26 Thread Uwe Ligges
Nattu wrote: Hi, Is it possible to plot in multiple windows. for example Figure 1 in one window and Figure 2 in seperate window simultanously ? Sure, just start another device as in: x11() plot(1:10) x11() plot(1:10) Uwe Ligges thanks, Nataraju

Re: [R] panel.text and saving to pdf

2009-06-26 Thread Uwe Ligges
To get reproducible results, I highly recommend to print the lattice graphics directly into the desired device, i.e. start the pdf (or jpeg or whatever) device before printing. Best, Uwe Ligges Willem Vervoort wrote: Dear all, I am not sure what I am doing wrong, but I have some

Re: [R] panel.text and saving to pdf

2009-06-26 Thread Dieter Menne
Willem Vervoort w.vervoort at usyd.edu.au writes: I am not sure what I am doing wrong, but I have some unexplained behaviour when saving a lattice graph including text to a pdf file. The text seems to move around. It must have something to do with the way coordinates are set in devices other

[R] to raise in a loop more than 1

2009-06-26 Thread damien landais
I would raise x,y and z in a loop but I won't raise of 1. I tried this but it doesn't work mydata=matrix(nrow=1500,ncol=3) i=1 for(x in 0:10){ for(y in 0:20){ for(z in 0:10){ mydata[i,]=c(x,y,z) i=i+1 z=z+2} y=y+4} x=x+2} And I would have something like that x y z 0 0 0 0 0 2 0 0

[R] JRI - problem to access stats package

2009-06-26 Thread GRAN
Hi Geoff, Tks a lot for your reply. There are many points we do not understand. Can you clarify those one: - At first, why do you speak about an eclipse plugin ? We have compiled R and JRI together, so we get a jar file. We finally include this jar file inside our java project as a referenced

[R] Odp: to raise in a loop more than 1

2009-06-26 Thread Petr PIKAL
Hi does expand.grid(z=seq(0,6,2), y=seq(0,8,4), x=seq(0,10,2)) do what you want? Petr r-help-boun...@r-project.org napsal dne 26.06.2009 11:15:42: I would raise x,y and z in a loop but I won't raise of 1. I tried this but it doesn't work mydata=matrix(nrow=1500,ncol=3) i=1 for(x in

Re: [R] panel.text and saving to pdf

2009-06-26 Thread willem vervoort
Hi Uwe, I should send these messages from my member e-mail number Thanks for that. As you can see from the last bit of my code, I tried that, but it gave the same results. I had a look at pdf.options() but didn't see anything there either to make the text stay on the same spot. It seems to also

Re: [R] crr - computationally singular

2009-06-26 Thread Laura Bonnett
Dear Sir, Thank you for your response. You were correct, I had 1 linearly dependent column. I have solved this problem and now the rank of 'covaeb' is 17 (qr(covaeb)$rank = 17). However, I still get the same error message when I use covaeb in the 'crr' function.

[R] Odp: code that will use two data sets which differ in size.

2009-06-26 Thread Petr PIKAL
Petr Pikal petr.pi...@precheza.cz 724008364, 581252140, 581252257 r-help-boun...@r-project.org napsal dne 26.06.2009 05:31:27: Hi all, This is a really basic question but I can't figure it out. I am trying to write a piece of code that will use two datasets, z and m.. This code is

Re: [R] JRI - problem to access stats package

2009-06-26 Thread Geoff Gibbs
Sorry for the confusion, I obviously misunderstood. I thought you were trying to use R in an eclipse application, not an application written using eclipse. As far as I am aware, if the path and R_HOME environment variables are set then all should work OK. I think from you examples that the path

Re: [R] GeoXp package

2009-06-26 Thread Roger Bivand
The problem is that the binary Ubuntu install of gdal has not made sure that its dependencies are properly satisfied, so you'll need to do this manually. You can also make sure that the directory the GRASS libraries are found in is seen by ldconfig, either that or making sure that your running R

Re: [R] How to avoid ifelse statement converting factor to character

2009-06-26 Thread Craig P. Pyrame
Stavros Macrakis wrote: On Thu, Jun 25, 2009 at 12:47 PM, Craig P. Pyramecrap...@gmail.com wrote: The man page Stavros quotes states that the class attribute of the result is taken from 'test', which clearly is not the case: Actually, the behavior is documented pretty clearly:

[R] The Claw Density and LOCFIT

2009-06-26 Thread Van Wyk, Jaap
I am trying to reproduce Figure 10.5 of Loader's book: Local Regression and Likelihood. The code provided in the book does not seem to work. I have managed (a while ago) to get the accompanied R-code for the figures in the book (file called lffigs.R) from somewhere - cannot find it on the web

[R] Matching data to a new column

2009-06-26 Thread Kubasiewicz, Laura
Hi all, I wonder if anyone can help, I have a dataframe with columns for... 'I.D' 'age' 'mothers I.D' 01 5 03 02 6 06 03 16 NA 04 8 06 05 3 NA 06 17 NA I need to create a new column for 'mothers age' which puts the age of the

Re: [R] Matching data to a new column

2009-06-26 Thread Dieter Menne
Kubasiewicz, Laura laura.kubasiewicz08 at imperial.ac.uk writes: I have a dataframe with columns for... 'I.D' 'age' 'mothers I.D' 01 5 03 02 6 06 03 16 NA 04 8 06 05 3 NA 06 17 NA I need to create a new column for 'mothers

Re: [R] Optimization and Linear Programming in R

2009-06-26 Thread Liviu Andronic
Hello, On 6/26/09, chris.wil...@csiro.au chris.wil...@csiro.au wrote: We are looking for a solver that can deal with this nonlinear integer programming problem. We looked at a number of packages on the CRAN Task View: Optimization and Mathematical Programming, however, we have not been

[R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread Fredrik Karlsson
Dear list, Sorry for asking this very silly question on the list, but I seem to have made my life complicated by going into string manipulation in vectors. What I need is to get the last part of a sting (the two last tokens, separated by a space), and of course, this should be done for all

Re: [R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread jim holtman
This should do it a - c( %L H*L L*H H%, %L H* H%, %L L*H %, %L L*H % ) # split the strings x - strsplit(a, ' ') # get last two tokens sapply(x, function(.tokens) paste(tail(.tokens, 2), collapse=' ')) [1] L*H H% H* H% L*H % L*H % On Fri, Jun 26, 2009 at 7:21 AM, Fredrik Karlsson

Re: [R] Optimization and Linear Programming in R

2009-06-26 Thread Hans W Borchers
Chris.Wilcox at csiro.au writes: Dear List, [...] We are looking for a solver that can deal with this nonlinear integer programming problem. We looked at a number of packages on the CRAN Task View: Optimization and Mathematical Programming, however, we have not been able to locate

Re: [R] to raise in a loop more than 1

2009-06-26 Thread Rau, Roland
Dear Damien, -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of damien landais Sent: Friday, June 26, 2009 11:16 AM To: R-help@r-project.org Subject: [R] to raise in a loop more than 1 I would raise x,y and z in a loop but I

Re: [R] How to avoid ifelse statement converting factor to character

2009-06-26 Thread Stavros Macrakis
It gives me a headache, too! I think you'll have to wait for a more expert user than me to supply explanations of these behaviors and their rationales. -s On 6/26/09, Craig P. Pyrame crap...@gmail.com wrote: Stavros Macrakis wrote: On Thu, Jun 25, 2009 at 12:47 PM, Craig P.

Re: [R] to raise in a loop more than 1

2009-06-26 Thread jim holtman
I assume that you are getting this error: mydata=matrix(nrow=1500,ncol=3) i=1 for(x in 0:10){ + for(y in 0:20){ + for(z in 0:10){ + mydata[i,]=c(x,y,z) + i=i+1 + z=z+2} + y=y+4} + x=x+2} Error in mydata[i, ] = c(x, y, z) : subscript out of bounds No suitable frames for recover() i [1] 1501

Re: [R] apply on xts

2009-06-26 Thread David Winsemius
The way to get the best answers on r-help (and the method advised in the Posting Guide) is to offer the audience a specification of the libraries being used, to create examples that illustrate the sort of input expected, to offer the code that is being used, and to clearly specify what

Re: [R] crr - computationally singular

2009-06-26 Thread David Winsemius
Still the same reasons. It is possible to have collinearity without having any one column be a multiple of another. xyz - data.frame(x=sample(1:1000, 5), y=sample(1:1000, 5) , xx=sample(1:1000, 5) ,yy=sample(1:1000, 5) ) xyz$z - xyz$x + xyz$y + xyz$xx solve(xyz) Error in

Re: [R] The Claw Density and LOCFIT

2009-06-26 Thread Mark Difford
Hi Jaap, Could anybody please direct me in finding an updated version of this document, or help me correct the code given in the file. The (out-of-date) code is as follows: You are not helping yourself, or anyone else, by not including the error messages you get when trying to execute your

Re: [R] crr - computationally singular

2009-06-26 Thread Laura Bonnett
But I have centred all the dummy variables for the covariates... 2009/6/26 David Winsemius dwinsem...@comcast.net: Still the same reasons. It is possible to have collinearity without having any one column be a multiple of another. xyz - data.frame(x=sample(1:1000, 5), y=sample(1:1000, 5) ,

[R] Optimization and Linear Programming in R

2009-06-26 Thread R P Herrold
On Fri, 26 Jun 2009, Liviu Andronic wrote: There is `solnp', part of the Integer and Nonlinear Optimization in R (RINO) project [1]. It is still in early beta, though. [1] http://r-forge.r-project.org/projects/rino/ I do not find it at the indicated location on:

Re: [R] How to avoid ifelse statement converting factor to character

2009-06-26 Thread Craig P. Pyrame
Stavros Macrakis wrote: It gives me a headache, too! I think you'll have to wait for a more expert user than me to supply explanations of these behaviors and their rationales. Thanks, Stavros. I hope someone with expertise will shed more light on this, and in the meantime I'll try to

Re: [R] Deleting repeated rows

2009-06-26 Thread Etienne B. Racine
dreamworx wrote: Appologies if this is a simple problem. I have a matrix which is 86x3 and each row contains three integers. The problem I have is that some of the rows of integers are repeated in other rows and I only wish to have one copy of these rows. Is there a function that I can

Re: [R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread John Kane
I have the feeling that this is a very clumsy way to do it but I think it does what you want. = a - c( %L H*L L*H H%, %L H* H%, %L L*H %, %L L*H % ) mylist - strsplit(a, ) pick - function(x) {tail(x,2) } unlist(pick(mylist)

Re: [R] what happened to the xlsReadWrite package

2009-06-26 Thread Andrew Yee
Thanks for the detailed clarification. Perhaps the page here http://cran.r-project.org/web/packages/xlsReadWrite/ could include these explanations as well. I imagine I'm not the only user with these questions! Thanks, Andrew On Fri, Jun 26, 2009 at 2:48 AM, Prof Brian Ripley

[R] How to create separate plots for all combinations of some factors

2009-06-26 Thread Lane, Jim
Hi, All I have a data frame as follows: data.class(tapes) [1] data.frame names(tapes) [1] dateloc classdrp datascratch reclaim total Date is a date; loc, class and drp are factors; the rest are numerics. I want to generate separate plots by date for the numeric

Re: [R] Matching data to a new column

2009-06-26 Thread John Kane
x - I.D age 'MID' 01 5 03 02 6 06 03 16 NA 04 8 06 05 3 NA 06 17 NA xx - read.table(textConnection(x), header=TRUE); xx closeAllConnections() ag1 - xx[, c(1,2)] ; ag1 ag2 - xx[, c(1,3)] ; ag2 names(ag2[2]) - I.D merge(ag1,ag2,

Re: [R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread Fredrik Karlsson
HI Jim, Thank you! Works perfectly. /Fredrik On Fri, Jun 26, 2009 at 1:00 PM, jim holtmanjholt...@gmail.com wrote: This should do it a - c( %L H*L L*H H%, %L H* H%,  %L L*H %,   %L L*H % ) # split the strings x - strsplit(a, ' ') # get last two tokens sapply(x, function(.tokens)

Re: [R] predicted values after fitting gamma2 function

2009-06-26 Thread David Winsemius
On Jun 25, 2009, at 11:30 PM, Steven Matthew Anderson wrote: Question: after fitting a gamma function to some data, how do I get predicted values? I'm a SAS programmer, I new R, and am having problems getting my brain to function with the concept of object as class The following is

Re: [R] crr - computationally singular

2009-06-26 Thread Ravi Varadhan
How did you determine that you have full rank model matrix comprising 17 predictors? Are you able to invert the model matrix using `solve'? If not, you still have collinearity problem. If you are, then the problem might be in the Newton's method used by `crr' to solve the partial-likelihood

Re: [R] Calculating distance between spatial points

2009-06-26 Thread Ian Fiske
If your goal is to get the distance between geographic points, you might try computing the distance along the great circle arc and forget about projection. Several packages have functions that do this. See https://stat.ethz.ch/pipermail/r-help/2007-October/144546.html. hope that helps, Ian

[R] changing the loss function in the logistic regression?

2009-06-26 Thread Michael
Hi all, Is there a way to change the loss function in the logistic regression? Or we could provide a customized loss function in the logistic regression so we could use that loss function in the Cross Validation in logistic regression? Thanks a lot!

[R] parallel R?

2009-06-26 Thread Michael
Hi all, Lots of big IT companies are renting out their computing facilities. Amazon has one such service. In my understanding, this will dramatically improve the speed of my R program -- currently the cross validation and model selection part is the bottle neck. It take a few days to just finish

Re: [R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread Stavros Macrakis
One way is: a - c( %L H*L L*H H%, %L H* H%, %L L*H %, %L L*H % ) sub(^.*(^| )([^ ]+ [^ ]+$),\\2,a) [1] L*H H% H* H% L*H % L*H % Just be aware that this is not terribly efficient for very large strings. -s On Fri, Jun 26, 2009 at 7:21 AM, Fredrik Karlssondargo...@gmail.com

[R] R 2.9.1 is released

2009-06-26 Thread Peter Dalgaard
I've rolled up R-2.9.1.tar.gz a few hours ago. This is a maintenance release and fixes a number of mostly minor issues. See the full list of changes below. You can get it from http://cran.r-project.org/src/base/R-2/R-2.9.1.tar.gz or wait for it to be mirrored at a CRAN site nearer to you.

[R] Anova with multiple responses without loop

2009-06-26 Thread Sungeun Kim
Hello, I have one question about Anova in car package. Here is my situation: I have a response matrix (Y), consisting of 7 different responses for a group of subjects, 2 categorical factors (A, B), 3 covariates (C,D,E). I would like to know the main effects of 2 factors and the interaction

Re: [R] changing the loss function in the logistic regression?

2009-06-26 Thread Frank E Harrell Jr
Michael wrote: Hi all, Is there a way to change the loss function in the logistic regression? Or we could provide a customized loss function in the logistic regression so we could use that loss function in the Cross Validation in logistic regression? Thanks a lot! The goal is to use a loss

Re: [R] Matching data to a new column

2009-06-26 Thread Luc Villandre
Hi Laura, The function merge() works well, but another elegant to do it would involve match(). (Assuming your data.frame object is called x) x$motherAge - with(x, age[match(mothers.I.D,I.D)]) Cheers, -- *Luc Villandré* /Biostatistician McGill University Health Center - Montreal Children's

Re: [R] parallel R?

2009-06-26 Thread Dirk Eddelbuettel
On 26 June 2009 at 07:40, Michael wrote: | Hi all, | | Lots of big IT companies are renting out their computing facilities. | Amazon has one such service. In my understanding, this will | dramatically improve the speed of my R program -- currently the cross | validation and model selection part

Re: [R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread Gabor Grothendieck
Here is a similar solution using strapply in gsubfn. The pattern matches non-spaces, [^ ]+, followed by a space followed by non-spaces followed by end-of-string, $. library(gsubfn) strapply(a, [^ ]+ [^ ]+$, simplify = c) [1] L*H H% H* H% L*H % L*H % On Fri, Jun 26, 2009 at 7:21 AM, Fredrik

Re: [R] Converting S-plus project folders to R

2009-06-26 Thread Bosley, David
Thanks for the reply. Sometimes R does crash (quits completely). Other times, it just hangs after giving an error box with some sort of exception code, even though it looks like it's still trying to execute the data.restore. -Original Message- From: Uwe Ligges

Re: [R] parallel R?

2009-06-26 Thread Michael
I guess when we move to Amazon AWS, we have to rewrite the whole R programs? On Fri, Jun 26, 2009 at 8:05 AM, Dirk Eddelbuettele...@debian.org wrote: On 26 June 2009 at 07:40, Michael wrote: | Hi all, | | Lots of big IT companies are renting out their computing facilities. | Amazon has one

[R] Modifying Sweave.sty to allow escapes with fancyvrb package in LaTeX

2009-06-26 Thread Frank E Harrell Jr
Dear Colleagues: In an attempt to have things like # See page \pageref{this} inside comments in R code chunks I have modified Sweave.sty as below. I have followed fancyvrb's manual with regard to the use of the commandchars argument. But when compiling with LaTeX (using attached test file)

[R] Determining if swap memory is turned off

2009-06-26 Thread Prof. John C Nash
In order to run some performance tests on optimization tools, I want to be able to avoid the use of swap memory. In *nix systems, at least Linux ones, I can issue a 'sudo swapoff -a' command and use just the RAM available. If I don't do this, at some point swap will be used, the disk goes

Re: [R] How to create separate plots for all combinations of some factors

2009-06-26 Thread David Winsemius
You did not supply any executable examples for testing, but perhaps you could benefit by looking at: ?expand.grid ?tapply Those to split or index your data for all combinations of factors. ?mapply # to do the plotting. On Jun 26, 2009, at 9:54 AM, Lane, Jim wrote: Hi, All I have a

Re: [R] Converting S-plus project folders to R

2009-06-26 Thread Uwe Ligges
Bosley, David wrote: Thanks for the reply. Sometimes R does crash (quits completely). Other times, it just hangs after giving an error box with some sort of exception code, even though it looks like it's still trying to execute the data.restore. - Hmmm, that should not happen. Can you

Re: [R] Determining if swap memory is turned off

2009-06-26 Thread John C Frain
On windows XP | start | Control Panel | System | Advanced | Performance | Settings | Advanced | Virtual Memory | and select No Pagefile. I suspect Vista is similar. John 2009/6/26 Prof. John C Nash nas...@uottawa.ca: In order to run some performance tests on optimization tools, I want to be

Re: [R] Placing text outside graph boundary

2009-06-26 Thread Greg Snow
If you are using base graphics: Create an outer margin using something like: par(oma=c(0,0,3,0)) Then use mtext with the outer argument to place the text in the outer margin. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] GeoXp package

2009-06-26 Thread epoizot
Hi, I resolved partially my problem, by adding the path of the grass library where is located libgrass_I.so. So I add the following line to my .bashrc file: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr.lib/grass/lib Now, I can install and load rgdal and GeoXp libraries from R. Thanks for your

[R] calculate AIC

2009-06-26 Thread rongrongily1215
Dear all,   I want to calculate AIC values of PLSR models. But I find that AIC and extractAIC functions in R could not be used to calculate AIC values of PLSR models. Now I write a section of code(below) to calculate it. But I don't known whether the result is right or not. If I am wrong,

[R] Deleting repeated rows

2009-06-26 Thread dreamworx
Appologies if this is a simple problem. I have a matrix which is 86x3 and each row contains three integers. The problem I have is that some of the rows of integers are repeated in other rows and I only wish to have one copy of these rows. Is there a function that I can use which will identify

Re: [R] parallel R?

2009-06-26 Thread cls59
losemind wrote: Moreover, at my PC level, I have a 4-core PC, is there anything we could do in R to speed up my CV programs? I have seen one very nice paper that compared parallelization options for R: http://epub.ub.uni-muenchen.de/8991/ losemind wrote: we have to rewrite

Re: [R] Optimization and Linear Programming in R

2009-06-26 Thread Greg Snow
One option is to use optim with method='SANN' which is simulate annealing. The parameter vector is your vector of 0's and 1's, the fn argument is the function that you are trying to maximize with respect to the par vector (sounds like you have that pretty much worked out), then the gr argument

[R] R: Deleting repeated rows

2009-06-26 Thread Guazzetti Stefano
?unique as an example mat-matrix(c(1,2,3,1,1,2,1,2,3,4,7,5), ncol=3, byrow=T) mat #rows 1 and 3 are identical [,1] [,2] [,3] [1,]123 [2,]112 [3,]123 [4,]475 unique(mat) [,1] [,2] [,3] [1,]123 [2,]112 [3,]4

Re: [R] panel.text and saving to pdf

2009-06-26 Thread Deepayan Sarkar
On Fri, Jun 26, 2009 at 1:53 AM, Dieter Mennedieter.me...@menne-biomed.de wrote: Willem Vervoort w.vervoort at usyd.edu.au writes: I am not sure what I am doing wrong, but I have some unexplained behaviour when saving a lattice graph including text to a pdf file. The text seems to move

[R] 95% confidence interval coverage

2009-06-26 Thread Seunghee Baek
Hi R-users, I would like to compute 95%CI coverage for each bootstrapped sample. But, I don't know how to get 95% CI of estimate for each bootstrapped sample. I could only see the estimate of each bootstrapped sample. Thanks, Becky __

Re: [R] parallel R?

2009-06-26 Thread David M Smith
On Fri, Jun 26, 2009 at 8:28 AM, Michaelcomtech@gmail.com wrote: I guess when we move to Amazon AWS, we have to rewrite the whole R programs? Not necessarily. I use foreach (currently available in our REvolution R Enterprise distribution and coming very soon to CRAN), and test out the

[R] Indexing a list with a list

2009-06-26 Thread Greg Hirson
Dear list, I have two lists: one with data and one with TRUE/FALSE values for data I want to further analyze (see example below). I have been able to use a for loop to extract the data that I want to keep, but think that there probably exists a way to do it without a loop. Any ideas?

Re: [R] Indexing a list with a list

2009-06-26 Thread jim holtman
Your example has one more element in 'ind' than 'example' and that is what causes the error, but this should be close. #sample data set.seed(100) example = list(letters[1:10], letters[1:10], letters[1:10]) ind = list(as.logical(sample(0:1, 10, rep=TRUE)), +as.logical(sample(0:1,

Re: [R] Indexing a list with a list

2009-06-26 Thread Greg Hirson
Jim, Thank you for your help. I had a feeling it would be an apply function that could help. Kind regards, Greg jim holtman wrote: Your example has one more element in 'ind' than 'example' and that is what causes the error, but this should be close. #sample data set.seed(100) example

Re: [R] Indexing a list with a list

2009-06-26 Thread Henrique Dallazuanna
You have four elements in ind and three elements in example, then, try this mapply('[', example, ind[1:3]) On Fri, Jun 26, 2009 at 3:27 PM, Greg Hirson ghir...@ucdavis.edu wrote: Dear list, I have two lists: one with data and one with TRUE/FALSE values for data I want to further analyze

[R] (performance) time in Windows vs Linux

2009-06-26 Thread Cézar Freitas
Hi, all. I began to migrate my R codes from Windows to Linux and surprised me with an old question. I simplified the problem and made a little test to compare times at same computer and the Linux time is worse (not so little) than Windows time: 28 vs 53 seconds. I make an example (below) to

[R] 50993 point distance matrix, too big to as.matrix, looking for another way to calculate point-level summary

2009-06-26 Thread leif olson
Hello, Im working on a 50933 point count bird abundance dataset. I've succeeded in calculating a distance matrix for this entire set, but I don't have sufficient memory to convert this to a matrix, as below... abun.dist - dist(abun.mat[1:50993,1:235) test - rowMeans(as.matrix(abun.dist)) Error in

[R] Automatically placing a legend in an area with the most white space...

2009-06-26 Thread Jason Rupert
At one point I believe I heard of an R package that would automatically find the most empty space in a plot, and then that answer could then be used to intelligently place a legend. I would like to try to apply that R package to the contrived example shown below, so thank you for any hints

Re: [R] (performance) time in Windows vs Linux

2009-06-26 Thread Zeljko Vrba
On Fri, Jun 26, 2009 at 12:23:35PM -0700, Cézar Freitas wrote: I supposed R on Linux should be faster (32 and 64 bit) than windows version. Is this difference because 64 bit R version is slower than 32 bits one? I started the machine in both sittuations and checked free memory. I suspect

[R] gradient fill of a grid.polygon

2009-06-26 Thread baptiste auguie
Dear list, Following a recent enquiry, I've been playing with the idea of creating a colour gradient for a polygon, using the Grid package. The idea is to draw a number of stripes of different colours, using the grid.clip function. Below is my current attempt at this, library(grid)

[R] Heteroskedasticity and Autocorrelation in SemiPar package

2009-06-26 Thread Susan Chen
Hi all, Does anyone know how to report heteroskedasticity and autocorrelation-consistent standard errors when using the spm command in SemiPar package? Suppose the original command is sp1-spm(y~x1+x2+f(x3), random=~1,group=id) Any suggestion would be greatly appreciated. Thanks, Susan

[R] Alternate error structures in lme4?

2009-06-26 Thread bamsel
Hi R users, The nlme library enabled several alternate error structures useful for longitudinal or repeated-measures data. For example, a continuous AR(1) process: model_2 = update(model_1, correlation = corCAR1(form = ~ time | subject)) Does anybody know if this is available in lme4? Thank

Re: [R] (performance) time in Windows vs Linux

2009-06-26 Thread milton ruser
Hi there, I have both systems on a DELL 64bit machine. I compiled R 2.9.0 on both systems, to get 64bits capability. Surpriselly, on Linux (Ubuntu with I installed 3 month ago) I spent 41s to run the same test you did, and less time (35s) under Vista. In fact I had noticed that I not have gained

Re: [R] (performance) time in Windows vs Linux

2009-06-26 Thread Uwe Ligges
Yes, under 64-bit it is sometimes slower and it highly depends on the problem and the compiler you have. Note also that nobody managed to get a 64-bit Windows R binary compiled with gcc so far. Remember, 10 years ago there was the SUN Ultra Sparc III and above architecture, and gcc was known to

[R] How to read a specific dataset, not the entire data, from HDF5?

2009-06-26 Thread Daehyok Shin
Hi. Recently I am working for a project to generate massive numeric data. After storing them in HDF5 using PyTables, we are trying to use R for data analysis and visualisation. Surprising to me, however, I could not find a R package to allow the reading of a specific dataset (or its slide) in a

[R] changing default arguments of a function and return the modified function as a result

2009-06-26 Thread Miguel Bernal
Dear R-users, I am trying to develop a function that takes another function as an argument, changes its default values and returns a list of things, among which the initial function with its default arguments changed. An example of what i will like to obtain below: ## initial function myfun

Re: [R] changing the loss function in the logistic regression?

2009-06-26 Thread Michael
Hi Frank, Thanks for your help! I want to incorporate lift score as the optimization objective. How to do that in logistic regression? Thanks! On Fri, Jun 26, 2009 at 7:47 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: Michael wrote: Hi all, Is there a way to change the loss

[R] Where can I find information on how to subsample a time series?

2009-06-26 Thread Ted Byers
I suspect I'm looking in the wrong places, so guidance to the relevant documentation would be as welcome as a little code snippet. I have time series data stored in a MySQL database. There is the usual DATE field, along with a double precision number: there are daily values (including only

Re: [R] Heteroskedasticity and Autocorrelation in SemiPar package

2009-06-26 Thread Liviu Andronic
On Fri, Jun 26, 2009 at 10:11 PM, Susan Chensuen...@yahoo.com wrote: Does anyone know how to report heteroskedasticity and autocorrelation-consistent standard errors when using the spm command in SemiPar package? Suppose the original command is sp1-spm(y~x1+x2+f(x3), random=~1,group=id)

Re: [R] changing the loss function in the logistic regression?

2009-06-26 Thread Frank E Harrell Jr
Michael wrote: Hi Frank, Thanks for your help! I want to incorporate lift score as the optimization objective. How to do that in logistic regression? Thanks! Please re-read my note. Models should be fitted using proper scoring rules. Otherwise the resulting fit is bogus. Thanks Frank

[R] correspondence analysis question

2009-06-26 Thread Data Analytics Corp.
Hi, I have a matrix of 31 rows and 8 columns. The rows represent attributes of a product and the columns represent segments in a market. The cell values are utilities scaled so that the sum of the utilities across attributes for a segment equals 100. I want to find which attributes are

Re: [R] How to avoid ifelse statement converting factor to character

2009-06-26 Thread Peter Dalgaard
Craig P. Pyrame wrote: Stavros Macrakis wrote: It gives me a headache, too! I think you'll have to wait for a more expert user than me to supply explanations of these behaviors and their rationales. Thanks, Stavros. I hope someone with expertise will shed more light on this, and in the

Re: [R] changing default arguments of a function and return the modified function as a result

2009-06-26 Thread David Winsemius
On Jun 26, 2009, at 12:52 PM, Miguel Bernal wrote: Dear R-users, I am trying to develop a function that takes another function as an argument, changes its default values and returns a list of things, among which the initial function with its default arguments changed. An example of what

Re: [R] Alternate error structures in lme4?

2009-06-26 Thread Ben Bolker
bamsel wrote: Hi R users, The nlme library enabled several alternate error structures useful for longitudinal or repeated-measures data. For example, a continuous AR(1) process: model_2 = update(model_1, correlation = corCAR1(form = ~ time | subject)) Does anybody know if this is

Re: [R] ANOVA with means and SDs as input

2009-06-26 Thread Emmanuel Charpentier
Le jeudi 25 juin 2009 à 12:15 +0200, Sebastian Stegmann a écrit : Dear R-community, I'm struggling with a paper that reports only fragmented results of a 2by2by3 experimental design. However, Means and SDs for all cells are given. Does anyone know a package/function that helps computing an

Re: [R] changing default arguments of a function and return the modified function as a result

2009-06-26 Thread baptiste auguie
Is this what you want? myfun - function(x, a=19, b=21){ return(a * x + b) } mysecond.fun - function(a, b, cc=myfun, cc.args=list(a=2,b=15) ){ list(a=a, b=b, cc = function(x) cc(x, cc.args$a, cc.args$b)) } mysecond.fun(a=1,b=2)$cc(x=12) It may be that you're after a Curry (*) function, as in,

Re: [R] Where can I find information on how to subsample a time series?

2009-06-26 Thread Whit Armstrong
assuming you pull the data you want into x and y: w...@ubuntu:~$ R library(fts) x - fts() y - fts() xy.cor.200 - moving.cor(x,y,200) tail(xy.cor.200) [,1] 2012-03-12 -0.3009635 2012-03-13 -0.2923489 2012-03-14 -0.2824015 2012-03-15 -0.2662689 2012-03-16 -0.2566354 2012-03-17

Re: [R] How to avoid ifelse statement converting factor to character

2009-06-26 Thread Craig P. Pyrame
Dear Peter, Thank you for the explanations. Some further questions are inlined below. Best regards, Craig Peter Dalgaard wrote: Craig P. Pyrame wrote: Stavros Macrakis wrote: It gives me a headache, too! I think you'll have to wait for a more expert user than me to supply explanations of

[R] Constrained corr matrix closest to a given corr matrix

2009-06-26 Thread Serguei Kaniovski
Dear All! Is there any code to find a constrained correlation matrix closest in some sense (preferably in the sense of the geometric approximation) to a given correlation matrix? By constrained I mean with some elements constrained, or, simply, set to zero. I have read in a paper that says

Re: [R] changing default arguments of a function and return the modified function as a result

2009-06-26 Thread Miguel Bernal
That was indeed what i was looking for (thanks also for the currying cite). I also wanted flexibility on the number of arguments you can pass to the function, which can be achieved by: myfun - function(x, a=19, b=21){ return(a * x + b) } mysecond.fun - function(dumb1, dumb2, cc=myfun,

  1   2   >