Re: [R] write.xls dont find the object in function

2011-12-23 Thread Ronaldo Reis Júnior
Em 20-12-2011 14:09, MacQueen, Don escreveu: Or: require(xlsx) test- function(x){ +a- data.frame(A=c(1,2),B=c(10,11)) +write.xlsx(a,file=a.xlsx) + } test() list.files(patt='xlsx') [1] a.xlsx Thanks, with the write.xlsx all work. Inte Ronaldo -- 3ª lei - Na investigação

[R] simple ggplot2 question

2011-12-23 Thread Albert-Jan Roskam
Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n' through 'z' are shown, while in the lower part, only

Re: [R] GIS operations

2011-12-23 Thread Antonio Rodriges
Hello, Maybe this will help: There is rgeos package with gContains, gCovers, etc. It is a full implementation of Java Topology Suite http://cran.r-project.org/web/packages/rgeos/rgeos.pdf -- Kind regards, Antonio Rodriges __ R-help@r-project.org

Re: [R] R Source Code Request Office For National Statistics UK

2011-12-23 Thread Barry Rowlingson
On Wed, Dec 21, 2011 at 1:06 PM, David Samuel david.sam...@ons.gsi.gov.uk wrote: To R Support Team, Could you please let me know if ONS would be allowed to view your software's source code? If proof was ever needed that people don't read software license agreements, this is it. Is there a

Re: [R] Help transforming a dist

2011-12-23 Thread Taral
Perfect! combn was the trick I needed. Although I'll probably rbind the stuff instead of building a new frame. :) On Thu, Dec 22, 2011 at 6:48 PM, Sarah Goslee sarah.gos...@gmail.com wrote: I'm not at all sure what you mean with your matrix: is that supposed to be three columns? What about:

Re: [R] GIS operations

2011-12-23 Thread Paul Hiemstra
On 12/20/2011 12:54 PM, Antonio Rodriges wrote: Hello, Is there a way to find points in SpatialPoints which lie inside a given Polygon? Hi, Take a look at the over function from the sp-package. Paul -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological

Re: [R] Axis manipulation in Stackpoly (Plotrix)

2011-12-23 Thread Jim Lemon
On 12/23/2011 07:52 AM, Ben Neal wrote: Have made a stacked area plot, but now want to manipulate the x axis: make in even increments (50) in order to suppress the tick marks (forming solid bar under plot). However, the plot functions do not seem to work, and I cannot find documentation for

Re: [R] simple ggplot2 question

2011-12-23 Thread Paul Hiemstra
On 12/23/2011 08:26 AM, Albert-Jan Roskam wrote: Hello, I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n'

Re: [R] Axis manipulation in Stackpoly (Plotrix)

2011-12-23 Thread Jim Lemon
On 12/23/2011 09:53 PM, Jim Lemon wrote: CaribMatrix-matrix(order(sample(200:500,579,TRUE),nrow=579,ncol=3) Oops, that should be CaribMatrix-matrix(sort(sample(200:500,579,TRUE),nrow=579,ncol=3) Jim __ R-help@r-project.org mailing list

[R] missing value where TRUE/FALSE needed

2011-12-23 Thread Michael Pearmain
Merry Xmas to all, I am writing a function and curiously this runs sometimes on one data set and fails on another and i cannot figure out why. Any help much appreciated. If i run the code below with data - iris[ ,1:4] The code runs fine, but if i run on a large dataset i get the following error

[R] Problem understanding behaviour of mmap package

2011-12-23 Thread Wolfgang Wu
I am trying to solve the following problem using the mmap package:   1.) Store some data as a memory mapped file that resides on the disk.  2.) Open the data and add some new data (or change it) to that file. 1.) works fine using the following code: cFile -tempfile() dfrData -

Re: [R] lasso based selection for mixed model

2011-12-23 Thread schell
Dear Dieter There has been some effort examining Lasso-type estimators for mixed models. It is more involved than with other type of models. We have studied Gaussian and generalized linear mixed models including a Lasso-type penalty for the fixed effects and we are now able to provide two

[R] ggplot2: behaviour with empty datasets

2011-12-23 Thread Casper Ti. Vector
For example, prepare like this df.0 - data.frame(x = 0, y = 0, note = 1) df.1 - subset(df.0, note == 1) df.2 - subset(df.0, note == 2) Then a call to ggplot() + aes(x = x, y = y) + geom_point(data = df.1) + geom_point(data = df.2) produces the error Error in eval(expr, envir, enclos) :

