Re: [R] gsub() with unicode and escape character

2011-07-17 Thread Prof Brian Ripley
You forgot the 'at a minimum' information required by the posting guide. Most likely this is a limitation of the locale you used (and failed to tell us about) on the OS you used (...). On Sat, 16 Jul 2011, Sverre Stausland wrote: Dear helpers, I'm trying to replace a character with a

[R] Add axis name to x-axis ggplot

2011-07-17 Thread hrishi
Hello, I have plotted a ggplot, the image is attached below. Now I have two questions: 1. How to order the pvalue displayed in the plot. I want the pvalue in the order : 0 to 1E-12, 1E-12 to 1E-6, 1E-6 to 1E-3, 1E-3 to 0.05 and finally 0.05 2. Add name to the X-axis. I wanted to add a label to

[R] create multiple variables loop

2011-07-17 Thread jour4life
Hello all, I am trying to figure out how to construct several new variables without having to write a code for each one. Specifically, I want to calculate ratios for several variables. For instance, let's say I have: df male1990 male1995 male2000 male2005 female1990 female1995 female2000

Re: [R] Utility function to apply a scale object on another data frame

2011-07-17 Thread E- Cognium
Thanks, Joshua. This is exactly what I was looking for. On Sat, Jul 16, 2011 at 11:17 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi e, Here is a simple function to use the attributes from one scaled object to scale another. x = data.frame(a=1:10,b=11:20) y =

Re: [R] Add axis name to x-axis ggplot

2011-07-17 Thread Joshua Wiley
Hi, On Sat, Jul 16, 2011 at 10:19 PM, hrishi hrishi...@gmail.com wrote: Hello, I have plotted a ggplot, the image is attached below. Now I have two questions: 1. How to order the pvalue displayed in the plot. I want the pvalue in the order : 0 to 1E-12, 1E-12 to 1E-6, 1E-6 to 1E-3, 1E-3

Re: [R] create multiple variables loop

2011-07-17 Thread Joshua Wiley
Hi Carlos, Assuming your actual dataset has as nice a structure as your example one, it is extremely easy: ## Your data (in convenient form using dput(df)) df - structure(list(male1990 = c(10L, 23L, 32L), male1995 = c(11L, 22L, 33L), male2000 = c(15L, 25L, 37L), male2005 = c(17L, 28L, 36L),

Re: [R] ecdf() to nls() - how to transform data?

2011-07-17 Thread Jochen1980
Thanks David and Peter! I tried to improve my R-script to get closer to my goal. I guess I have to use nls(), because later I want to work with Levenberg-Marquardt-Algorithm and when I got it right, LM-Algorithm uses least squares as well, fitdistr() instead uses Maximum Likelihoods. Anyway, I

Re: [R] Save generic plot to file (before rendering to device)

2011-07-17 Thread Jeroen Ooms
Thanks I didn't know about that. I ended up with something like this. Is there a more elegant way to do it? myplots - list(); hasplots - FALSE; setHook(before.plot.new, function(...) {     if(hasplots == FALSE){       hasplots - TRUE;     } else {       myplots[[length(myplots)+1]] -

[R] special question on regression

