Re: [R] Any package recommended for time series graphics in R?

2012-03-24 Thread Marcos Amaris Gonzalez
Look this website, I think that it is very good: http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html#time-series-analysis On Thu, Mar 22, 2012 at 12:50 AM, jpm miao wrote: > Hello, > >   I would like to produce a few time series graphs with R. My data is > usua

Re: [R] How to convert factors to numbers

2012-03-24 Thread Rainer Schuermann
I guess the problem starts with setting read.table(...dec = ",", ... ). The data in your file are with decimal point. Without that, it works just fine: > f <- "http://r.789695.n4.nabble.com/file/n4498828/p_diarios.txt"; > df <- read.table( f, header = TRUE ) > log.Price <- log(df$price) > he

Re: [R] R numerical integration

2012-03-24 Thread Hans W Borchers
casperyc hotmail.co.uk> writes: > Is there any other packages to do numerical integration other than the > default 'integrate'? > Basically, I am integrating: > > integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value > > The integration is ok provided sigma is >0. > However, when m

Re: [R] Using MuMIn - error message

2012-03-24 Thread Dunbar, Michael J.
Hi Rachel Do you accidentally have nlme and lme4 loaded at the same time? If so then try unloading nlme. regards Mike From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Dragonwalker [dragonwalker...@hotmail.com] Sent: 23 Mar

[R] Weights for Kruskal-Wallis test

2012-03-24 Thread Антон Морковин
Hello, Is there any functions in R to proceed Kruskal-Wallis test with weights for each observation, without pseudoreplicating the sample? __ Best Regards A.A. Morkovin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] R numerical integration

2012-03-24 Thread Hans W Borchers
Hans W Borchers googlemail.com> writes: > > casperyc hotmail.co.uk> writes: > > > Is there any other packages to do numerical integration other than the > > default 'integrate'? > > Basically, I am integrating: > > > > integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value > > >

Re: [R] Using MuMIn - error message

2012-03-24 Thread Dragonwalker
This was solved by loading each package right before using it (I thought you loaded both at the beginning). However I now have an additional issue. I ran a small model with just three factors to try it out and it worked beautifully, but when I tried to run it with all the factors this is what I got

[R] Handling 8GB .txt file in R?

2012-03-24 Thread iliketurtles
Hi, I am mediocre at R, maybe 1000 hours experience, but I received an 8GB dataset and I don't know what to do with it. I have to do extensive analysis over it for my Honours thesis. I can't even import it. I've tried; - Splitting it up using the free csv-splitter-1.1.zip that seems to be workin

[R] Solving the equation using uniroot

2012-03-24 Thread Shant Ch
Hello all, I was going to solve (n-m)! * (n-k)! = 0.5 *n! * (n-m-k)! for m when values of n and k are provided n1<-c(10,13,18,30,60,100,500)         # values of n kx<-seq(1,7,1);   # values of k slv2<-lapply(n1,function(n){    slv1<-lapply(kx,function(k){    

Re: [R] how to convert digits to specified decimal vectors

2012-03-24 Thread sagarnikam123
yes sir i used format() function like > x<-c(3,5,6) >y<-format(x,nsmall=6) >y [1] "3.00" "5.00" "6.00" but it again gives me same output > as.double(y[1]) [1] 3 i want it in decimal style like 4.000 (i.e. without string format) -- View this message in context: http://r.789695.n4.n

Re: [R] how to convert digits to specified decimal vectors

2012-03-24 Thread Berend Hasselman
On 24-03-2012, at 08:25, sagarnikam123 wrote: > yes sir i used format() function like > >> x<-c(3,5,6) >> y<-format(x,nsmall=6) >> y > [1] "3.00" "5.00" "6.00" > > but it again gives me same output >> as.double(y[1]) > [1] 3 > You are converting back to numeric and using the defau

Re: [R] Solving the equation using uniroot

2012-03-24 Thread Berend Hasselman
On 24-03-2012, at 05:35, Shant Ch wrote: > Hello all, > > I was going to solve (n-m)! * (n-k)! = 0.5 *n! * (n-m-k)! > > for m when values of n and k are provided > > > n1<-c(10,13,18,30,60,100,500) # values of n > > kx<-seq(1,7,1); # values of k > > >

Re: [R] R numerical integration

