[R] How to make all elements all elements lower-cap ?
I have a vector of letters like c(a, B, c). Is there any R function to force all elements to lower-cap ? Thanks, -- View this message in context: http://old.nabble.com/How-to-make-all-elements-all-elements-lower-cap---tp26365794p26365794.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] All combination
Please consider the following : expand.grid(rep(list(c(1:3)), 3)) Var1 Var2 Var3 1 111 2 211 3 311 4 121 5 221 6 321 7 131 8 231 9 331 10112 11212 12312 13122 14222 15322 16132 17232 18332 19113 20213 21313 22123 23223 24323 25133 26233 27333 Now I want to remove the rows which has any repetition of number. For example I want to remove row 1-5 but not 6 and so on Is there any easy way to do that? Thanks, -- View this message in context: http://old.nabble.com/All-combination-tp2648p2648.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Programming insight
Hi all, Most of the time in my programming I use for loop however there will always be some way to use other loop like while, if etc to implement same query. My question is among those different loops which is theoretically fastest and why? Thanks -- View this message in context: http://www.nabble.com/Programming-insight-tp25530722p25530722.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] A stat related question
Can I ask a small stat. related question here? Suppose I have two predictors for a time series processes and accuracy of predictor is measured from MSEs. My question is, if two predictors give same MSE then, necessarily they have to be identical? Can anyone provide me any counter example? Thanks. -- View this message in context: http://www.nabble.com/A-stat-related-question-tp25505618p25505618.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Searching 1st number within a ch. string
Hi all, Is there any process to conduct a search for a particular digit or letter in a ch. string? For example I want to make a search where 1st numeric figure appears in the string asd123. Here the answer should be 4 Thanks, -- View this message in context: http://www.nabble.com/Searching-1st-number-within-a-ch.-string-tp25400580p25400580.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Concentration ellipsoid
Hi all, Can anyone please guide me how to draw a Concentration ellipsoid for a bivariate system with a bivariate normal dist. having a VCV matrix : Sigma - matrix(c(1,2,2,5), 2, 2) I would like to draw in using GGPLOT. Your help will be highly appreciated. Thanks, -- View this message in context: http://www.nabble.com/Concentration-ellipsoid-tp25315705p25315705.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Concentration ellipsoid
In the mean time, i have found one package ellipse to do the same. The syntax is : plot(ellipse(Sigma), type='l') However I am still struggling on how to use qplot (in GGPLOT2) to draw above plot. I want to get some stylish view for my presentation preparation. Any help please? Thanks, RON70 wrote: Hi all, Can anyone please guide me how to draw a Concentration ellipsoid for a bivariate system with a bivariate normal dist. having a VCV matrix : Sigma - matrix(c(1,2,2,5), 2, 2) I would like to draw in using GGPLOT. Your help will be highly appreciated. Thanks, -- View this message in context: http://www.nabble.com/Concentration-ellipsoid-tp25315705p25316243.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] A question on List
Suppose I have following list : mat - vector(list) for (i in 1:4) mat[[i]] - matrix(rnorm(25),5) mat mat [[1]] [,1] [,2] [,3] [,4] [,5] [1,] -1.27171814 -0.8087277 -0.4771356 0.6001265 0.9842248 [2,] -1.37337445 1.0754536 -1.6304287 -0.6854075 -0.6029390 [3,] -0.32393457 -0.8933633 -0.9077967 0.9738039 -3.0220266 [4,] -1.22184968 -1.2571625 -0.4064736 -1.6686981 -0.4896512 [5,] -0.09333244 1.4880530 1.6410411 -0.5489993 1.0939736 [[2]] [,1] [,2] [,3] [,4] [,5] [1,] -1.0139178 -0.4817983 -0.214 0.1649356 1.7750268 [2,] 1.5544890 0.6345386 1.6307417 -2.0887206 1.8299279 [3,] -0.3575260 -0.6669547 0.5960779 -1.1091696 -0.2831409 [4,] 0.7742701 0.8313172 0.4178063 -2.5993914 -0.9920140 [5,] -0.6238547 0.8777678 -1.4249051 -0.4793574 0.5290309 [[3]] [,1] [,2] [,3] [,4][,5] [1,] -1.2833578 0.2271013 -1.605616640 0.3379672 0.86307678 [2,] 0.8928252 -0.2826024 -0.294600779 0.3659292 -0.06884467 [3,] -0.8237363 1.2258510 1.091578624 1.6907392 -0.42073560 [4,] -0.2537396 0.3662041 0.009558159 1.2127068 -1.14449393 [5,] -0.5001592 0.5390412 0.372628875 -0.9434233 -0.52022201 [[4]] [,1] [,2][,3] [,4] [,5] [1,] 0.55638191 2.000902039 -0.40155111 0.6214637 0.4044958 [2,] 0.06705861 -0.005629049 0.05144204 0.4910031 -0.2711823 [3,] -2.07173018 -0.210809259 0.22680564 0.5624870 -2.1322234 [4,] 0.04591303 -0.735466145 -0.13164334 -1.8873585 -1.2711131 [5,] 0.67454754 0.911601123 1.34304395 2.2798986 -0.5136242 Define another vector : vect - rnorm(4) Now I want to do following calculation for (i in 1:4) mat[[i]] - mat[[i]] * vect[i] mat My question is, can I do previous calculation without having for loop? Thanks -- View this message in context: http://www.nabble.com/A-question-on-List-tp25075922p25075922.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Density plot in ggplot2
Hi all, I was trying to draw a stacked density plot like that : library(ggplot2); library(plyr) dat - cbind(rnorm(300), rep(c(1,2), each=150)) ggplot() + geom_density(aes(x=dat[,1], fill=factor(dat[,2]), position=stack)) + xlab() + ylab() + scale_colour_manual(name = Pallet, labels = c(X, Y)) Here everything is ok, except few points : 1. I want to remove the name of y-axis, which is by default density. Here I put ylab(), however although for x-axis it is working, for y-axis it is not. Is there any specific formula for that? 2. I want to rename the color plot, as well as the title of the color. The function scale_colour_manual() seems not working. Can anyone please suggest me how to achieve desired thing? Thanks -- View this message in context: http://www.nabble.com/Density-plot-in-ggplot2-tp24702858p24702858.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] ggplot question
In page http://had.co.nz/ggplot2/scale_date.html , there is a time series plot for multiple variables at the bottom. i.e qplot(date, value, data = em, geom = line, group = variable) + + facet_grid(variable ~ ., scale = free_y) How can I make different color for different series? Thanks -- View this message in context: http://www.nabble.com/ggplot-question-tp24641347p24641347.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] legend title in qplot
Thank you for your reply. Yes I am reading that document and ofcourse simultaniously trying to apply in my current problem as well. Yes still I am learning. Here I have my code : library(ggplot2) library(plyr) dat = rnorm(1000); variable = rep(c(Variable:1, Variable:2), each=500); coll = rep(c(10, 20), each=500); dat1 = data.frame(dat, variable, coll); dat1 p = ggplot(dat1) + geom_line(aes(y=dat, x=1:500, colour=coll), group=variable) + facet_grid(variable ~ .); p #p + scale_colour_hue(h = c(0, 90), l=70, c=30) Here I have not used scale_colour_hue() function because I fill I have very little control over the colors at least for my current problem. Therefore I have created a new variable coll and put the numbers for that variable, which best match my desired color. However here my problem is in color pallet, values of coll is displayed, not values of variable. But this problem can be solved if I use scale_colour_hue(). Can anyone please suggest how to show the values of variable in pallet correctly? baptiste auguie-5 wrote: ?scale_fill_discrete() qplot(x,y,data=data.frame(x=1,y=1,f=a),fill=f) + scale_fill_discrete(test) baptiste HTH, 2009/7/21 rajesh j akshay.raj...@gmail.com Hi, I've used the following command in qplot qplot(a$V1,geom=histogram,binwidth=0.15,fill = factor(a$V2),ylab=Frequency,xlab=Rate); but the title in the legend shows up as factor(a$V2)...how can i change this? -- Rajesh.J [[alternative HTML version deleted]] __ 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.html and provide commented, minimal, self-contained, reproducible code. -- _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ [[alternative HTML version deleted]] __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/legend-title-in-qplot-tp24582597p24643365.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] legend title in qplot
PLEASE IGNORE MY PREVIOUS MAIL RON70 wrote: Thank you for your reply. Yes I am reading that document and ofcourse simultaniously trying to apply in my current problem as well. Yes still I am learning. Here I have my code : library(ggplot2) library(plyr) dat = rnorm(1000); variable = rep(c(Variable:1, Variable:2), each=500); coll = rep(c(10, 20), each=500); dat1 = data.frame(dat, variable, coll); dat1 p = ggplot(dat1) + geom_line(aes(y=dat, x=1:500, colour=coll), group=variable) + facet_grid(variable ~ .); p #p + scale_colour_hue(h = c(0, 90), l=70, c=30) Here I have not used scale_colour_hue() function because I fill I have very little control over the colors at least for my current problem. Therefore I have created a new variable coll and put the numbers for that variable, which best match my desired color. However here my problem is in color pallet, values of coll is displayed, not values of variable. But this problem can be solved if I use scale_colour_hue(). Can anyone please suggest how to show the values of variable in pallet correctly? baptiste auguie-5 wrote: ?scale_fill_discrete() qplot(x,y,data=data.frame(x=1,y=1,f=a),fill=f) + scale_fill_discrete(test) baptiste HTH, 2009/7/21 rajesh j akshay.raj...@gmail.com Hi, I've used the following command in qplot qplot(a$V1,geom=histogram,binwidth=0.15,fill = factor(a$V2),ylab=Frequency,xlab=Rate); but the title in the legend shows up as factor(a$V2)...how can i change this? -- Rajesh.J [[alternative HTML version deleted]] __ 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.html and provide commented, minimal, self-contained, reproducible code. -- _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ [[alternative HTML version deleted]] __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/legend-title-in-qplot-tp24582597p24643654.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Another question on gplot
I am getting following strange error : library(sn) library(ggplot2) dat1 - as.matrix(rsn(1000, 0, 1, 0))[,1] ggplot() + geom_histogram(aes(x = dat1, y = ..density.., fill = ..count..)) + xlab(Distribution) + scale_y_continuous() Error: No data for layer Can anyone please tell me why it is coming? -- View this message in context: http://www.nabble.com/Another-question-on-gplot-tp24624709p24624709.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Question on qplot
I have following code on qplot : library(ggplot2) ggplot() + geom_histogram(aes(x=rnorm(100), fill=..count..), xlab=, ylab=) However above code doesnot seem to remove the xlab ylab. What is the correct code? I also want to remove the color-palate in the right side. Is there any way to do that? Thanks -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24615077p24615077.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Merging lot of zoo objects
Hi, I have 100 price data series like price1, price2, price3, . All are zoo objects. Now I want to merge all them together. Obviously I can do this using merge(price1, price2, price3, ). However as I have lot of price series (almost 1000) above systax is very tiresome. Is there any other way on doing to in one-go? Thanks -- View this message in context: http://www.nabble.com/Merging-lot-of-zoo-objects-tp24582750p24582750.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Question on qplot
Hi, suppose I have following codes : library(zoo); library(ggplot2) dat - matrix(rnorm(500*2), 500); dat - zooreg(dat, start = as.Date(01/01/01, %m/%d/%y), frequency=1); plot(dat) head(dat); month.no - format(index(dat), %m); dat1 - cbind(coredata(dat), as.numeric(month.no)) x - dat1[,1]; y - dat1[,2]; z - dat1[,3] Now I draw a qplot like : qplot(x, z) It is ok However if I reverse that like qplot(z, x) I am getting strange plot. I expected it should look just like transpose of above plot. Can anyone please clarify me why I am getting that? -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24545841.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question on qplot
the plots I am getting is here : http://www.2shared.com/file/6739681/d4c6c9d3/plot.html and http://www.2shared.com/file/6739673/bd50b430/plot.html How you are getting transposed one? smu-2 wrote: hey, On Sat, Jul 18, 2009 at 01:52:34AM -0700, RON70 wrote: Hi, suppose I have following codes : library(zoo); library(ggplot2) dat - matrix(rnorm(500*2), 500); dat - zooreg(dat, start = as.Date(01/01/01, %m/%d/%y), frequency=1); plot(dat) head(dat); month.no - format(index(dat), %m); dat1 - cbind(coredata(dat), as.numeric(month.no)) x - dat1[,1]; y - dat1[,2]; z - dat1[,3] Now I draw a qplot like : qplot(x, z) It is ok However if I reverse that like qplot(z, x) I am getting strange plot. I expected it should look just like transpose of above plot. Using your code I get the transposed plot. regards, stefan __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24546574.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question on qplot
I have updated the ggplot2 package as well as R, how got some new error. qplot(x, z) Error in get(new, env = FacetGrid, inherits = TRUE)(FacetGrid, ...) : could not find function is.formula I cannot understand what is happening with my system. Here I am providing the details of my system and package: packageDescription(ggplot2)$Version [1] 0.8.2 R.version.string [1] R version 2.9.1 (2009-06-26) I am using windows vista (build 6002, Service Pack 2). Please help. Thanks Gabor Grothendieck wrote: Although there is no explicit support for ggplot2 in zoo currently (hopefully there will be in the future) both your qplot commands do work for me using: packageDescription(ggplot2)$Version [1] 0.8.3 packageDescription(zoo)$Version # devel version [1] 1.6-0 R.version.string # Windows Vista [1] R version 2.9.1 Patched (2009-07-16 r48939) For the devel version of zoo see the installation instructions at the bottom of:: http://r-forge.r-project.org/scm/?group_id=18 On Sat, Jul 18, 2009 at 4:52 AM, RON70ron_michae...@yahoo.com wrote: Hi, suppose I have following codes : library(zoo); library(ggplot2) dat - matrix(rnorm(500*2), 500); dat - zooreg(dat, start = as.Date(01/01/01, %m/%d/%y), frequency=1); plot(dat) head(dat); month.no - format(index(dat), %m); dat1 - cbind(coredata(dat), as.numeric(month.no)) x - dat1[,1]; y - dat1[,2]; z - dat1[,3] Now I draw a qplot like : qplot(x, z) It is ok However if I reverse that like qplot(z, x) I am getting strange plot. I expected it should look just like transpose of above plot. Can anyone please clarify me why I am getting that? -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24545841.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24550610.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question on qplot
Ah..now it is working as expected :) Package plyr was not loaded automatically. Is it a bug for ggplot2? All other dependencies like proto, grid, and reshape are loaded automatically. Thanks, David Winsemius wrote: When I try: ?is.formula I find that that one version is in package plyr. Perhaps you did not install the dependencies for ggplot2, or they weren't loaded? sessionInfo() ## ? -- DW. sessionInfo() R version 2.9.1 Patched (2009-07-04 r48897) x86_64-apple-darwin9.7.0 locale: en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid splines stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_0.8.2 reshape_0.8.2 plyr_0.1.9 proto_0.3-8 zoo_1.5-5 [6] mblm_0.11 chron_2.3-30lattice_0.17-25 Design_2.1-2 survival_2.35-4 [11] Hmisc_3.5-2 loaded via a namespace (and not attached): [1] cluster_1.12.0 tools_2.9.1 On Jul 18, 2009, at 2:32 PM, RON70 wrote: I have updated the ggplot2 package as well as R, how got some new error. qplot(x, z) Error in get(new, env = FacetGrid, inherits = TRUE) (FacetGrid, ...) : could not find function is.formula I cannot understand what is happening with my system. Here I am providing the details of my system and package: packageDescription(ggplot2)$Version [1] 0.8.2 R.version.string [1] R version 2.9.1 (2009-06-26) I am using windows vista (build 6002, Service Pack 2). Please help. Thanks Gabor Grothendieck wrote: Although there is no explicit support for ggplot2 in zoo currently (hopefully there will be in the future) both your qplot commands do work for me using: packageDescription(ggplot2)$Version [1] 0.8.3 packageDescription(zoo)$Version # devel version [1] 1.6-0 R.version.string # Windows Vista [1] R version 2.9.1 Patched (2009-07-16 r48939) For the devel version of zoo see the installation instructions at the bottom of:: http://r-forge.r-project.org/scm/?group_id=18 On Sat, Jul 18, 2009 at 4:52 AM, RON70ron_michae...@yahoo.com wrote: Hi, suppose I have following codes : library(zoo); library(ggplot2) dat - matrix(rnorm(500*2), 500); dat - zooreg(dat, start = as.Date(01/01/01, %m/%d/%y), frequency=1); plot(dat) head(dat); month.no - format(index(dat), %m); dat1 - cbind(coredata(dat), as.numeric(month.no)) x - dat1[,1]; y - dat1[,2]; z - dat1[,3] Now I draw a qplot like : qplot(x, z) It is ok However if I reverse that like qplot(z, x) I am getting strange plot. I expected it should look just like transpose of above plot. Can anyone please clarify me why I am getting that? -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24545841.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24550610.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Question-on-qplot-tp24545841p24550961.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Eigen value calculation
Hi all, Eigen vectors obtained from the function eigen() are ortho-normal? I see the documentation however there is no formal mention on that. If no, then is there any direct function to do the same? -- View this message in context: http://www.nabble.com/Eigen-value-calculation-tp24147807p24147807.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Altering columns
Hi, Suppose I have following dataset : mat - matrix(rnorm(100), 50) Now I want to put 2nd column in the place of 1st and 1st column in the place of 2nd. Is there any quick way to do that? Thanks and regards, -- View this message in context: http://www.nabble.com/Altering-columns-tp24099597p24099597.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Searching within a ch. string
Thanks for these suggestions. However I have one more question. Is there any way to extract only numbers? For example I want to extract only 88 in my example. Regards, MUHC-Research wrote: Hi Ron, Look up the grep() function. Cheers, -- *Luc Villandré* /Biostatistician McGill University Health Center - Montreal Children's Hospital Research Institute/ RON70 wrote: Hi all, is there any function to find some words in a character-string? For example suppose the string is : gdfsa-sdhchc-88, now I want to find whether this string contains sdhch. Is there any R function to do that? Regards, // __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Searching-within-a-ch.-string-tp23484010p23535406.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Searching within a ch. string
Hi all, is there any function to find some words in a character-string? For example suppose the string is : gdfsa-sdhchc-88, now I want to find whether this string contains sdhch. Is there any R function to do that? Regards, -- View this message in context: http://www.nabble.com/Searching-within-a-ch.-string-tp23484010p23484010.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Seed of Random number generation
Dear all, is it possible to extract the seed that was used for some random number generation? For example suppose I draw a random sample of size 1000 from a normal population : rnorm(1000) Now I want to know what seed R used for that sample generation. Any way out? Thanks and regards, -- View this message in context: http://www.nabble.com/Seed-of-Random-number-generation-tp23342886p23342886.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Double summation limits
Can anyone please explain me why it is not coming? I have done following : j=1 i=0:j; sum( choose(i+j,i) ) [1] 3 j=2 i=0:j; sum( choose(i+j,i) ) [1] 10 j=3 i=0:j; sum( choose(i+j,i) ) [1] 35 j=0:3; i=0:j; sum( choose(i+j,i) ) Warning message: In 0:j : numerical expression has 4 elements: only the first used [1] 4 Here if value of j is given independently it is ok. However as soon as j is used in loop it fails? Why it is happening? Is there any mathematics behind that? Orestis Chrysafis wrote: Dear R experts I need to write a function that incorporates double summation, the problem being that the upper limit of the second summation is the index of the first summation, i.e: sum_{j=0}^{x} sum_{i=0}^{j} choose(i+j, i) where x variable or constant, doesn't matter. The following code obviously doesn't work: f=function(x) {j=0:x; i=0:j; sum( choose(i+j,i) ) } Can you help? Thanks in advance, Orestis Chrysafis School of Mathematics University of Sheffield [[alternative HTML version deleted]] __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Double-summation-limits-tp23341171p23342887.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Serious difference between the result of ADF test in R and Eviews
I found there is serious difference between the result of ADF test in R and Eviews, for this data : dat V1 1 -0.075851693 2 -0.046125504 3 -0.009117161 4 0.025569817 5 0.034882743 6 0.073671497 7 0.063805297 8 0.062306796 9 0.072343820 10 0.058354121 11 -0.007635359 12 0.086790779 13 0.085487789 14 0.113577103 15 0.021293381 16 0.089423068 17 0.090485998 18 0.128847827 19 0.011859335 20 0.058794744 21 0.065909368 22 0.020887431 23 0.085387467 24 0.097375525 25 0.108981417 26 0.044289044 27 0.071428571 28 0.052430556 29 0.056307049 30 0.041957314 R results says, Unit root hypothesis can not be rejected : adf.test(dat, k=1) Augmented Dickey-Fuller Test data: dat Dickey-Fuller = -3.5458, Lag order = 1, p-value = 0.0554 alternative hypothesis: stationary However below the Eviews result Null Hypothesis: SERIES02 has a unit root Exogenous: Constant Lag Length: 1 (Fixed) t-Statistic Prob.* Augmented Dickey-Fuller test statistic -3.9925600.0048 Test critical values: 1% level-3.689194 5% level-2.971853 10% level -2.625121 *MacKinnon (1996) one-sided p-values. Augmented Dickey-Fuller Test Equation Dependent Variable: D(SERIES02) Method: Least Squares Date: 01/21/09 Time: 09:16 Sample (adjusted): 3 30 Included observations: 28 after adjustments VariableCoefficient Std. Error t-Statistic Prob. SERIES02(-1)-0.728468 0.182456-3.992560 0.0005 D(SERIES02(-1)) -0.182826 0.154154-1.185993 0.2468 C 0.0460940.0121523.7930430.0008 R-squared 0.510689Mean dependent var 0.003146 Adjusted R-squared 0.471545S.D. dependent var 0.047487 S.E. of regression 0.034520Akaike info criterion -3.793578 Sum squared resid 0.029791Schwarz criterion -3.650842 Log likelihood 56.11010F-statistic 13.04615 Durbin-Watson stat 2.127111Prob(F-statistic) 0.000132 Therefore Eviews rejects the null of unit root. Have you face this kind of problem earlier or I am missing something? -- View this message in context: http://www.nabble.com/Serious-difference-between-the-result-of-ADF-test-in-R-and-Eviews-tp21576706p21576706.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How to get Communication matrix ?
A communication matrix K is such that : K * VEC(A) = VEC(transpose of A). Is there any readily available R function to find that Communication matrix? Thanks -- View this message in context: http://www.nabble.com/How-to-get-%22Communication-matrix%22---tp21525220p21525220.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to get solution of following polynomial?
Hi Ravi, Thanks for this reply. However I could not understand meaning of vectorizing the function. Can you please be little bit elaborate on that? Secondly the package polynomial is not available in CRAN it seems. What is the alternate package? Thanks, Ravi Varadhan wrote: Hi, You can use the polynomial package to solve your problem. The key step is to find the exact polynomial representation of fn(). Noting that it is a 8-th degree polynomial, we can get its exact form using the poly.calc() function. Once we have that, it is a simple matter of finding the roots using the solve() function. require(polynomial) a - c(-0.07, 0.17) b - c(1, -4) cc - matrix(c(0.24, 0.00, -0.08, -0.31), 2) d - matrix(c(0, 0, -0.13, -0.37), 2) e - matrix(c(0.2, 0, -0.06, -0.34), 2) A1 - diag(2) + a %*% t(b) + cc A2 - -cc + d A3 - -d + e A4 - -e # I am vectorizing your function fn - function(z) { sapply(z, function(z) { y - diag(2) - A1*z - A2*z^2 - A3*z^3 - A4*z^4 det(y) }) } x - seq(-5, 5, length=9) # note we need 9 points to exactly determine a 8-th degree polynomial y - fn(x) p - poly.calc(x, y) # uses Lagrange interpolation to determine polynomial form p 1 - 1.18*x + 0.2777*x^2 - 0.2941*x^3 - 0.1004*x^4 + 0.3664*x^5 - 0.0636*x^6 + 0.062*x^7 - 0.068*x^8 # plot showing that p is the exact polynomial representation of fn(z) pfunc - as.function(p) x1 -seq(-5, 5, length=100) plot(x1, fn(x1),type=l) lines(x1, pfunc(x1), col=2, lty=2) solve(p) # gives you the roots (some are, of course, complex) Hope this helps, Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: RON70 ron_michae...@yahoo.com Date: Sunday, January 11, 2009 1:05 am Subject: [R] How to get solution of following polynomial? To: r-help@r-project.org Hi, I want find all roots for the following polynomial : a - c(-0.07, 0.17); b - c(1, -4); cc - matrix(c(0.24, 0.00, -0.08, -0.31), 2); d - matrix(c(0, 0, -0.13, -0.37), 2); e - matrix(c(0.2, 0, -0.06, -0.34), 2) A1 - diag(2) + a %*% t(b) + cc; A2 - -cc + d; A3 - -d + e; A4 - -e fn - function(z) { y - diag(2) - A1*z - A2*z^2 - A3*z^3 - A4*z^4 return(det(y)) }; uniroot(fn, c(-10, 1)) Using uniroot function, I got only one solution of that. Is there any function to get all four solutions? I looked at polyroot() function, but I do not think it will work for my problem, because, my coef. are matrix, nor number Thanks -- View this message in context: Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/How-to-get-solution-of-following-polynomial--tp21396441p21406350.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How to get solution of following polynomial?
Hi, I want find all roots for the following polynomial : a - c(-0.07, 0.17); b - c(1, -4); cc - matrix(c(0.24, 0.00, -0.08, -0.31), 2); d - matrix(c(0, 0, -0.13, -0.37), 2); e - matrix(c(0.2, 0, -0.06, -0.34), 2) A1 - diag(2) + a %*% t(b) + cc; A2 - -cc + d; A3 - -d + e; A4 - -e fn - function(z) { y - diag(2) - A1*z - A2*z^2 - A3*z^3 - A4*z^4 return(det(y)) }; uniroot(fn, c(-10, 1)) Using uniroot function, I got only one solution of that. Is there any function to get all four solutions? I looked at polyroot() function, but I do not think it will work for my problem, because, my coef. are matrix, nor number Thanks -- View this message in context: http://www.nabble.com/How-to-get-solution-of-following-polynomial--tp21396441p21396441.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading data from Economagic
Thanks Gabor for your reply. However it seems that data is not downloaded properly. Please take a look on downloaded data : tail(dat2, 20) GMT libor/day-ussnon 2008-11-25 0.93125 2008-11-26 0.98750 2008-11-28 NA 2008-12-01 1.08750 2008-12-02 NA 2008-12-03 0.88125 2008-12-04 0.51875 2008-12-05 NA 2008-12-08 0.18625 2008-12-09 NA 2008-12-10 NA 2008-12-11 NA 2008-12-12 0.11875 2008-12-15 0.11938 2008-12-16 NA 2008-12-17 0.13250 2008-12-18 NA 2008-12-19 0.11000 2008-12-22 NA 2008-12-23 0.11750 Data for 2008-12-22 is given as NA, whereas in the website it is 0·11375. Does anyone have a better idea on how to download data from Economagic more efficiently? Gabor Grothendieck wrote: Try this (last line only needed if you want times as Date class): library(zoo) z - zoo(as.matrix(dat2), time(dat2)) time(z) - as.Date(time(z)) # optional or you can use as.zoo.timeSeries from the devel version of zoo: source(http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/as.zoo.R?rev=557root=zoo;) z - as.zoo(dat2) time(z) - as.Date(time(z)) # optional On Tue, Dec 30, 2008 at 6:25 AM, RON70 ron_michae...@yahoo.com wrote: Oh my mistake, I missed the argument nDaysBack = 366. However pls let me know how to change the data to zoo object. RON70 wrote: I was trying to dw data from Economagic [http://www.economagic.com/em-cgi/data.exe/libor/day-ussnon], using following code : library(fimport) dat2 = economagicSeries(libor/day-ussnon, frequency = daily) Here I see that data is not complete, downloaded data starts from 2007-12-31 , whereas actual data is available from 2001. secondly, how I convert that data to a Zoo-object? -- View this message in context: http://www.nabble.com/Downloading-data-from-Economagic-tp21215913p21215929.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Downloading-data-from-Economagic-tp21215913p21239643.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Downloading data from Economagic
I was trying to dw data from Economagic [http://www.economagic.com/em-cgi/data.exe/libor/day-ussnon], using following code : library(fimport) dat2 = economagicSeries(libor/day-ussnon, frequency = daily) Here I see that data is not complete, downloaded data starts from 2007-12-31 , whereas actual data is available from 2001. secondly, how I convert that data to a Zoo-object? -- View this message in context: http://www.nabble.com/Downloading-data-from-Economagic-tp21215913p21215913.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading data from Economagic
Oh my mistake, I missed the argument nDaysBack = 366. However pls let me know how to change the data to zoo object. RON70 wrote: I was trying to dw data from Economagic [http://www.economagic.com/em-cgi/data.exe/libor/day-ussnon], using following code : library(fimport) dat2 = economagicSeries(libor/day-ussnon, frequency = daily) Here I see that data is not complete, downloaded data starts from 2007-12-31 , whereas actual data is available from 2001. secondly, how I convert that data to a Zoo-object? -- View this message in context: http://www.nabble.com/Downloading-data-from-Economagic-tp21215913p21215929.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading data from Economagic
Still it seems that it is not downloading data properly. For example observation for date 2008-12-09 is missing : tail(dat2, 30) 2008-10-02 2008-10-06 2008-10-08 2008-10-16 2008-10-20 2008-10-21 2008-10-22 2008-10-24 2008-10-27 2008-10-29 2008-10-30 2.681252.368755.375001.937501.512501.281251.11875 1.281251.268751.140000.73125 2008-10-31 2008-11-07 2008-11-10 2008-11-12 2008-11-13 2008-11-14 2008-11-17 2008-11-18 2008-11-19 2008-11-20 2008-11-24 0.406250.331250.350000.382500.40.412500.4 0.40.437500.443750.80625 2008-11-25 2008-11-26 2008-12-08 2008-12-10 2008-12-11 2008-12-12 2008-12-15 2008-12-16 0.931250.987500.186250.125000.115000.118750.11938 0.15938 Can anyone please tell me whether I missing something? RON70 wrote: I was trying to dw data from Economagic [http://www.economagic.com/em-cgi/data.exe/libor/day-ussnon], using following code : library(fimport) dat2 = economagicSeries(libor/day-ussnon, frequency = daily) Here I see that data is not complete, downloaded data starts from 2007-12-31 , whereas actual data is available from 2001. secondly, how I convert that data to a Zoo-object? -- View this message in context: http://www.nabble.com/Downloading-data-from-Economagic-tp21215913p21216192.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] R function to calculate number of data points of each level
I have a dataframe with two columns : 11600 238'4 12000 218'0 12200 209'0 12600 192'0 13000 176'4 14000 145'0 15000 119'0 16000 103'0 1800080'0 1900068'3 2 59'0 11600 208'1 12000 189'2 12200 180'3 There are repeatations in 1st column and I want to use this as Level. Next I want to report for each level how many data points are there, with corresponding Level number. Is there any direct R function? -- View this message in context: http://www.nabble.com/R-function-to-calculate-number-of-data-points-of-each-level-tp21051649p21051649.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sorting a date vector
Yes you are right. However using that code, format of date is altered. I need to main same format as the input data i.e. 10-02-2008 not 2008-10-02, still having date-class. Any better idea? David Winsemius wrote: You might want to look at your date format more closely. Both the separator and the year format specs fail to match your input. as.Date(10-02-2008, format = %m/%d/%y) [1] NA as.Date(10-02-2008, format = %m-%d-%Y) [1] 2008-10-02 -- David Winsemius On Dec 16, 2008, at 7:54 AM, RON70 wrote: I have a date-like-vector like : date_file 10-02-2008 10-03-2008 10-06-2008 10-07-2008 10-09-2008 10-10-2008 10-13-2008 10-14-2008 10-15-2008 10-16-2008 10-17-2008 10-20-2008 10-21-2008 10-22-2008 10-23-2008 10-24-2008 10-28-2008 10-29-2008 10-30-2008 10-31-2008 11-03-2008 11-04-2008 11-05-2008 11-06-2008 11-07-2008 11-10-2008 11-11-2008 11-12-2008 11-13-2008 11-14-2008 11-17-2008 11-18-2008 11-19-2008 11-20-2008 11-21-2008 11-24-2008 11-25-2008 11-26-2008 11-28-2008 12-01-2008 12-02-2008 12-03-2008 12-04-2008 12-05-2008 12-08-2008 12-09-2008 12-10-2008 12-11-2008 12-12-2008 12-15-2008 4-18-2008 4-21-2008 4-22-2008 4-23-2008 4-24-2008 4-28-2008 4-29-2008 5-01-2008 5-05-2008 5-06-2008 5-07-2008 5-09-2008 5-12-2008 5-13-2008 5-14-2008 5-15-2008 5-16-2008 5-19-2008 5-20-2008 5-21-2008 5-22-2008 5-23-2008 5-27-2008 5-28-2008 5-29-2008 5-30-2008 6-02-2008 6-03-2008 6-05-2008 6-06-2008 6-09-2008 6-10-2008 6-11-2008 6-12-2008 6-13-2008 6-17-2008 6-18-2008 6-19-2008 6-20-2008 6-23-2008 6-24-2008 6-25-2008 6-26-2008 6-27-2008 7-01-2008 7-02-2008 7-04-2008 7-07-2008 7-08-2008 7-09-2008 7-10-2008 7-11-2008 7-15-2008 7-16-2008 7-18-2008 7-21-2008 7-22-2008 7-23-2008 7-24-2008 7-25-2008 7-28-2008 7-30-2008 7-31-2008 8-01-2008 8-04-2008 8-05-2008 8-06-2008 8-07-2008 8-08-2008 8-11-2008 8-12-2008 8-13-2008 8-15-2008 8-18-2008 8-19-2008 8-20-2008 8-21-2008 8-22-2008 8-25-2008 8-26-2008 8-27-2008 8-28-2008 8-29-2008 9-03-2008 9-04-2008 9-05-2008 9-08-2008 9-09-2008 9-10-2008 9-11-2008 9-12-2008 9-15-2008 9-16-2008 9-17-2008 9-18-2008 9-19-2008 9-22-2008 9-23-2008 9-24-2008 9-25-2008 9-26-2008 9-29-2008 9-30-2008 I wanted to sort this in ascending order. I tried using simply sort() function, without altering the format of date, but it didnot work. Next I tried to convert that vector in a date-class vector so that, I could sort them but in vein :( I used : as.Date(date_file, format=%m/%d/%y) However it did not work. Can anyone please tell me what would be correct approach? -- View this message in context: http://www.nabble.com/Sorting-a-date-vector-tp21032540p21032540.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Sorting-a-date-vector-tp21032540p21032997.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] Sorting a date vector
I have a date-like-vector like : date_file 10-02-2008 10-03-2008 10-06-2008 10-07-2008 10-09-2008 10-10-2008 10-13-2008 10-14-2008 10-15-2008 10-16-2008 10-17-2008 10-20-2008 10-21-2008 10-22-2008 10-23-2008 10-24-2008 10-28-2008 10-29-2008 10-30-2008 10-31-2008 11-03-2008 11-04-2008 11-05-2008 11-06-2008 11-07-2008 11-10-2008 11-11-2008 11-12-2008 11-13-2008 11-14-2008 11-17-2008 11-18-2008 11-19-2008 11-20-2008 11-21-2008 11-24-2008 11-25-2008 11-26-2008 11-28-2008 12-01-2008 12-02-2008 12-03-2008 12-04-2008 12-05-2008 12-08-2008 12-09-2008 12-10-2008 12-11-2008 12-12-2008 12-15-2008 4-18-2008 4-21-2008 4-22-2008 4-23-2008 4-24-2008 4-28-2008 4-29-2008 5-01-2008 5-05-2008 5-06-2008 5-07-2008 5-09-2008 5-12-2008 5-13-2008 5-14-2008 5-15-2008 5-16-2008 5-19-2008 5-20-2008 5-21-2008 5-22-2008 5-23-2008 5-27-2008 5-28-2008 5-29-2008 5-30-2008 6-02-2008 6-03-2008 6-05-2008 6-06-2008 6-09-2008 6-10-2008 6-11-2008 6-12-2008 6-13-2008 6-17-2008 6-18-2008 6-19-2008 6-20-2008 6-23-2008 6-24-2008 6-25-2008 6-26-2008 6-27-2008 7-01-2008 7-02-2008 7-04-2008 7-07-2008 7-08-2008 7-09-2008 7-10-2008 7-11-2008 7-15-2008 7-16-2008 7-18-2008 7-21-2008 7-22-2008 7-23-2008 7-24-2008 7-25-2008 7-28-2008 7-30-2008 7-31-2008 8-01-2008 8-04-2008 8-05-2008 8-06-2008 8-07-2008 8-08-2008 8-11-2008 8-12-2008 8-13-2008 8-15-2008 8-18-2008 8-19-2008 8-20-2008 8-21-2008 8-22-2008 8-25-2008 8-26-2008 8-27-2008 8-28-2008 8-29-2008 9-03-2008 9-04-2008 9-05-2008 9-08-2008 9-09-2008 9-10-2008 9-11-2008 9-12-2008 9-15-2008 9-16-2008 9-17-2008 9-18-2008 9-19-2008 9-22-2008 9-23-2008 9-24-2008 9-25-2008 9-26-2008 9-29-2008 9-30-2008 I wanted to sort this in ascending order. I tried using simply sort() function, without altering the format of date, but it didnot work. Next I tried to convert that vector in a date-class vector so that, I could sort them but in vein :( I used : as.Date(date_file, format=%m/%d/%y) However it did not work. Can anyone please tell me what would be correct approach? -- View this message in context: http://www.nabble.com/Sorting-a-date-vector-tp21032540p21032540.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Seasonality in time series
using decompose() function how can I get only seasonally adjusted series? GR-13 wrote: Here's something that may help you get started: library(ts) ?decompose ?stl Thanks, -Girish On Dec 5, 1:55 pm, Matthias [EMAIL PROTECTED] wrote: Hi, I?m looking for a package which includes a test for seasonality in time series. Any help and input would be greatly appreciated. Thanks, Matthias __ [EMAIL PROTECTED] mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Seasonality-in-time-series-tp20850418p20867951.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to solve following equation?
Thanks for this reply, However I am interested to know why I need to modify my function to a=1? Regards, Gabor Grothendieck wrote: Assume a = 1. If not set b = b/a, etc. Now use (1) uniroot f - function(x) b + c/(1+x) + d/(1+x)^2 - 1 - x uniroot(f, 0:1) $root [1] 0.8392679 $f.root [1] 3.049818e-05 $iter [1] 3 $estim.prec [1] 6.103516e-05 or multiply through by 1+x and subtract 1 from both sides giving x = b + c/(1+x) + d/(1+x)^2 - 1 and iterate that. a - b - c - d - 1 x - 0 for(i in 1:25) { + x - b + c/(1+x) + d/(1+x)^2 - 1 + print(x) + } [1] 2 [1] 0.444 [1] 1.171598 [1] 0.6725419 [1] 0.9553676 [1] 0.7729558 [1] 0.8821595 [1] 0.8135892 [1] 0.8554268 [1] 0.829437 [1] 0.8454056 [1] 0.835527 [1] 0.8416126 [1] 0.837854 [1] 0.8401717 [1] 0.838741 [1] 0.8396236 [1] 0.839079 [1] 0.839415 [1] 0.8392076 [1] 0.8393356 [1] 0.8392566 [1] 0.8393053 [1] 0.8392753 [1] 0.8392938 On Mon, Dec 1, 2008 at 9:47 PM, RON70 [EMAIL PROTECTED] wrote: I need to solve a equation like this : a = b/(1+x) + c/(1+x)^2 + d/(1+x)^3 where a,b,c,d are known constant. Is there any R-way to do that? Thanks in advance -- View this message in context: http://www.nabble.com/How-to-solve-following-equation--tp20785063p20785063.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code. __ 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.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/How-to-solve-following-equation--tp20785063p20817656.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How to solve following equation?
I need to solve a equation like this : a = b/(1+x) + c/(1+x)^2 + d/(1+x)^3 where a,b,c,d are known constant. Is there any R-way to do that? Thanks in advance -- View this message in context: http://www.nabble.com/How-to-solve-following-equation--tp20785063p20785063.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How to draw following plot in R?
I want to draw following plot, given here http://www.2shared.com/file/4327128/830b82c4/pic.html for the following data : dat - cbind(rnorm(100), sample(c(1:4), 1000, T)) colnames(dat) - c(data,level) Here x-axis should be on data and y-axis is for level and z-axis should be to display the frequency of data for a particular level Is there any R code(s) to doing that? -- View this message in context: http://www.nabble.com/How-to-draw-following-plot-in-R--tp20635099p20635099.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How to Clear all variables stored in current and previous sessions
Is there any function in R to clear values from all variables stored in current and previous sessions? R site search do not give the desired result at all, all results are about to clear screen only not variables. Thanks, -- View this message in context: http://www.nabble.com/How-to-Clear-all-variables-stored-in-current-and-previous-sessions-tp20604724p20604724.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Stat related] Understanding Portmanteau test
Still waiting for some input. Did my question void forum rule in any manner? RON70 wrote: Sorry to be off-topic. Can somebody please explain me what is Portmanteau test? Why it's name is like that? When I would say, a particular test is portmanteau test? I did some googling but got no satisfactory answer at all. Please anybody help for understanding that? Regards, -- View this message in context: http://www.nabble.com/-Stat-related--Understanding-Portmanteau-test-tp20393010p20403766.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] [Stat related] Understanding Portmanteau test
Sorry to be off-topic. Can somebody please explain me what is Portmanteau test? Why it's name is like that? When I would say, a particular test is portmanteau test? I did some googling but got no satisfactory answer at all. Please anybody help for understanding that? Regards, -- View this message in context: http://www.nabble.com/-Stat-related--Understanding-Portmanteau-test-tp20393010p20393010.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How to extract following data
Hi everyone, I have this kind of raw dataset : - Temp diffgr:id=Temp14 msdata:rowOrder=13 Date2005-01-17T00:00:00+05:30/Date SecurityID10149/SecurityID PriceClose1288.40002/PriceClose /Temp - Temp diffgr:id=Temp15 msdata:rowOrder=14 Date2005-01-18T00:00:00+05:30/Date SecurityID10149/SecurityID PriceClose1291.69995/PriceClose /Temp - Temp diffgr:id=Temp16 msdata:rowOrder=15 Date2005-01-19T00:00:00+05:30/Date SecurityID10149/SecurityID PriceClose1288.19995/PriceClose /Temp I was looking for some R procedure to extract data from this, that should be in following format : 2005-01-17 1288.40002 2005-01-18 1291.69995 2005-01-19 1288.19995 Can R help me to do this? -- View this message in context: http://www.nabble.com/How-to-extract-following-data-tp20336690p20336690.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
[R] How R calculate p-value ?
I am wondering how R calculate p-value for a test. Does R do some Approximate integration on the p.d.f of null distribution? How I can see the code for this particular calculation? Your help will be highly appreciated. Regards, -- View this message in context: http://www.nabble.com/How-R-calculate-p-value---tp20278048p20278048.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How R calculate p-value ?
Still no reply. Is my question not understandable at all? RON70 wrote: I am wondering how R calculate p-value for a test. Does R do some Approximate integration on the p.d.f of null distribution? How I can see the code for this particular calculation? Your help will be highly appreciated. Regards, -- View this message in context: http://www.nabble.com/How-R-calculate-p-value---tp20278048p20284366.html Sent from the R help mailing list archive at Nabble.com. __ 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.html and provide commented, minimal, self-contained, reproducible code.