Re: [R] missing value where TRUE/FALSE needed

2011-12-23 Thread jim holtman
Does this look similar to the error you are getting: while(NA == TRUE) 1 Error in while (NA == TRUE) 1 : missing value where TRUE/FALSE needed SO 'notconverged' is probably equal to NA. BTW, what is the value of 'tol'; I do not see it defined. So when computing 'notconverged' you have

Re: [R] Help transforming a dist

2011-12-23 Thread Sarah Goslee
On Fri, Dec 23, 2011 at 1:06 AM, Taral tar...@gmail.com wrote: Perfect! combn was the trick I needed. Although I'll probably rbind the stuff instead of building a new frame. :) You should try rbind() with the small example I gave before you use it on your data. You'll immediately see why I

Re: [R] ggplot2: behaviour with empty datasets

2011-12-23 Thread Hadley Wickham
See https://github.com/hadley/ggplot2/issues/31 - I totally agree that it's annoying. Hadley PS. You are more likely to get helpful responses about ggplot2 on the ggplot mailing list. On Fri, Dec 23, 2011 at 7:08 AM, Casper Ti. Vector caspervec...@gmail.com wrote: For example, prepare like

[R] error from character NAs in indexing array

2011-12-23 Thread David Winsemius
The help page for ?Extract says: When extracting, a numerical, logical or character NA index picks an unknown element and so returns NA in the corresponding element of a logical, integer, numeric, complex or character result, and NULL for a list. (It returns 00 for a raw result.]

Re: [R] Problem with RCOM package