2012-03-24 Thread Petr Savicky
On Fri, Mar 23, 2012 at 01:27:57PM -0700, casperyc wrote: > Hi all, > > Is there any other packages to do numerical integration other than the > default 'integrate'? > > Basically, I am integrating: > > integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value > > The integration is o

Re: [R] "source" option

2012-03-24 Thread Jim Lemon
On 03/24/2012 07:22 AM, ivo welch wrote: Dear R experts---has someone written a wrapper for the "source" function that opens a sink file in the same name as the .R file and closes it at the end (including when there is an error that aborts)? the first part is easy, but I am not sure how to not p

[R] Double And average a vector

2012-03-24 Thread Alaios
Dear all, I am reading with R some measurements vectors from an external device. The length of each vector (containing numbers) is not constant. I would like by doubling the numbers of elements I select to shrink the vector to a new one Let's call the vector I read from the device as oldvector

[R] plotting with line types... bit confusing

2012-03-24 Thread Alaios
Dear all, I would like to print an empirical cdf on a vector I have while the plot(ecdf(myVector)) works great when I try to specify the line type to be a line (I get points) with plot(ecdf(myVector),type="lines") Error in plot.default(NA, NA, type = "n", xlim = xlim, ylim = ylim, xlab = xlab, 

Re: [R] R numerical integration

2012-03-24 Thread peter dalgaard
On Mar 24, 2012, at 09:46 , Petr Savicky wrote: > Integrating with infinite limits is necessarily a heuristic. ...as is numerical integration in general. In the present case, the infinite limits are actually only half the problem. The integrate() function is usually quite good at dealing with

Re: [R] Double And average a vector

2012-03-24 Thread Petr Savicky
On Sat, Mar 24, 2012 at 03:49:28AM -0700, Alaios wrote: > Dear all, > I am reading with R some measurements vectors from an external device. > The length of each vector (containing numbers) is not constant. > > I would like by doubling the numbers of elements I select to shrink the > vector to a

[R] Compare similarit of two vector of not same length

2012-03-24 Thread Alaios
Dear all, this is not strictly R question. I have two vectors of different length (this is in the order of 10%). I am trying to see if still one can compare these two for similarity. IF the vectors were of the same length I would just take the difference of the two and plot a pdf of it. One wa

Re: [R] show and produce PDF file with pdf() and dev.off( ) in function

2012-03-24 Thread mlell08
you could either define a plotting function which passes your arguments to plot() two times, with different devices active. this function plots the given arguments two times: pl<- function(...){ X11() #or pdf() plot(...) # dev.off() if pdf() is used X11()

Re: [R] show and produce PDF file with pdf() and dev.off( ) in function

2012-03-24 Thread Igor Sosa Mayor
apart from the other answers, be aware that you have to 'print' the graph with pl<-plot(x) print(pl) in case you're using lattice or ggplot2 plots. On Fri, Mar 23, 2012 at 02:40:04PM -0700, casperyc wrote: > Hi all, > > I know how to use pdf() and dev.off() to produce and save a graph. > > Ho

Re: [R] calling java from R and using java time series double precision array

2012-03-24 Thread Hurr
No response, and I still cannot do it or find out where to learn. JAVA CLASS SOURCE FOR R: public class Transf2R { Transf2R transf2R; public static void main(String[]args) { Transf2R transf2R=new Transf2R(); transf2R.transf2R=transf2R; transf2R.transf2R.main2(); } public final sta

Re: [R] Handling 8GB .txt file in R?

2012-03-24 Thread R. Michael Weylandt
Despair not! Malcom Gladwell would say you are 1/10 of the way to becoming the next MozaRt! You need to say how your data set is designed. Your problem with ff seems to be that the lines are not of constant length: if they aren't of a consistent CSV format, I wouldn't be surprised if a CSV splitte

Re: [R] plotting with line types... bit confusing

2012-03-24 Thread R. Michael Weylandt
The command is type = "l" not "lines" If you want linear interpolation (which may or may not be the right thing for an ecdf), you'll have to do a bit more work since you aren't passing plot a set of points. x <- ecdf(rnorm(500)) I've packaged it all up in a function for you because it requir

Re: [R] video recorded simulations in R?

2012-03-24 Thread Sarah Goslee
The easiest approach is to save your plot as a bitmap every x-th iteration, and then use other tools to animate them. I use ImageMagick for this, but I'm sure there are other options. Sarah On Mar 23, 2012, at 11:28 PM, C W wrote: > Hi everyone, > Is it possible to video record simulations in

Re: [R] julian() and numerical noise

2012-03-24 Thread R. Michael Weylandt
It might be easier to just work with a character representation rather than fighting the floating point demons: fnc <- function(date){ as.Date(paste(date, "01", sep = "."), format = "%Y.%m.%d") } Hope that helps, Michael On Sat, Mar 24, 2012 at 10:47 AM, Andreas Eckner wrote: > Thanks for

[R] Installing "rgl" package

2012-03-24 Thread Usman Gulumbe
I tried installing "rgl" package which is needed for Rcmdr to work properly but I always some problem. This is the error I get . checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... libraries , headers  checking GL/gl.h

Re: [R] R conditional matrix operations - advanced condition

2012-03-24 Thread Lukasz Kielpinski
Thanks a lot! now my program works about 10x faster (and I will have results before deadline!) to sum up more generally - if you want matrix operation to be conditional it is advisable to have results pre-computed. (?) Lukasz On 23 March 2012 19:50, Berend Hasselman wrote: > > On 23-03-2012, at

[R] Loess CI

2012-03-24 Thread sw1
I am trying to (semi) calculate the confidence intervals for a loess smoother (function: loess()), but have been thus far unsuccessful. The CI for the loess predicted values, yhat, are apparently yhat +- t*s * sqrt(w^2), where s is the residual sum of squares and w is the weight function Corre

[R] NLME error model with several responses

2012-03-24 Thread jaclea
Hi! I am using the NLME package for R to modeling glucose-insuline response with Bergman's model, very similar to the example in the documentation for the NLME package. My question concerns the model for the residuals. I use a proportional model , Var(e_{ij})=(sigma_g*G(t))^2 for the glucose res

[R] Append to file in loop

2012-03-24 Thread Luisin Galindo, PhD
My files are on disk and they are regular text files named file_1 file_2 file_3 file_4 and file_5 with extension .saam The separator is sep='' (ie, white space) I want to append 'XFile' at the end of those files. XFile is also on disk. file.append("file_1.saam", "XFile.saam"); file.append("file

[R] expand.grid (the half!)

2012-03-24 Thread Alaios
Dear all, I am using expand.grid for calculating all the possible values between four pairs. I would like to ask you if it is possible to filter the result out, so to keep all unique pairs. In my algorithm the input c(1,2) produces the same results as the c(2,1) so for example in the following

Re: [R] julian() and numerical noise

2012-03-24 Thread Andreas Eckner
Thanks for the help. A workaround seems indeed easy to write, for example, by rounding the the value of 'm' inside chron:::julian.default(), or only passing integers to the function. I never intended to use a case involving a quadrillionth of a day, but encountered the problem when converting

Re: [R] Compare similarit of two vector of not same length

2012-03-24 Thread Berend Hasselman
On 24-03-2012, at 12:44, Alaios wrote: > Dear all, > this is not strictly R question. I have two vectors of different length (this > is in the order of 10%). I am trying to see if still one can compare these > two for similarity. > What do you mean? - all entries in shorter vector occur in l

Re: [R] Append to file in loop

2012-03-24 Thread R. Michael Weylandt
for(i in 1:100){ file.append(paste("file_", i, ".saam", sep = ""), "XFile.saam") } seems like it would work. Michael On Sat, Mar 24, 2012 at 10:42 AM, Luisin Galindo, PhD wrote: > My files are on disk and they are regular text files named > > file_1 file_2 file_3 file_4 and file_5 with exten

Re: [R] expand.grid (the half!)

2012-03-24 Thread Søren Højsgaard
Something like this? x <- expand.grid(c(1,2,3),c(1,2,3)) x[x[,2]>=x[,1],] Var1 Var2 111 412 522 713 823 933 Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios Se

[R] How to compute within-group mean and sd?

2012-03-24 Thread reeyarn
Hi, I want to run something like SELECT firm_id, count(*), mean(value), sd(value) FROM table GROUP BY firm_id; But I have to write a for loop like for ( id in unique(table$firm_id ) { print(paste( id, mean(table[firm_id == id, "value"]) )) } Is there any way to do it easier? Thank

Re: [R] How to compute within-group mean and sd?

2012-03-24 Thread R. Michael Weylandt
This is a very commonly used paradigm in R and there are many different answers, one would be tapply(). You could also look at the plyr package. Michael On Sat, Mar 24, 2012 at 11:32 AM, reeyarn wrote: > Hi, I want to run something like >  SELECT firm_id, count(*), mean(value), sd(value) >  FROM

Re: [R] show and produce PDF file with pdf() and dev.off( ) in function

2012-03-24 Thread Uwe Ligges
On 24.03.2012 13:11, Igor Sosa Mayor wrote: apart from the other answers, be aware that you have to 'print' the graph with pl<-plot(x) print(pl) Which is true for lattice function but not for a base graphics plot(). Uwe Ligges in case you're using lattice or ggplot2 plots. On Fri, Mar 2

Re: [R] Installing "rgl" package

2012-03-24 Thread Uwe Ligges
On 24.03.2012 15:54, Usman Gulumbe wrote: I tried installing "rgl" package which is needed for Rcmdr to work properly but I always some problem. This is the error I get . checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking f

Re: [R] expand.grid (the half!)

2012-03-24 Thread Berend Hasselman
On 24-03-2012, at 16:08, Alaios wrote: > Dear all, > I am using expand.grid for calculating all the possible values between four > pairs. > > I would like to ask you if it is possible to filter the result out, so to > keep all unique pairs. In my algorithm the input c(1,2) produces the same >

Re: [R] video recorded simulations in R?

2012-03-24 Thread steven mosher
see the package animate On Mar 24, 2012 7:37 AM, "Sarah Goslee" wrote: > The easiest approach is to save your plot as a bitmap every x-th > iteration, and then use other tools to animate them. I use ImageMagick for > this, but I'm sure there are other options. > > Sarah > > On Mar 23, 2012, at 11

Re: [R] video recorded simulations in R?

2012-03-24 Thread C W
Thank you Steven, exactly what I am looking for. On Sat, Mar 24, 2012 at 1:22 PM, steven mosher wrote: > see the package animate > On Mar 24, 2012 7:37 AM, "Sarah Goslee" wrote: > >> The easiest approach is to save your plot as a bitmap every x-th >> iteration, and then use other tools to animat

[R] proper order of calls when estimating nested models

2012-03-24 Thread Liviu Andronic
Dear all How should one proceed when estimating nested models containing missing data. What I would like to do is to first estimate the model with the control variables only, and then estimate the model containing also the variables of interest. For example, > summary(reg.a <- lm(IMC ~ STYLE + SEXE

[R] argument names inside a function?

2012-03-24 Thread Ed Siefker
Is there a way I can get the names of the arguments passed to a function from within a function? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htm

Re: [R] argument names inside a function?

2012-03-24 Thread R. Michael Weylandt
Can you be a little more concrete? If you want the form of the expression given (rather than its value), deparse(substitute()) will work: fnc1 <- function(x){ deparse(substitute(x))} fnc1(3) # 3 fnc1(x) # "x" fnc1(x + 4) # "x+4" If you are passing them through the ... argument, you can coerce

Re: [R] argument names inside a function?

2012-03-24 Thread Duncan Murdoch
On 12-03-24 5:04 PM, Ed Siefker wrote: Is there a way I can get the names of the arguments passed to a function from within a function? Use sys.call() to get the call, names(sys.call()) to get the names. It won't tell you how arguments were matched to formal names; for that you could use nam

Re: [R] argument names inside a function?

2012-03-24 Thread Ed Siefker
Thanks, deparse(substitute()) does exactly what I want. On Sat, Mar 24, 2012 at 4:20 PM, R. Michael Weylandt wrote: > Can you be a little more concrete? > > If you want the form of the expression given (rather than its value), > deparse(substitute()) will work: > > fnc1 <- function(x){ deparse(su

[R] Format wanted...

2012-03-24 Thread Duncan Murdoch
Do we have a format that always includes a decimal point and a given number of significant digits, but otherwise drops unnecessary characters? For example, if I wanted 5 digits, I'd want the following: Round to 5 digits: 1.234567 -> "1.2346" Drop unnecessary zeros: 1.23 -> "1.23" Force

Re: [R] Compare similarit of two vector of not same length

2012-03-24 Thread Greg Snow
If you are trying to see if both vectors could be random samples from the same population then I would look at a qqplot (see ?qqplot) which will compare them visually (and if they are not the same length then the qqplot function will use interpolation to compare them. For a more formal test you ca

Re: [R] How to compute within-group mean and sd?

2012-03-24 Thread Greg Snow
In addition to Michael's answers, there are packages that allow you to use SQL syntax on R data objects, so you could probably just use what you are familiar with. On Sat, Mar 24, 2012 at 9:32 AM, reeyarn wrote: > Hi, I want to run something like >  SELECT firm_id, count(*), mean(value), sd(value

Re: [R] show and produce PDF file with pdf() and dev.off( ) in function

2012-03-24 Thread Greg Snow
As others have said, you pretty much need to do the plot 2 times, but if it takes more that one command to create the plot you can use the dev.copy function to copy what you have just plotted into another graphics device rather than reissuing all the commands again. On Sat, Mar 24, 2012 at 9:43 AM

[R] Struggling with zoo and aggregate

2012-03-24 Thread Thomas Adams
All: I have a SQlite database where I have stored some verification data by date & time (cycle Z/UTC), lead_time as well as type, duration, etc. I would like to analyze & plot the data as monthly averages. I have looked at a bunch of examples which use some combination of zoo and aggregate, but I

Re: [R] Format wanted...

2012-03-24 Thread J Toll
On Sat, Mar 24, 2012 at 7:30 PM, Duncan Murdoch wrote: > Do we have a format that always includes a decimal point and a given number > of significant digits, but otherwise drops unnecessary characters?  For > example, if I wanted 5 digits, I'd want the following: > > Round to 5 digits: > 1.234567

[R] Reading big files in chunks-ff package

2012-03-24 Thread Mav
Hello! A question about reading large CSV files I need to analyse several files with sizes larger than 3 GB. Those files have more than 10million rows (and up to 25 million) and 9 columns. Since I don´t have a large RAM memory, I think that the ff package can really help me. I am trying to use r

Re: [R] How to compute within-group mean and sd?

2012-03-24 Thread Rui Barradas
Hello, Reeyarn_李智洋_10928113 wrote > > Hi, I want to run something like > SELECT firm_id, count(*), mean(value), sd(value) > FROM table > GROUP BY firm_id; > > But I have to write a for loop like > for ( id in unique(table$firm_id ) { > print(paste( id, mean(table[firm_id == id, "va

Re: [R] julian() and numerical noise

2012-03-24 Thread Andreas Eckner
Very helpful, thanks! Andreas On 3/24/2012 10:57 AM, R. Michael Weylandt wrote: It might be easier to just work with a character representation rather than fighting the floating point demons: fnc<- function(date){ as.Date(paste(date, "01", sep = "."), format = "%Y.%m.%d") } Hope that hel

[R] Constraint optimization containing constraints with absolute values

2012-03-24 Thread Dimitris.Kapetanakis
Dear all, I would like to use constraint optimization routine but with the constraint containing absolute values of the arguments. For example I would like to maximize a log-likelihood function (loglik) wrt b where b is a vector of length=2 with the constraint abs(b[1])+abs(b[2])=2. The uncons

Re: [R] How to convert factors to numbers

2012-03-24 Thread sandro
Thanks Natasha, Rainer and David. Your support allow me to solve the issue with the factor number. Sincerely Sandro -- View this message in context: http://r.789695.n4.nabble.com/How-to-convert-factors-to-numbers-tp4498828p4501727.html Sent from the R help mailing list archive at Nabble.com.

[R] Help ordinal mixed model!

2012-03-24 Thread Ivan Allaman
Good afternoon, gentlemen! After several days studying and researching on categorical data (various forums with answers from the owner of the library - all incipient) how to interpret the output the function MCMCglmm, come to enlist the help of you, if someone has already worked with MCMCglmm funct

[R] cubature

2012-03-24 Thread JMDS
Hi, I am using adaptIntegrate from Cubature to do numerical integration on a double integral with a 1 x 2 vector x. Say the function is something simple to start like f(x)=x1*x2 and I wish to integrate x1 over (0,365-x2) and x2 over (0,365) f <- function(x) {(x[2])*(x[1])} # "x" is vector int1<-

Re: [R] Struggling with zoo and aggregate

2012-03-24 Thread Gabor Grothendieck
On Sat, Mar 24, 2012 at 10:44 PM, Thomas Adams wrote: > All: > > I have a SQlite database where I have stored some verification data by date > & time (cycle Z/UTC), lead_time as well as type, duration, etc. I would > like to analyze & plot the data as monthly averages. I have looked at a > bunch o