2011-07-17 Thread Johannes Radinger
Hello R-people! I have a general statistical question about regressions. I just want to describe my case: I have got a dataset of around 150 observations and 1 dependent and 2 independent variables. The dependent variable is of metric nature (in my case meters in a range from around

Re: [R] FOMULATING TIME SERIES DATA FROM DATA FRAME

2011-07-17 Thread Joshua Ulrich
On Sat, Jul 16, 2011 at 9:35 PM, Peter Maclean pmaclean2...@yahoo.com wrote: I am estimating Value at Risk using PerfomanceAnalytics package. The variables are stored in a data frame. I formated the data variables using zoo() and as.xtx() but it is not working. The working example is below.

Re: [R] Save generic plot to file (before rendering to device)

2011-07-17 Thread peter dalgaard
On Jul 11, 2011, at 22:08 , Greg Snow wrote: Note the warning on the help page for recordPlot. If your colleague is using a different version of R than you there could be problems. Also notice that the process isn't perfect, as people occasionally discover when they use dev.copy() and its

[R] Plot fn, xlim when x is a date. XXXX

2011-07-17 Thread Dan Abner
Hello everyone, I have the following x variable: DATE-as.Date(as.character(data12$DATE),%m/%d/%Y) This works fine, however, I want to plot multiple years of data on separate plots by month. All years have all 12 months data except 2011; HOWEVER I need the x axis limits to remain the same. I

Re: [R] How to convert number (matlab) to date

2011-07-17 Thread Dennis Murphy
Hi: The default time origin in R is '1970-01-01'. as.Date('1999-12-02') - as.Date('1970-01-01') Time difference of 10927 days Therefore, the difference in days between Matlab's and R's origins is 10927 - 730456 [1] -719529 as.Date(-719529, origin = '1970-01-01') [1] 000/-12-31 If we try this

Re: [R] gsub() with unicode and escape character

2011-07-17 Thread Nipesh Bajaj
I really sorry if I understood your statement correctly :( You said: To put a backslash in the replacement expression of sub or gsub (when fixed=FALSE) use 4 backslashes I understood it is okay if I want to replace something with 2 backslashes. what if I want to replace that with just 1

Re: [R] Plot fn, xlim when x is a date. XXXX

2011-07-17 Thread Duncan Murdoch
On 11-07-17 8:22 AM, Dan Abner wrote: Hello everyone, I have the following x variable: DATE-as.Date(as.character(data12$DATE),%m/%d/%Y) This works fine, however, I want to plot multiple years of data on separate plots by month. All years have all 12 months data except 2011; HOWEVER I need the

Re: [R] gsub() with unicode and escape character

2011-07-17 Thread Uwe Ligges
On 17.07.2011 15:18, Nipesh Bajaj wrote: I really sorry if I understood your statement correctly :( You said: To put a backslash in the replacement expression of sub or gsub (when fixed=FALSE) use 4 backslashes I understood it is okay if I want to replace something with 2 backslashes. what

Re: [R] Amelia_Multiple_Imputation_with_observational_priors_noms

2011-07-17 Thread Uwe Ligges
I'd write to the Amelia maintainer. Maybe it is a bug in the package, or just an inappropriate error message (where the error should have been caught earlier). Uwe Ligges On 14.07.2011 20:09, Eric Miner wrote: I am fairly new at using R/programming in general so I apologize if I am leaving

Re: [R] apsrtable package notes no longer working?

2011-07-17 Thread Uwe Ligges
On 13.07.2011 23:00, Joshua Gubler wrote: Hi all, I have used the apsrtable package to generate tables (using LaTeX and Sweave) for quite some. However, suddenly the notes option in the package appears to have stopped working (or I am doing something wrong). So, when I try to run the

Re: [R] special question on regression

2011-07-17 Thread Bert Gunter
Johannes: R is not a statistical tutorial service, although kind and able helpeRs sometimes do reply to such queries. You should try such a service, for example: http://stackoverflow.com/ FWIW, this is an example of censoring in regression. R has packages for this, but you need to learn more or

Re: [R] Error Message Help: Differing Number of Rows

2011-07-17 Thread Uwe Ligges
On 15.07.2011 19:01, ScottM wrote: Hello all, I'm relatively new to R and programming in general - I had previously used MatLab, but decided to make the transition to R, as the computational times are much better! Anyway, I'm trying to use R to run a gamma distribution model to estimate mean

Re: [R] special question on regression

2011-07-17 Thread saskay
You could treat the dependent variable as a nominal variable. And scale the indepent variables to have a Mean:0 and StDev:1. Stick all these in a multinomial regression package such as mlogit. Or a non -parametric method such as randomForest. -- View this message in context:

Re: [R] plotmeans

2011-07-17 Thread h_bumann
The par(new = TRUE)-Trick seems to be fine, if you just want to add one or two other lines. Whenever I plot a couple of graphs ontop of each other i find that the nice vectorgraphics become cluttered. Is there any way to use plotmeans() and to restrict it to the line only? Sincerly Henning --

Re: [R] Out of Sample Prediction Interval/Point Estimate

2011-07-17 Thread Uwe Ligges
On 15.07.2011 13:50, Zd Gibbs wrote: Hi All, I have been requested to come up with an out-of-sample prediction einterval and point estimate. I have never done this and I am hoping for help from you all. First can R do this? If so, what are the steps? What do I need? Sounds like you should

Re: [R] special question on regression

2011-07-17 Thread Uwe Ligges
- Please also reply to the original poster who may not be subscribed to the list. - Please cite the original question (and other relevant parts of the thread) since some readers of this list will delete messages before an answer arrives. Uwe Ligges On 17.07.2011 15:22, saskay wrote: You

Re: [R] plotmeans

2011-07-17 Thread Uwe Ligges
On 17.07.2011 14:36, h_bumann wrote: The par(new = TRUE)-Trick seems to be fine, if you just want to add one or two other lines. Whenever I plot a couple of graphs ontop of each other i find that the nice vectorgraphics become cluttered. Is there any way to use plotmeans() and to restrict it

Re: [R] Error: non-numeric argument to binary operator

2011-07-17 Thread Uwe Ligges
On 14.07.2011 23:03, Anil acharya wrote: Hi I am posting in the topic related to the non-numeric argument to binary operator as I got similar problem while running the netcdf code. I have attached the file with this post. It is a climate data from NOAA site. The code follows as:

Re: [R] Simple clustering help

2011-07-17 Thread Uwe Ligges
On 14.07.2011 19:59, donvolencia wrote: Hi all, I have just begun to use R and am hoping to receive some advice about the problem I need to solve. I have a file containing xy points that I need to find all significant clusters and write each of their xy coordinates to file(total points ~

Re: [R] plotting x y z data from an irregular grid

2011-07-17 Thread Uwe Ligges
Perhaps you want to ask on the SIG mailing list for spatial statistics. I guess there is something available that makes use of cloud() [from lattice], plot3d [from rgl] or scatterplot3d() [identically names package] or others to satisfy your needs of plotting points atop of a map, for example.

Re: [R] ecdf() to nls() - how to transform data?

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 4:12 AM, Jochen1980 wrote: Thanks David and Peter! I tried to improve my R-script to get closer to my goal. I guess I have to use nls(), because later I want to work with Levenberg-Marquardt-Algorithm and when I got it right, LM-Algorithm uses least squares as well,

[R] histograms - function hist() - problems in R 2.13.1

2011-07-17 Thread Paulo Barata
Dear R-list members, I would like to report some problems, in R 2.13.1, with the function hist(), which constructs histograms. Sample code: x - rnorm(1000) hist(x, breaks=16) In R 2.13.1, in the histogram so produced, the bottom of the bars are not exactly aligned in a perfect horizontal,

[R] How to speed up interpolation

2011-07-17 Thread James Rome
df is a very large data frame with arrival estimates for many flights (DF$flightfact) at random times (df$PredTime). The error of the estimate is df$dt. My problem is that I want to know the prediction error at each minute before landing. This code works, but is very slow, and dominates

[R] Quantitative Microbial Risk Assesment??

2011-07-17 Thread Steven R. Corsi
Hi, I am searching for a script or set of scripts written in R that perform Quantitative Microbial Risk Assessment (QMRA) computations for risk of infection from pathogens in recreational waters. My initial searches have come up empty. If there are other places I should look for this or email

Re: [R] gsub() with unicode and escape character

2011-07-17 Thread Sverre Stausland
Sorry for not including those details. Here is a more detailed description: data.frame(animals=c(dog,wolf,cat))-my.data gsub(o,\u0254,my.data$animals)-my.data$animals my.data$animals [1] dɔg wɔlf cat sessionInfo() R version 2.13.1 (2011-07-08) Platform: i386-pc-mingw32/i386 (32-bit)

[R] How to estimate overlapping area of two distributions?

2011-07-17 Thread Ana Kolar
Hi there dear R users, By using the code below that plots two distributions and calculates a bootstrap hypothesis test of equality, similarity of these two distributions was calculated. What I'm interested now is to find out a size of the area where both distributions are overlapping. I know

Re: [R] histograms - function hist() - problems in R 2.13.1

2011-07-17 Thread Duncan Murdoch
On 11-07-17 1:17 PM, Paulo Barata wrote: Dear R-list members, I would like to report some problems, in R 2.13.1, with the function hist(), which constructs histograms. Sample code: x- rnorm(1000) hist(x, breaks=16) In R 2.13.1, in the histogram so produced, the bottom of the bars are not

Re: [R] How to speed up interpolation

2011-07-17 Thread jim holtman
It would be nice if you had some sample data included so that we could see how the code worked. Have you use Rprof on the code to see where you are spending your time? You might want to use 'matrix' instead of 'data.frames' since there is a big performance impact with dataframes when indexing.

[R] Survival Analysis

2011-07-17 Thread Kishor Tappita
Dear List, I used survival package of R and was able to generate KM plots. Now I need help in finding the top curve in a non-visualization way. I mean to say that I would like to know the order of curves through any existing methods rather than looking at the KM plots. I need this information as

[R] histograms - function hist() - problems in R 2.13.1

2011-07-17 Thread Paulo Barata
Dear R-list members, I would like to report some problems, in R 2.13.1, with the function hist(), which constructs histograms. Sample code: x - rnorm(1000) hist(x, breaks=16) In R 2.13.1, in the histogram so produced, the bottom of the bars are not exactly aligned in a perfect horizontal,

[R] Number in interval

2011-07-17 Thread Manuel K.
Hi all, I have an interval (e.g [-3,3]) and a numeric vector z (-1.4,0.5,4.7). How can I test whether an element in z lies between between -3,3? I particularly need a TRUE/FALSE response. Thanks Manuel -- View this message in context:

[R] ?Accuracy of prop.test

2011-07-17 Thread Jack Sofsky
I have just joined this list (and just started using R), so please excuse any etiquette breaches as I do not yet have a feel for how the list operates. I am in the process of teaching myself statistics using R as my utility as my ultimate goals cannot be satisfied by Excel or any of the

[R] function design: multiple imput names

2011-07-17 Thread John Lande
dear all, a simple question, I need to write a function in which I retrive an undetermined number of vector in the function. I solved the problem thanks to this link http://stackoverflow.com/questions/2540232/how-to-allow-multiple-inputs-from-user-using-r so my function will look alike this

[R] creating a matrix of ranked column data

2011-07-17 Thread christian krahforst
I have a data frame (gom) or a matrix of trace metal data and some other observations from water column samples taken at sea (e.g., 19 samples (rows), 19 variables) I can calc. the rank individually from each column of the attached object. How can I create a matrix that contains the ranked data

Re: [R] Number in interval

2011-07-17 Thread jim holtman
try this: z - c(-1.4,0.5,4.7) (z = -3) (z = 3) [1] TRUE TRUE FALSE On Sun, Jul 17, 2011 at 10:54 AM, Manuel K. b8220...@klzlk.com wrote: Hi all, I have an interval (e.g [-3,3]) and a numeric vector z (-1.4,0.5,4.7). How can I test whether an element in z lies between between -3,3? I

Re: [R] ecdf() to nls() - how to transform data?

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 11:07 AM, David Winsemius wrote: On Jul 17, 2011, at 4:12 AM, Jochen1980 wrote: Thanks David and Peter! I tried to improve my R-script to get closer to my goal. I guess I have to use nls(), because later I want to work with Levenberg-Marquardt-Algorithm and when I got

Re: [R] Survival Analysis

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 11:27 AM, Kishor Tappita wrote: Dear List, I used survival package of R and was able to generate KM plots. Now I need help in finding the top curve in a non-visualization way. I mean to say that I would like to know the order of curves through any existing methods

Re: [R] function design: multiple imput names

2011-07-17 Thread Joshua Wiley
Hi John, Look at ?match.call you will need to make sure that expand.dots = TRUE, but I think it does what you want. The names you want might be: names(my_list) - as.character(match.call(expand.dots = TRUE))[-1L] I will point out that I am not sure you will get the desired results with your

Re: [R] Number in interval

2011-07-17 Thread Steve Lianoglou
Also check out the 'cut' and 'findIntervals' functions if you need to check for many intervals at once. On Sunday, July 17, 2011, jim holtman jholt...@gmail.com wrote: try this:  z - c(-1.4,0.5,4.7) (z = -3) (z = 3) [1]  TRUE  TRUE FALSE On Sun, Jul 17, 2011 at 10:54 AM, Manuel K.

Re: [R] Number in interval

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 5:29 PM, jim holtman wrote: try this: z - c(-1.4,0.5,4.7) (z = -3) (z = 3) [1] TRUE TRUE FALSE Another way: findInterval(z, c(-3,3)) == 1 [1] TRUE TRUE FALSE z=c(-50,-1.4,0.5,4.7) And just to prove to myself that it behaves as I expect with values below

Re: [R] creating a matrix of ranked column data

2011-07-17 Thread Peter Langfelder
On Sun, Jul 17, 2011 at 11:18 AM, christian krahforst ckrahfo...@gmail.com wrote: I have a data frame (gom) or a matrix of trace metal data and some other observations from water column samples taken at sea (e.g., 19 samples (rows), 19 variables) I can calc. the rank individually from each

Re: [R] ?Accuracy of prop.test

2011-07-17 Thread Ted Harding
On 17-Jul-11 16:27:25, Jack Sofsky wrote: I have just joined this list (and just started using R), so please excuse any etiquette breaches as I do not yet have a feel for how the list operates. I am in the process of teaching myself statistics using R as my utility as my ultimate goals

[R] ODBC MySql DB: sqlQuery empty

2011-07-17 Thread Henri Mone
Dear R Beginners, Experts and Users, I already asked this question on the R-sig-DB mailing list, but sadly didn't got a reply :-( . Keeping fingers crossed that I have more luck on the main R mailinglist :) . I'm trying to connect to a MySQl database via Gnu R using the RODBC interface. The

Re: [R] ODBC MySql DB: sqlQuery empty

2011-07-17 Thread Dennis Murphy
Did you register the database with ODBC? Dennis On Sun, Jul 17, 2011 at 3:46 PM, Henri Mone henrim...@gmail.com wrote: Dear R Beginners, Experts and Users, I already asked this question on the R-sig-DB mailing list, but sadly didn't got a reply :-( . Keeping fingers crossed that I have more

Re: [R] ODBC MySql DB: sqlQuery empty

2011-07-17 Thread Henri Mone
Hi Dennis, Yes the database is registered with ODBC. I posted a copy of my ODBC setup ~/.odbc.ini. Still looking for the problem Thanks, Henri On Mon, Jul 18, 2011 at 12:51 AM, Dennis Murphy djmu...@gmail.com wrote: Did you register the database with ODBC? Dennis On Sun, Jul 17, 2011

Re: [R] How to speed up interpolation

2011-07-17 Thread James Rome
I thought I had included the data... Here it is again. What I want to do is to make box and whisker plots with each flight counted the same number of times in each time bin. Hence the interpolation to minute time hacks. On 7/17/2011 4:16 PM, jim holtman wrote: It would be nice if you had some

Re: [R] ?Accuracy of prop.test

2011-07-17 Thread Rolf Turner
The Minitab and TI results are (modulo different levels of rounding) just what you'd get from doing the problem ``by hand'' in the good old-fashioned way. :-) The Excel result appears to be the same with an excessive level of rounding. The ``by-hand'' procedure uses the plug-in method to

[R] Multiple comparison test on selected contrasts

2011-07-17 Thread B Jessop
Dear Help-list, How can I do a multiple comparison test (mct) on selected contrasts from a linear model while using packages lme4 and multcomp? I am running R 2.13.0 under Windows 7. The following linear model and mct produces a global mct of 15 paired contrasts of the combined (Site,

Re: [R] ecdf() to nls() - how to transform data?

2011-07-17 Thread Jochen1980
Hi David, my first attempt to work through your code was successful, my predicted line is pretty close to the ecdf-function. I have no idea why you inverted the gumbel-function and what the advantage of this strategy is? I interpret your (1:100/100)-trick like this: you build a sequence of 100

Re: [R] special question on regression

2011-07-17 Thread Johannes Radinger
Hello, @Bert: I didn't expect a full tutorial service but probably a hint of the Masters of statistics ;) Anyway I posted my question again on a special statistic forum. Your hint about the censored regression: I don't think that this is the case here. As so far as I understand it is there the

[R] nls() and lines()

2011-07-17 Thread Steven Ranney
All - I'm having an issue with trying to plot a model derived from nls() onto a simple plot.  I have included a sample data set and the code that I've been using.    year month day   date location mileage  cost gallon  cpg   mpg  x 2009 1   4   1/4/2009  BZN  124585 19.39 

Re: [R] ecdf() to nls() - how to transform data?

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 8:13 PM, Jochen1980 wrote: Hi David, my first attempt to work through your code was successful, my predicted line is pretty close to the ecdf-function. I have no idea why you inverted the gumbel-function and what the advantage of this strategy is? I was advised by a

Re: [R] How to speed up interpolation

2011-07-17 Thread jim holtman
Here is what I did; convert the data to a numeric matrix for faster processing. You can convert back to a dataframe since you have the indices into the levels for the flights and runways. # read in data source('/temp/df/df') # convert to matrix df.mat - cbind(pt = as.numeric(df$PredTime) +

[R] question about linear mixed model

2011-07-17 Thread Lao Meng
Hi all: I have a question about linear mixed model. my linear mixed model with randomized slope and intercept with interaction of time and group(g1,g2,g3): model- glmmPQL(log10(CD4) ~ time + factor(group)+ time:factor(group), random = ~time|id) What I get is only the main and interaction of time

Re: [R] Splitting one column value into multiple rows

2011-07-17 Thread Madana_Babu
Hi David, PFB the details of my query. Request your help in getting this resolved. # TESTING is my dataset with almost 40K rows. I am importing this dataset from my local desktop TESTING - read.table(/Users/madana/Desktop/testing.txt, header=FALSE, sep=\t, na.strings=, dec=.,

Re: [R] Splitting one column value into multiple rows

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 11:27 PM, Madana_Babu wrote: Hi David, PFB the details of my query. Request your help in getting this resolved. # TESTING is my dataset with almost 40K rows. I am importing this dataset from my local desktop TESTING - read.table(/Users/madana/Desktop/testing.txt,

Re: [R] Splitting one column value into multiple rows

2011-07-17 Thread David Winsemius
On Jul 17, 2011, at 11:47 PM, David Winsemius wrote: On Jul 17, 2011, at 11:27 PM, Madana_Babu wrote: Hi David, PFB What ever that TLA means the details of my query. Request your help in getting this resolved. # TESTING is my dataset with almost 40K rows. A small dataset. I am

Re: [R] searching and replacing in a data frame.

2011-07-17 Thread Ashim Kapoor
Dear David, Many thanks for your reply. On Fri, Jul 15, 2011 at 5:24 PM, David Winsemius dwinsem...@comcast.netwrote: On Jul 15, 2011, at 5:20 AM, Ashim Kapoor wrote: Dear R helpers, Please have a look at the following : - Note : My goal is to find and replace all Inf's in a data