2011-12-23 Thread Uwe Ligges
On 23.12.2011 11:02, KUMAR wrote: Hi, I am using R version 2.14.0 on windows 7. Trying to use RCOM package and followed example provided at (http://cran.r-project.org/web/packages/rcom/rcom.pdf) . Please ask on the mailing list that was set up for that package. I wonder: Do

Re: [R] ggplot2: behaviour with empty datasets

2011-12-23 Thread Casper Ti. Vector
Thanks, I'll post to that list if the encountered problem is just about ggplot2. And from the date of the issue on GitHub it seems that I might need to manually work around the problem some more times :) On Fri, Dec 23, 2011 at 08:10:05AM -0600, Hadley Wickham wrote: See

Re: [R] nlrob problem

2011-12-23 Thread Martin Maechler
Pascal A Niklaus pascal.nikl...@ieu.uzh.ch on Mon, 19 Dec 2011 20:46:57 +0100 writes: Dear all, I am not sure if this mail is for R-help or should be sent to R-devel instead, and therefore post to both. While using nlrob from package 'robustbase', I ran into the

[R] data vector to corresonding percentile ranks

2011-12-23 Thread Steve Jones
I have a problem where I need to calculate the corresponding cohort percentile ranks for each of several variables. Essentially, what I need is a function that will calculate the distribution-free percentiles from each variable's data vector, returning a corresponding vector of percentiles:

[R] Long jobs completing without output

2011-12-23 Thread Brendan Halpin
I've been running a glmer logit on a very large data set (600k obs). Running on a 10% subset works correctly, but for the complete data set, R completes apparently without error, but does not display the results. Given these jobs take about 200 hours, it's very hard to make progress by trial and

Re: [R] Help with code

2011-12-23 Thread 1Rnwb
this is how the ouput from the code should be structure(list(HTN = 1:10, HTN_FDR = structure(c(4L, 2L, 1L, 2L, 3L, 1L, 1L, 2L, 3L, 2L), .Label = c(Ctrl_noc, T1D_noc, T1D_oc, T1d_w), class = factor), Dyslipidemia = structure(c(3L, 2L, 1L, 2L, 4L, 1L, 1L, 2L, 4L, 2L), .Label = c(Ctrl_noc,

Re: [R] missing value where TRUE/FALSE needed

2011-12-23 Thread Michael Pearmain
Apologies, I was using top = 0.0001 I had looked at browser and did show notconverged = NA. But I couldn't understand why it worked for one and not the other? On Friday, 23 December 2011, jim holtman jholt...@gmail.com wrote: Does this look similar to the error you are getting: while(NA ==

[R] Applying a function

2011-12-23 Thread Joanie Van De Walle
Hi, I need help writing a function I capture seal pups mutliple times during the lactation season in order to monitor their growth rate. When I release them, the recovery (mother-pup) time is not the same for all individuals. I want to know if individuals that recover their

Re: [R] nlrob problem

2011-12-23 Thread Pascal.Niklaus
Please ignore my previous posting, in the meanwhile I have realised that I did not look carefully enough how nlrob works (irls), although this is pretty obvious from the code. The only issue that remains is the case of zero weight for redescending M estimators, in which case NaN's are produced. I

Re: [R] missing value where TRUE/FALSE needed

2011-12-23 Thread jim holtman
Given that the maximum floating point value is: $double.xmax [1] 1.797693e+308 and the number you are trying to calculate is 5E323 you are exceeding the size of numbers you can process. Have a happy holiday and glad I could help. On Fri, Dec 23, 2011 at 11:24 AM, Michael Pearmain

Re: [R] data vector to corresonding percentile ranks

2011-12-23 Thread Sarah Goslee
I'm not sure I understand the question, but does quantile() do what you want? On Fri, Dec 23, 2011 at 10:28 AM, Steve Jones sjone...@jhmi.edu wrote: I have a problem where I need to calculate the corresponding cohort percentile ranks for each of several variables. Essentially, what I need is

Re: [R] Help with code

2011-12-23 Thread Sarah Goslee
On Fri, Dec 23, 2011 at 9:25 AM, 1Rnwb sbpuro...@gmail.com wrote: this is how the ouput from the code should be What code might that be? Readers of the R-help email list have no idea whatsoever what you're asking. Please include context, as requested in the posting guide. Sarah

Re: [R] data vector to corresonding percentile ranks

2011-12-23 Thread David Winsemius
On Dec 23, 2011, at 10:28 AM, Steve Jones wrote: I have a problem where I need to calculate the corresponding cohort percentile ranks for each of several variables. Essentially, what I need is a function that will calculate the distribution-free percentiles from each variable's data vector,

Re: [R] data vector to corresonding percentile ranks

2011-12-23 Thread Sarah Goslee
It's far more useful to send your explanation to the list than it is to send it just to me. I've taken the liberty of doing so. But this does sound like a job for ecdf() - what did you do, and what went wrong? On Fri, Dec 23, 2011 at 12:23 PM, Steven Jones sjone...@jhmi.edu wrote: Actually,

Re: [R] black and white in qplot? layout 4 graphs in one screen

2011-12-23 Thread Hadley Wickham
You might find the ggplot mailing list a friendlier place to ask questions about ggplot2. Hadley On Wed, Dec 21, 2011 at 2:16 PM, rachaelohde cox.rach...@gmail.com wrote: Hello, I am trying to plot means and standard errors conditioned by a factor, using qplot.  I am successful at getting the

Re: [R] Stacked area plot for time series

2011-12-23 Thread Hadley Wickham
You are more likely to get a helpful response if you provide a reproducible example - without that I can only guess that you need to use approx so you get y values at same x values. Hadley On Wed, Dec 21, 2011 at 8:13 AM, UncleFish bpn...@ucsd.edu wrote: I wish to make a stacked area chart of a

Re: [R] vif function using lm object

2011-12-23 Thread Liviu Andronic
On Wed, Dec 21, 2011 at 9:28 AM, arunkumar akpbond...@gmail.com wrote: Hi,   can anyone please explain why the vif should have more than 2 terms. *vif.lm(lmobj) : model contains fewer than 2 terms* why it is throwng error if it is one variable. The _VIF_ is a measure of

Re: [R] data vector to corresonding percentile ranks

2011-12-23 Thread R. Michael Weylandt
This seems like what you are interested in: x - rnorm(50) ecdf(x)(x) Michael On Fri, Dec 23, 2011 at 11:26 AM, Sarah Goslee sarah.gos...@gmail.com wrote: It's far more useful to send your explanation to the list than it is to send it just to me. I've taken the liberty of doing so. But

Re: [R] Problem with RCOM package

2011-12-23 Thread Erich Neuwirth
All questions related to rcom, statconnDCOM, and RExcel should be posted on the mailing list of the statconnDCOM project. You can subscribe at http://rcom.univie.ac.at On 12/23/2011 11:02 AM, KUMAR wrote: Hi, I am using R version 2.14.0 on windows 7. Trying to use RCOM

[R] cast in reshape and reshape2

2011-12-23 Thread Kaiyin Zhong
library(reshape2) x = melt(airquality, id=c('month', 'day')) With reshape I can cast with multiple functions: library(reshape) cast(x, month+variable~., c(mean,sd)) month variable mean sd 1 5ozone 23.615385 22.224449 2 5 solar.r 181.296296 115.075499 3

Re: [R] Applying a function

2011-12-23 Thread Steinar Veka
First, it may be a good idea to use 1 for “yes” and 0 for “no” in the motherrecovery column. Then if you name your table e.g tab1, you may try something like this.. sum(tab1[,2]==1*tab1[,4])/sum(tab1[,2]==1) 2011/12/23 Joanie Van De Walle joanie.van-de-wall...@ulaval.ca Hi, I

[R] Custom XML Readers

2011-12-23 Thread pl.r...@gmail.com
I need to construct a custom XML reader, the files I'm working with are in funky XML format: str name=authorPaul H/str str name=countryUSA/str date name=created_date2010-02-16/date I want to read the file so it looks like: author = Paul H country = USA created_date=2010-02-16 Does any one

Re: [R] Stacked area plot for time series

2011-12-23 Thread Ben Neal
Yes, thanks for the direction. I am new to the list and new to R, and I can see that was not a very helpful description. I have since resolved my issue. My main issue was that stackpoly does not (I think) interact with XOO objects or ts object, and my secondary issue was that my time series

Re: [R] Cuzick's test for trend

2011-12-23 Thread andrewejaffe
I just wrote this up for a project, perhaps 5 years is better than never... code cuzick = function(x,z,test.type=c(two.sided, upper, lower)) { N = length(z) n = unique(z) ranks=rank(x) T = sum(ranks*z) p = (table(z)/N) E_Z = sum(unique(z)*p)

Re: [R] Stacked area plot for time series

2011-12-23 Thread Ben Neal
Meant to say ZOO objects . . . -Original Message- From: Ben Neal [mailto:bn...@spg.ucsd.edu] Sent: Fri 12/23/2011 10:15 AM To: Hadley Wickham; UncleFish Cc: r-help@r-project.org Subject: RE: [R] Stacked area plot for time series Yes, thanks for the direction. I am new to the list and

Re: [R] Axis manipulation in Stackpoly (Plotrix)

2011-12-23 Thread Ben Neal
Thank you. That helps me understand the issue better. I came up with a similar solution . . . but yours is more elegant (I just wrote out the labels . . ). My solution follows: stackpoly(CaribMatrix, stack=TRUE, xlab=Year,ylab=Catch in tons, col.main=red, font.main=4,

Re: [R] black and white in qplot? layout 4 graphs in one screen

2011-12-23 Thread baptiste auguie
Hi, On 22 December 2011 09:16, rachaelohde cox.rach...@gmail.com wrote: Hello, I am trying to plot means and standard errors conditioned by a factor, using qplot.  I am successful at getting the bar graph I want with a error bar, however I have tried many things and cannot get the bars to

Re: [R] cast in reshape and reshape2

2011-12-23 Thread David Winsemius
On Dec 23, 2011, at 2:58 PM, Kaiyin Zhong wrote: library(reshape2) x = melt(airquality, id=c('month', 'day')) With reshape I can cast with multiple functions: library(reshape) cast(x, month+variable~., c(mean,sd)) month variable mean sd 1 5ozone 23.615385

Re: [R] cast in reshape and reshape2

2011-12-23 Thread David Winsemius
On Dec 23, 2011, at 5:58 PM, David Winsemius wrote: On Dec 23, 2011, at 2:58 PM, Kaiyin Zhong wrote: library(reshape2) x = melt(airquality, id=c('month', 'day')) With reshape I can cast with multiple functions: library(reshape) cast(x, month+variable~., c(mean,sd)) month variable

[R] Latent class multinomial (or conditional) logit using R?

2011-12-23 Thread adanmartinez
Hi everyone? Does anybody know how can I estimate a Latent class multinomial (or conditional) logit using R? I have tried flexmix, poLCA, and they do not seem to support this model. thanks in advance adan -- View this message in context:

Re: [R] Latent class multinomial (or conditional) logit using R?

2011-12-23 Thread Christian Hennig
You may have a look at lcmixed/flexmixedruns in package fpc. This provides flexmix methods that can be used to fit latent class models with locally independent multinomials (no logits, though, and I'm not sure that for categorical data only this is much different from what poLCA offers). Best

Re: [R] Help with code

2011-12-23 Thread Rui Barradas
Hello, There are so many people posting answers that I'm curious and decided to try one. I don't know if this is it but it doesn't give an error and it reformats your data according to the rules in your original code. # nr - dim(c1)[1] nc - dim(c1)[2] c2 - NULL c2_row - rep(, nc-1) for(i in

Re: [R] Applying a function

2011-12-23 Thread Rui Barradas
Joanie Van De Walle wrote Hi, I need help writing a function I capture seal pups mutliple times during the lactation season in order to monitor their growth rate. When I release them, the recovery (mother-pup) time is not the same for all individuals. I want to know if

[R] if statement problem

2011-12-23 Thread reena
Hello, I want to do fisher test for the rows in data file which has value less than 5 otherwise chi square test .The p values from both test should be stored in one resulted file. but there is some problem with bold if statement. I don't know how implement this line properly. x =

Re: [R] Trouble converting hourly data into daily data

2011-12-23 Thread Sean Baumgarten
Hi Jean, Thanks for the help. I couldn't quite get the results I needed with the merge command, but I ended up using the following work-around: Weather - read.csv(Weather.csv) Weather$diff.time - abs(.5 - Weather$TimeNumeric) agg - aggregate(diff.time ~ Date, data = Weather, FUN = which.min)

Re: [R] Applying a function

2011-12-23 Thread Rui Barradas
Sorry, in the function body, NO 'tab1', use 'x' only: recovery.rate - function(x) unlist(lapply(split(x, x[,2]), function(x) mean(x[[4]]==y))) The error is because 'tab1' existed in the environment and the function would find it. This time, tested after removing 'tab1'. Rui Barradas -- View

Re: [R] if statement problem

2011-12-23 Thread Rui Barradas
reena wrote Hello, I want to do fisher test for the rows in data file which has value less than 5 otherwise chi square test .The p values from both test should be stored in one resulted file. but there is some problem with bold if statement. I don't know how implement this line

Re: [R] Latent class multinomial (or conditional) logit using R?

2011-12-23 Thread adanmartinez
Hi Christian, Thanks a lot for the suggestion. As you expected, lcmixed does not provide more functionality than poLCA for the case of only categorical data... Do you know whether there is an explanation (some technical difficulty I may be missing, I am Economist so it is very likely) of why I

Re: [R] Custom XML Readers

2011-12-23 Thread Ben Tupper
Hi Andy, On Dec 23, 2011, at 2:51 PM, pl.r...@gmail.com wrote: I need to construct a custom XML reader, the files I'm working with are in funky XML format: str name=authorPaul H/str str name=countryUSA/str date name=created_date2010-02-16/date I want to read the file so it looks

Re: [R] cast in reshape and reshape2

2011-12-23 Thread Hadley Wickham
On Fri, Dec 23, 2011 at 1:58 PM, Kaiyin Zhong kindlych...@gmail.com wrote: library(reshape2) x = melt(airquality, id=c('month', 'day')) With reshape I can cast with multiple functions: library(reshape) cast(x, month+variable~., c(mean,sd))   month variable       mean         sd 1      5  

Re: [R] cast in reshape and reshape2

2011-12-23 Thread Hadley Wickham
Have you looked at the .summarise argument to dcast? That seems to deliver the same sort of results one gets with base::aggregate. Actually I see after looking at examples on the plyr-reshape-googlegroups group that it is not '.summarise' but rather 'summarise'. Unfortunately there are no

Re: [R] Help creating a symmetric matrix?

2011-12-23 Thread Rui Barradas
Matt Considine wrote Hi, I am trying to work with the output of the MINE analysis routine found at http://www.exploredata.net Specifically, I am trying to read the results into a matrix (ideally an n x n x 6 matrix, but I'll settle right now for getting one column into a matrix.)

Re: [R] cast in reshape and reshape2

2011-12-23 Thread David Winsemius
On Dec 23, 2011, at 9:23 PM, Hadley Wickham wrote: Have you looked at the .summarise argument to dcast? That seems to deliver the same sort of results one gets with base::aggregate. Actually I see after looking at examples on the plyr-reshape- googlegroups group that it is not

[R] Optimising timeboxing in xts

2011-12-23 Thread Hasan Diwan
I don't know if timeboxing is the correct term to use to accomplish what I'm attempting, so allow me to explain. I have a set n of tagged observations in time series t. What I'm interested in is taking i seconds before and after every n. My code is below: # observations.xts is an xts time series