[R] Determine restricted variable in SVAR and SVEC?
How to determine restricted variable in SVAR and SVEC? There are some values which set to be zero and others set to be NA.. How to determine values that set to be 0? Thanks Regards, Arif _ Facebook. k-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-id:SI_SB_2:092009 [[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.
Re: [R] Plot nls line on plot?
Hi Doug, you can add the fitted curve using the following general paradigm: ## Plotting the data plot(p~z) ## Defining grid of z values ## (100 values ensures a smooth curve in your case) zValues - seq(min(z), max(z), length.out = 100) ## Adding predicted values corresponding to the grid values lines(zVal, predict(fit, data.frame(z = zValues))) Christian __ 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] problem with CPU usage
Hi all, I have a problem with CPU usage while running the Rgui.exe problem is while I am running scripts on Rgui its taking 100% of CPU is there any posibility to reduce the cpu consumption are any package I can use to reduce CPU consumption can any one help me out from this problem because while running these scripts I am not able to do any other work and there is no recursive functions and all loops are ending properly Thanks in advance kiran [[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.
Re: [R] Parameters of Beta distribution
In article 5df5755d-a376-439a-b7f2-9901441db...@comcast.net, dwinsem...@comcast.net says... In insurance situation there is typically a cap on the covered losses and there is also typically an amount below which it would not make sense to offer a policy. So a minimum and a maximum are sensible assumptions about loss distributions in may real modeling situations. But a continuous distribution would then not be a reasonable distribution. More precisely, one would typically have a mixture of a continuous and a discrete distribution, with some point probability mass at the max. -- Karl Ove Hufthammer __ 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] Substituting the extracted coefficients into the formula, exctracted from the result of nls()
Dear all, Here I come with another stupid question. Suppose I want to use nls() to fit a series of data (here modelled by generated points), then plot the points and the fitting curve. I figured out some way of doing it: x - runif(1:20, 0, 10) y - 0.1*x^2 - rep(3, length(x)) + rnorm(length(x), sd = 0.5) yfit - nls(y ~ a*x^2 + b*x + c, start = list(a = 1, b = 1, c = 1), trace = TRUE) plot(x, y) curve(coef(yfit)[1]*x^2 + coef(yfit)[2]*x + coef(yfit)[3], 0, 10, add = TRUE) However, this code is rather fortranesque, and most likely there exists a much more elegant way in R/S, something like abline() which exists for straight lines. Since both the formula and the coefficients are available as a result of nls() (here as formula(yfit) and coef(yfit)), I thought there ought to be a way something along the following lines: f - substitute(formula(yfit), as.list(coef(yfit))) curve(f, ...) However, this snippet of code doesn't work. Am I thinking into the correct direction at all? Thanks in advance. All the best, Primož -- Primož Peterlin, Inštitut za biofiziko, Med. fakulteta, Univerza v Ljubljani Lipičeva 2, SI-1000 Ljubljana, Slovenija.primoz.peter...@mf.uni-lj.si Tel +386-1-5437612, fax +386-1-4315127, http://biofiz.mf.uni-lj.si/~peterlin/ F8021D69 OpenPGP fingerprint: CB 6F F1 EE D9 67 E0 2F 0B 59 AF 0D 79 56 19 0F __ 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] about function *lapply*
On 09/10/2009 12:42 AM, guangchuang yu wrote: I used *lapply* and *for* to call the function *GetC* respectively. The output is different!!! I can't figured out how this happen! It's so wierd. x=lapply(ipi.go,GetC, ont = BP, org=cell.cycle) unlist(x) *IPI00011654 IPI00013683 cell cycle cell cycle* categorate=list() for (i in 1:length(ipi.go)) { + x = GetC(ipi.go[i], ont=BP, org=cell.cycle) lapply will apply the function to ipi.go[[i]], not ipi.go[i]. Duncan Murdoch + x - list(x) + names(x) - names(ipi.go[i]) + categorate - c(categorate, x) + } unlist(categorate) *IPI3865 IPI00011654 IPI00013475 IPI00013683 cell cycle cell cycle cell cycle cell cycle * __ 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] error message - unexpected input
On 10/09/2009 07:15 AM, David Winsemius wrote: On Oct 8, 2009, at 3:28 PM, Danielle Dandreaux wrote: ... The syntax line that appears to be causing problems is: dataname=Igt2model.txt and the error message is: Error: unexpected input in dataname= Hi Danielle, This sort of error often occurs when the line is a continuation and there is something like a trailing comma missing on the previous line. Jim __ 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] Bringing dbf Data With SQL
On 10/09/2009 07:17 AM, Michael Yutzi wrote: I have a heavy DATA saved in dbf format. What I want is to bring that data to R with SQL statements. Like: I want columns 1, 4, 5 and only when column 4 30. Sorry asking it here instead of keep searching in manuals, but it seems that there are too many ways of doing it. So what's the appropriate package that I need to work it, considering also that im dealing with lots of gigas so the faster way, better. I would really appreciate helps Thanks since now Hi Michael, Let's say your table is named lotsadata and the attributes are labeled one, two and so on. Does: SELECT one four five FROM lotsadata WHERE four30. do what you want? Jim __ 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] problem with CPU usage
Hi, If you work on Windows you can reduce the priority of the Rgui.exe process. You can do this in the task manager, right click Priority. cheers, Paul venkata kirankumar wrote: Hi all, I have a problem with CPU usage while running the Rgui.exe problem is while I am running scripts on Rgui its taking 100% of CPU is there any posibility to reduce the cpu consumption are any package I can use to reduce CPU consumption can any one help me out from this problem because while running these scripts I am not able to do any other work and there is no recursive functions and all loops are ending properly Thanks in advance kiran [[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. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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] Creating a Clustered-Stacked Column Chart
Hi all, In R, is there some functions or ways to create a Clustered-Stacked Column Chart as the example in the following page http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html? I have browsed the R Graph Gallery (http://addictedtor.free.fr/graphiques/) and searched the R site, and didnot find an appropriate method to do it. Anybody has met this problem before? Thanks a lot. [[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] Trendline for a subset of data
Dear all, I am using abline(lm ...) to insert a linear trendline through a portion of my data (e.g. dataset[,36:45]). However, I am finding that whilst the trendline is correctly displayed and representative of the data portion I've chosen, the line continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. How do I display the line so that it only runs between point 36 and 45 (as shown in the example above) as doesn't continue to display a line throughout the rest of the plot space? Many thanks, Steve _ View your other email accounts from your Hotmail inbox. Add them now. http://clk.atdmt.com/UKM/go/167688463/direct/01/ __ 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] Get subset of n dimensional matrix
I want to select a subset of an array, but I want to make a function so that it can handle any number of dimensions. This is probably best described with an example x - 1:100 dim(x) - c(10,10) x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]1 11 21 31 41 51 61 71 8191 [2,]2 12 22 32 42 52 62 72 8292 [3,]3 13 23 33 43 53 63 73 8393 [4,]4 14 24 34 44 54 64 74 8494 [5,]5 15 25 35 45 55 65 75 8595 [6,]6 16 26 36 46 56 66 76 8696 [7,]7 17 27 37 47 57 67 77 8797 [8,]8 18 28 38 48 58 68 78 8898 [9,]9 19 29 39 49 59 69 79 8999 [10,] 10 20 30 40 50 60 70 80 90 100 vList - vector(list, 2) vList[[1]] - c(4:6) vList[[2]] - c(4:6) x[vList[[1]],vList[[2]]] [,1] [,2] [,3] [1,] 34 44 54 [2,] 35 45 55 [3,] 36 46 56 but if: x - 1:1000 dim(x) - c(10,10,10) I would would have to increase the returning call: x[vList[[1]],vList[[2]],vList[[3]]] What I would like to be able to do is pass x the list of lists and have it return the required points. Anyone have any clues on how to get over this hurdle? Thank you Mark [[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.
Re: [R] I can not install DAAG package . help
Hello David, seems there's sth wrong with my R. I used to start R with Emacs+ESS, so i didn't find the error message till today i ran R in an terminal : si...@simon-t400:~$ R R version 2.9.2 (2009-08-24) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. Warning: you have multiple copies of the following packages: Error: could not find function installed.packages [Previously saved workspace restored] And then i run installed.packages(), get a lot of information flushing on my terminal so what should i do about it ? thanks On Thu, Oct 8, 2009 at 8:53 PM, David Winsemius dwinsem...@comcast.netwrote: On Oct 8, 2009, at 4:27 AM, Yanyuan Zhu wrote: I use R on my Ubuntu 9.04 laptop, which was installed by aptitude install way The is an R-SIG-Debian which is going to have more people with knowledge of your particular OS. Now i'm learning a book of R which needs MASS and DAAG installed. So i followed the instructions: install.packages(MASS) library(MASS) MASS works fine. But that doesn't tell you very much because MASS was part of the R distribution. So your hope to derive comfort is ill-conceived. But DAAG doesn't. Anyone who could help would be appreciated a lot ! Below are my error outpus : install.packages(DAAG) Warning in install.packages(DAAG) : argument 'lib' is missing: using '/home/simon/R/i486-pc-linux-gnu-library/2.9' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done also installing the dependency ârandomForestâ trying URL ' http://ftp.ctex.org/mirrors/CRAN/src/contrib/randomForest_4.5-30.tar.gz' Content type 'application/x-gzip' length 70247 bytes (68 Kb) opened URL == downloaded 68 Kb trying URL 'http://ftp.ctex.org/mirrors/CRAN/src/contrib/DAAG_1.00.tar.gz ' Content type 'application/x-gzip' length 2172778 bytes (2.1 Mb) opened URL == downloaded 2.1 Mb Warning: you have multiple copies of the following packages: Error: could not find function installed.packages Execution halted Is it really true that the interpreter cannot find that function? That would be pretty unusual and would suggest your copy of R was broken. What do you get with: installed.packages() On my system the list is very long but on yours it should be considerably shorter. Warning: you have multiple copies of the following packages: Error: could not find function installed.packages Execution halted The downloaded packages are in â/tmp/Rtmp7w4WPA/downloaded_packagesâ Warning messages: 1: In install.packages(DAAG) : installation of package 'randomForest' had non-zero exit status 2: In install.packages(DAAG) : installation of package 'DAAG' had non-zero exit status library(DAAG) Error in library(DAAG) : there is no package called 'DAAG' -- --- Yanyuan Zhu Doctoral Candidate School of Economics Management, Tongji University David Winsemius, MD Heritage Laboratories West Hartford, CT -- --- Yanyuan Zhu Doctoral Candidate School of Economics Management, Tongji University MSN messenger:caoanroad4...@hotmail.commessenger%3acaoanroad4...@hotmail.com E-mail: caoanroad4...@gmail.com BLOG http://yyzhu.net [[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.
Re: [R] I can not install DAAG package . help
Hello joris, when i type the command: ?installed.packages seems it works fine and shows me the man page of install.packages() Then i followed ur instructions by first removing DAAG remove.packages(DAAG) Warning in remove.packages(DAAG) : argument 'lib' is missing: using /home/simon/R/i486-pc-linux-gnu-library/2.9 Error in .find.package(pkgs, lib) : there is no package called 'DAAG' Then i try to install randomForest first install.packages(randomForest) Warning in install.packages(randomForest) : argument 'lib' is missing: using '/home/simon/R/i486-pc-linux-gnu-library/2.9' trying URL ' http://ftp.ctex.org/mirrors/CRAN/src/contrib/randomForest_4.5-30.tar.gz' Content type 'application/x-gzip' length 70247 bytes (68 Kb) opened URL == downloaded 68 Kb Warning: you have multiple copies of the following packages: Error: could not find function installed.packages Execution halted The downloaded packages are in â/tmp/Rtmppr7kcy/downloaded_packagesâ Warning message: In install.packages(randomForest) : installation of package 'randomForest' had non-zero exit status so what should i do ? thanks -- Forwarded message -- From: joris meys jorism...@gmail.com Date: Thu, Oct 8, 2009 at 8:25 PM Subject: Re: [R] I can not install DAAG package . help To: Yanyuan Zhu caoanroad4...@gmail.com Cc: r-help@r-project.org Quite a strange error. The function installed.packages should be in the utils package. Try ?installed.packages and see if you get a help file. If it doesn't find that function, there is a problem with your R installation. It might be something went wrong with downloading the package itself. DAAG is 2.6 Mb at my computer. Remove DAAG by remove.packages(DAAG) Check whether randomForest is installed. If so, remove that one as well. Now install randomForest first, and then DAAG. If this doesn't work, post the log and error message again. Kind regards Joris On Thu, Oct 8, 2009 at 10:27 AM, Yanyuan Zhu caoanroad4...@gmail.com wrote: I use R on my Ubuntu 9.04 laptop, which was installed by aptitude install way Now i'm learning a book of R which needs MASS and DAAG installed. So i followed the instructions: install.packages(MASS) library(MASS) MASS works fine. But DAAG doesn't. Anyone who could help would be appreciated a lot ! Below are my error outpus : install.packages(DAAG) Warning in install.packages(DAAG) : argument 'lib' is missing: using '/home/simon/R/i486-pc-linux-gnu-library/2.9' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done also installing the dependency ârandomForestâ trying URL ' http://ftp.ctex.org/mirrors/CRAN/src/contrib/randomForest_4.5-30.tar.gz' Content type 'application/x-gzip' length 70247 bytes (68 Kb) opened URL == downloaded 68 Kb trying URL 'http://ftp.ctex.org/mirrors/CRAN/src/contrib/DAAG_1.00.tar.gz' Content type 'application/x-gzip' length 2172778 bytes (2.1 Mb) opened URL == downloaded 2.1 Mb Warning: you have multiple copies of the following packages: Error: could not find function installed.packages Execution halted Warning: you have multiple copies of the following packages: Error: could not find function installed.packages Execution halted The downloaded packages are in â/tmp/Rtmp7w4WPA/downloaded_packagesâ Warning messages: 1: In install.packages(DAAG) : installation of package 'randomForest' had non-zero exit status 2: In install.packages(DAAG) : installation of package 'DAAG' had non-zero exit status library(DAAG) Error in library(DAAG) : there is no package called 'DAAG' -- --- Yanyuan Zhu Doctoral Candidate School of Economics Management, Tongji University MSN messenger:caoanroad4...@hotmail.commessenger%3acaoanroad4...@hotmail.com messenger%3acaoanroad4...@hotmail.commessenger%253acaoanroad4...@hotmail.com E-mail: caoanroad4...@gmail.com BLOG http://yyzhu.net [[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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- --- Yanyuan Zhu Doctoral Candidate School of Economics Management, Tongji University MSN messenger:caoanroad4...@hotmail.commessenger%3acaoanroad4...@hotmail.com E-mail: caoanroad4...@gmail.com BLOG http://yyzhu.net [[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,
[R] svy / weighted regression
Dear list, I am trying to set up a propensity-weighted regression using the survey package. Most of my population is sampled with a sampling probability of one (that is, I have the full population). However, for a subset of the data I have only a 50% sample of the full population. In previous work on the data, I analyzed these data using SAS and STATA. In those packages I used a propensity weight of 1/[sampling probability] in various generalized linear regression-procedures, but I am having trouble setting this up. I bet the solution is simple, but I’m a R newbie. Code to illustrate my problem below. Thanks Laust # loading survey library(survey) # creating data listc - c(Denmark,Finland,Norway,Sweden,Denmark,Finland,Norway,Sweden) listw - c(1,2,1,1,1,1,1,1) listd - c(0,0,0,0,1000,1000,1000,2000) listt - c(75,50,90,190,5000,5000,5000,1) list.cwdt - c(listc, listw, listd, listt) country - data.frame(country=listc,weight=listw,deaths=listd,yrs_at_risk=listt) # running a frequency weighted regression to get the correct point estimates for comparison glm - glm(deaths ~ country + offset(log(yrs_at_risk)), weights=weight, data=country, family=poisson()) summary(glm) regTermTest(glm, ~ country) # running survey weighted regression svy - svydesign(~0,,data=country, weight=~weight) svyglm - svyglm(deaths ~ country + offset(log(yrs_at_risk)), design=svy, data=country, family=poisson()) summary(svyglm) # point estimates are correct, but standard error is way too large regTermTest(svyglm, ~ country) # test indicates no country differences __ 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] Naming objects in a list
Hello, I am trying to run a for-loop in which I want to add glm output objects sequentially into a list. I do not know how to give names to each object in a list. I tried this : List.glm - list() for(i in 1:n) list.glm - list(list.glm, glm(,,,)) but it is obviously unsuited… Best regards, Paulo -- View this message in context: http://www.nabble.com/Naming-objects-in-a-list-tp25819794p25819794.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] Naming objects in a list
A couple of ways: List.glm - list() for(i in 1:n) list.glm[[i]] -glm(,,,) OR List.glm - lapply(1:n, function(x) glm(,,,)) On Fri, Oct 9, 2009 at 7:54 AM, P.Branco pjlbra...@yahoo.com wrote: Hello, I am trying to run a for-loop in which I want to add glm output objects sequentially into a list. I do not know how to give names to each object in a list. I tried this : List.glm - list() for(i in 1:n) list.glm - list(list.glm, glm(,,,)) but it is obviously unsuited… Best regards, Paulo -- View this message in context: http://www.nabble.com/Naming-objects-in-a-list-tp25819794p25819794.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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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] About finding NA values sources
Dear All, In R, is there a way (or a function) I can quickly check whether all the NA values in one new created numerical variable happened are because of nbsp; or something else in the original dataset? And how can we easily group these NAs separately based on different reason (e.g. some NA are because of nbsp; , some are because of there are extra text inside, etc). Thanks heaps. Rene. [[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] QQ plot
Dear list I want to plot the QQ plot with some distributions like geometrical , lognormal and truncated normal with confidence bands. does this options available. Iam new to R. If you have any scripts and examples please kindly suggest me. thank you madan [[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.
Re: [R] Plot with CART results
-begin included message --- With rpart we can get several terminals and draw it in the TREE plot. Now I am trying to draw a plot like this: x-axis is each terminal's value, and y-axis is those observe values. Does anyone has idea what gramma should I use? Thanks in advance. -end -- It sounds like you want to plot predicted versus observed. fit - rpart(y ~ . plot(predict(fit), y) __ 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] Get subset of n dimensional matrix
Try this: x - array(1:1000, rep(10, 3)) vList - list(i = 4:6, j = 4:6, ... = 4:6) do.call('[', c(list(x), vList)) On Fri, Oct 9, 2009 at 7:18 AM, Mark McDowall markmcdowa...@googlemail.com wrote: I want to select a subset of an array, but I want to make a function so that it can handle any number of dimensions. This is probably best described with an example x - 1:100 dim(x) - c(10,10) x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1 11 21 31 41 51 61 71 81 91 [2,] 2 12 22 32 42 52 62 72 82 92 [3,] 3 13 23 33 43 53 63 73 83 93 [4,] 4 14 24 34 44 54 64 74 84 94 [5,] 5 15 25 35 45 55 65 75 85 95 [6,] 6 16 26 36 46 56 66 76 86 96 [7,] 7 17 27 37 47 57 67 77 87 97 [8,] 8 18 28 38 48 58 68 78 88 98 [9,] 9 19 29 39 49 59 69 79 89 99 [10,] 10 20 30 40 50 60 70 80 90 100 vList - vector(list, 2) vList[[1]] - c(4:6) vList[[2]] - c(4:6) x[vList[[1]],vList[[2]]] [,1] [,2] [,3] [1,] 34 44 54 [2,] 35 45 55 [3,] 36 46 56 but if: x - 1:1000 dim(x) - c(10,10,10) I would would have to increase the returning call: x[vList[[1]],vList[[2]],vList[[3]]] What I would like to be able to do is pass x the list of lists and have it return the required points. Anyone have any clues on how to get over this hurdle? Thank you Mark [[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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] Any reference to Tukeyline algorithm?
Hi, I am using line function to plot the line. And I would like to understand Tukeyline algorithm. Since, the line function is calling the Tukeyline algorithm(which is compiled code) using foreign function interface, I am not able to look into the source code of this algorithm. Can somebody help me out, so that I can refer the same. Thanks in advance!!! Thanks, Shanmukh. Try the new Yahoo! India Homepage. Click here. http://in.yahoo.com/trynew [[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.
Re: [R] Trendline for a subset of data
On Oct 9, 2009, at 5:50 AM, Steve Murray wrote: Dear all, I am using abline(lm ...) to insert a linear trendline through a portion of my data (e.g. dataset[,36:45]). However, I am finding that whilst the trendline is correctly displayed and representative of the data portion I've chosen, the line continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. How do I display the line so that it only runs between point 36 and 45 (as shown in the example above) as doesn't continue to display a line throughout the rest of the plot space? ?segments Many thanks, Steve 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.
[R] celebrating revision 50000
Hello, Today, Brian Ripley commited the revision 5 of R's svn repository. I took this as an opportunity to do some data analysis of the log and posted some code and graphics on my blog: http://romainfrancois.blog.free.fr/index.php?post/2009/10/09/celebrating-R-commit-5 The plots of the number of commits per day (and per month) indicates a peak in 2002. Here are the top 20 modified files : most.updated - head( sort( table( data$file ), decreasing=TRUE ), 20 ) cat( sprintf( %40s: %6d, names(most.updated), most.updated ), sep =\n ) /trunk/NEWS:5449 /trunk/date-stamp:2219 /trunk/BUGS:1485 /trunk/src/gnuwin32/CHANGES: 994 /trunk/configure: 979 /trunk/doc/manual/R-FAQ.texi: 948 /trunk/doc/manual/R-exts.texi: 814 /trunk/doc/manual/R-admin.texi: 666 /trunk/src/main/names.c: 634 /trunk/tests/reg-tests-1.R: 621 /trunk/src/gnuwin32/Makefile: 542 /trunk/FAQ: 471 /trunk/doc/html/faq.html: 458 /trunk/src/include/Defn.h: 455 /trunk/configure.ac: 447 /trunk/src/scripts/check.in: 433 /trunk/src/library/tools/R/QC.R: 397 /branches/unlabeled-1.1139.4/date-stamp: 386 /trunk/src/main/connections.c: 349 /trunk/src/main/plot.c: 325 The most modified file extensions (the second element indicates files without extensions) : head( sort( table( data$extension ), decreasing=T ) , 24 ) Rd cR po in moh 3676633999298492522110215 8806 6280 6147 texi gmo html save potf win m4 5274 3705 1920 1668 1285 1148 1060 1041 pl ac afm pm macy packages sh 910 527 482 461 402 384 311 215 The number of commits per author : sort( table( simple$author ), decreasing=T ) ripleymaechler hornik pd murdoch iacus 20523 10207674446551370 915 leisch jmcluke ihaka murrell bates 743 643 618 481 379 350 rgentlem tlumleyurbaneks (no author) duncan r 299 274 274 203 172 96 thomas lyndonpaul guido martyn plummer 63 54 48 39 39 26 deepayan falconmike 20 18 1 Many thanks to the R core team for these 50 000 commits. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/BcPw : celebrating R commit #5 |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc `- http://tr.im/yw8E : New R package : sos __ 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] Substituting the extracted coefficients into the formula, exctracted from the result of nls()
If you want curve with substitute(...), you can try something about like this: f - eval(parse(text = paste(substitute(, formula(yfit)[3], , as.list(coef(yfit))), sep = ))) curve(f, ...) 2009/10/9 Henrique Dallazuanna www...@gmail.com: Try with predict: plot(x, y) lines(0:10, predict(yfit, list(x = 0:10))) 2009/10/9 Primoz PETERLIN primozz.peter...@gmail.com: Dear all, Here I come with another stupid question. Suppose I want to use nls() to fit a series of data (here modelled by generated points), then plot the points and the fitting curve. I figured out some way of doing it: x - runif(1:20, 0, 10) y - 0.1*x^2 - rep(3, length(x)) + rnorm(length(x), sd = 0.5) yfit - nls(y ~ a*x^2 + b*x + c, start = list(a = 1, b = 1, c = 1), trace = TRUE) plot(x, y) curve(coef(yfit)[1]*x^2 + coef(yfit)[2]*x + coef(yfit)[3], 0, 10, add = TRUE) However, this code is rather fortranesque, and most likely there exists a much more elegant way in R/S, something like abline() which exists for straight lines. Since both the formula and the coefficients are available as a result of nls() (here as formula(yfit) and coef(yfit)), I thought there ought to be a way something along the following lines: f - substitute(formula(yfit), as.list(coef(yfit))) curve(f, ...) However, this snippet of code doesn't work. Am I thinking into the correct direction at all? Thanks in advance. All the best, Primož -- Primož Peterlin, Inštitut za biofiziko, Med. fakulteta, Univerza v Ljubljani Lipičeva 2, SI-1000 Ljubljana, Slovenija. primoz.peter...@mf.uni-lj.si Tel +386-1-5437612, fax +386-1-4315127, http://biofiz.mf.uni-lj.si/~peterlin/ F8021D69 OpenPGP fingerprint: CB 6F F1 EE D9 67 E0 2F 0B 59 AF 0D 79 56 19 0F __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] QQ plot
Dear Madan, Please see the qq.plot() function in the car package. I hope this helps, John -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Madan Sigdel Sent: October-09-09 8:54 AM To: r-help@r-project.org Subject: [R] QQ plot Dear list I want to plot the QQ plot with some distributions like geometrical , lognormal and truncated normal with confidence bands. does this options available. Iam new to R. If you have any scripts and examples please kindly suggest me. thank you madan [[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.
Re: [R] Trendline for a subset of data
Hi Steve, However, I am finding that ... the trendline ... continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. Your best option is probably Prof. Fox's reg.line function in package car. ## library(car) ?reg.line reg.line Regards, Mark. smurray444 wrote: Dear all, I am using abline(lm ...) to insert a linear trendline through a portion of my data (e.g. dataset[,36:45]). However, I am finding that whilst the trendline is correctly displayed and representative of the data portion I've chosen, the line continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. How do I display the line so that it only runs between point 36 and 45 (as shown in the example above) as doesn't continue to display a line throughout the rest of the plot space? Many thanks, Steve _ View your other email accounts from your Hotmail inbox. Add them now. http://clk.atdmt.com/UKM/go/167688463/direct/01/ __ 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/Trendline-for-a-subset-of-data-tp25818425p25821972.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] Creating a Clustered-Stacked Column Chart
I don't think I've seen an R version, probably because the technique is not very good for displaying data. Have a look at http://chartsgraphs.wordpress.com/tag/r-and-excel/ for an alternative method of displaying the data using lattice. --- On Fri, 10/9/09, zhijie zhang rusers...@gmail.com wrote: From: zhijie zhang rusers...@gmail.com Subject: [R] Creating a Clustered-Stacked Column Chart To: r-h...@stat.math.ethz.ch Received: Friday, October 9, 2009, 5:31 AM Hi all, In R, is there some functions or ways to create a Clustered-Stacked Column Chart as the example in the following page http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html? I have browsed the R Graph Gallery (http://addictedtor.free.fr/graphiques/) and searched the R site, and didnot find an appropriate method to do it. Anybody has met this problem before? Thanks a lot. [[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. __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ __ 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] Trendline for a subset of data
cb247343-29ec-495a-ba8e-d5a466bab...@comcast.net Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Thanks for flagging up the 'segments' command. However=2C I'm having troubl= e getting it to work - this is probably due to me misunderstanding the docu= mentation for this command. The plot section of my script appears as follows: test3 - 36:45 plot(data_means=2C type=3Db=2C pch=3D4=2C ylab=3D=2C xlab=3D=2C xaxt= =3Dn=2C yaxt=3Dn=2C col=3D3=2C ylim=3Dc(250=2C380)) abline(lm(data_means[36:45] ~ test3)=2C lty=3D2) As you can see=2C I'm only plotting points 36 to 45 from the object 'data_m= eans'. This intentionally results in much white space along the x-axis unti= l point 36 is reached. However=2C when inserting the trendline=2C this runs= along the entire length of the x-axis instead of just through points 36 to= 45. Ideally=2C a line which slightly overshoots the data subset would look= the best=2C but one constrained to the extents of the 36:45 would also do = the job just fine. So=2C my question is=2C how do I use 'segments' (or otherwise) to create a = linear trendline which only extends through points 36:45? (and overshoots a= t either end very slightly=2C if possible=2C rather than running along the = entire length of the x-axis). Many thanks again=2C Steve CC: r-help@r-project.org From: dwinsem...@comcast.net To: smurray...@hotmail.com Subject: Re: [R] Trendline for a subset of data Date: Fri=2C 9 Oct 2009 09:27:43 -0400 On Oct 9=2C 2009=2C at 5:50 AM=2C Steve Murray wrote: Dear all=2C I am using abline(lm ...) to insert a linear trendline through a portion of my data (e.g. dataset[=2C36:45]). However=2C I am finding that whilst the trendline is correctly displayed and representative of the data portion I've chosen=2C the line continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. How do I display the line so that it only runs between point 36 and 45 (as shown in the example above) as doesn't continue to display a line throughout the rest of the plot space? ?segments Many thanks=2C Steve David Winsemius=2C MD Heritage Laboratories West Hartford=2C CT =0A= _=0A= View your other email accounts from your Hotmail inbox. Add them now.=0A= __ 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] proto and get()
In further offline discussion with the poster it was explained that the purpose of this is to display the icon object and not to return an instantiatedProtoMethod which was what the code was attempting to do. That is in proto, g$icon is not the icon object. It is the icon method instantiated with the g object, essentially a currying operation in which the object is plugged into the first arguement of icon and the resulting function (no longer a method since its now been instantiated) returned. To get what the poster desires, namely the icon object itself, one would do this instead of g$icon: with(g, icon) On Thu, Oct 8, 2009 at 7:44 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: This may be a bug in objects of class instantiatedProtoMethod. I tried it with the devel version of proto and got no error so you could try that. I will send it to you offline for your try. On Thu, Oct 8, 2009 at 1:02 PM, baptiste auguie baptiste.aug...@googlemail.com wrote: Dear all, In mucking around with ggplot2, I've hit the following snag, library(ggplot2) # this returns a grob, OK GeomAbline$icon() # lines[GRID.lines.9] # this returns the function icon, OK GeomAbline$icon # proto method (instantiated with ): function (.) # linesGrob(c(0, 1), c(0.2, 0.8)) # environment: 0x13e6800 Now I want to wrap this in a function, getIcon - function(geom){ st - paste(Geom, firstUpper(geom), sep=) g - get(st, 2) g$icon() } getIcon(abline) # still OK # lines[GRID.lines.10] but ... getIcon - function(geom){ st - paste(Geom, firstUpper(geom), sep=) g - get(st, 2) g$icon } getIcon(abline) # proto method (instantiated with ): # Error in get(icon, env = g, inherits = TRUE) : object 'g' not found So, it seems that I'm being too naive about using get on a proto object or something along those lines. I'd be grateful if proto experts could help me extract the icon function from this object. Best regards, baptiste __ 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.
Re: [R] odfWeave XML error in post-processing
Hi Rob. Without the file content_1.xml or any information from the R call stack (e.g. options(error = recover) and then run the command and dynamically explore the state of affairs when the error occurs), there is no way for us to know what the problem might be. Somehow, the XML parser appears to be seeing a token and token is not a legitimate XML element name. It may also be seeing apos; which would identify an XML entity. Assuming that this is what the XML parser is seeing, the question is how they got into the document. So we need more to start diagnosing the problem. D. Rob James wrote: I've been happily building a file with odfWeave, and just as the hour draws nigh for it to be sent off, odfWeave or XML throws the following catastrophic error: ...this is the tail of entirely uneventful processing of input file. 31 : term xml(label=LR_Fall_Model_Results) 32 : term verbatim(label=LR_Model_Fall_graph) 33 : term xml(label=LR_OMC_tab) 'content_1.xml' has been Sweaved Removing content.xml Post-processing the contents xmlParseStartTag: invalid element name Entity 'apos' not defined Entity 'apos' not defined This triplet of errors XMLParse, and duplicate Entity lines is reported several times, then XML or odfWeave packs up its toys, and goes home without an output file. I'd (desperately) love any insights anyone might have. Thanks, Rob __ 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.
[R] Problems with code containing a for loop
The following code isn't working and we can't figure out why.. letters = c(A,B,C,D,E,F,G,H,I,J) numbers = 1:3 for(i in 1:6){ #6 letters for (j in 1:3) { #3 numbers for (k in -1:1) { #answer -1,right or +1 fn = paste (i,j,k,.bmp,sep=) bmp(file = fn) plot(x = 10, y = 10, ylim=c(0,1), xlim=c(0,1), axes=FALSE, ylab=, xlab=) text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off() } } } We get the following errors: Error: unexpected symbol in: text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off } Error: unexpected '}' in } } Error: unexpected '}' in} } Error: unexpected '}' in} -- View this message in context: http://www.nabble.com/Problems-with-code-containing-a-for-loop-tp25823173p25823173.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] Tobit model
Hi all, I'm from Brazil. I fit a Tobit model to FLUID MILK CONSUMPTION (DEPENDENT VARIABLE) data using survreg (attached). I am confused about the output interpretation and I would like yours explanations. Thanks, Marcio Roberto Silva __ 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] Handling missing data
I have one column x 97 94 91 90 NA NA NA NA I tried book$r-ifelse(book$x!=NA,book$x+20,10) I expect to get the result as follows 107 104 91 90 10 10 10 10 But what i was getting is empty column of variable r.How to solve this -- View this message in context: http://www.nabble.com/Handling-missing-data-tp25539335p25818365.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] Re place many rows in a table with new rows in one step
I tried this: (c is the column vector with indices of those rows I want to replace) table[c,]-replace(table[c,],c,newRows) but it does not work and the error is: new columns would leave holes after existing columns Can anyone help please? Thanks -- View this message in context: http://www.nabble.com/Replace-many-rows-in-a-table-with-new-rows-in-one-step-tp25819016p25819016.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 producing plot for assessing forecasting accuracy
Dear colleagues, I'm trying (and failing) to write the script required to generate a chart that would help me assess the forecasting accuracy of a logistic regression model by plotting the cumulative proportion of observed events occurring in cases across the range of possible predicted probabilities. In other words, let: x = any value on 0-1 scale phat_i = predicted probability of event Y from logit model for case i y_i = observed outcome (0/1) for case i Y_cond = sum(y_i) conditional on phat_i = x Y_tot = total number of events observed in sample What I'm trying to plot is (Y_cond)/(Y_tot) across all values of x. I would be grateful for any guidance you can offer, and I'm sorry if I've overlooked some really simple solution; I'm fairly new to R and learning by doing. Regards, Jay -- Jay Ulfelder, Ph.D. Research Director Political Instability Task Force Science Applications International Corp. (SAIC) jay_ulfel...@stanfordalumni.org (301) 588-8478 [home office] (301) 580-8736 [mobile] __ 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 with printing fixed width
Hello R users, I am writing a summary() for a custom class, and am to display the integers right justified, Say where x is the vector with integers, I am using the following: cat(\t,format(x),\t...other columns) this way I am trying to pass the format(x), to the cat function to display it, but still I am getting a kink(b/w the 9th and 10th row). 6 81 170 251 1.998026e-08 7 26 93 119 4.937587e-10 8 96 209 305 8.750939e-11 9 94 211 305 1.758285e-11 10 88 205 293 6.47853e-12 11 82 244 326 7.943691e-20 12 57 145 202 4.964509e-10 Thanks, -- Regards, Sahil Seth JHSPH [[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.
Re: [R] Handling missing data
What you want is: book$r-ifelse(is.na(book$r), 10,book$x+20) On Fri, Oct 9, 2009 at 5:46 AM, premmad mtechp...@gmail.com wrote: I have one column x 97 94 91 90 NA NA NA NA I tried book$r-ifelse(book$x!=NA,book$x+20,10) I expect to get the result as follows 107 104 91 90 10 10 10 10 But what i was getting is empty column of variable r.How to solve this -- View this message in context: http://www.nabble.com/Handling-missing-data-tp25539335p25818365.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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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] Problems with code containing a for loop
Because you missed your closing parens in the text function call. The closing parens is closing the paste function, you need one more. I don't know what you're trying to do here, but I am guessing there's a faster way? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Antje## Sent: Friday, October 09, 2009 10:37 AM To: r-help@r-project.org Subject: [R] Problems with code containing a for loop The following code isn't working and we can't figure out why.. letters = c(A,B,C,D,E,F,G,H,I,J) numbers = 1:3 for(i in 1:6){ #6 letters for (j in 1:3) { #3 numbers for (k in -1:1) { #answer -1,right or +1 fn = paste (i,j,k,.bmp,sep=) bmp(file = fn) plot(x = 10, y = 10, ylim=c(0,1), xlim=c(0,1), axes=FALSE, ylab=, xlab=) text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off() } } } We get the following errors: Error: unexpected symbol in: text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off } Error: unexpected '}' in } } Error: unexpected '}' in} } Error: unexpected '}' in} -- View this message in context: http://www.nabble.com/Problems-with-code- containing-a-for-loop-tp25823173p25823173.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.
Re: [R] Handling missing data
1) No need to post multiple times to the list 2) use the is.na function to test if a value is missing, not == or != -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of premmad Sent: Friday, October 09, 2009 5:05 AM To: r-help@r-project.org Subject: Re: [R] Handling missing data I have one column x 97 94 91 90 NA NA NA NA I tried i tried this book$r-ifelse(book$x!=NA,book$x+20,10) expected result 107 104 101 100 10 10 10 10 But got empty column of variable r.How to work with missing values of numeric variables. Why the numeric variable missing is assigned NA but not .,help in easy work for us. -- View this message in context: http://www.nabble.com/Handling-missing-data- tp25539335p25818365.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.
Re: [R] Help with printing fixed width
try using 'sprintf' On Fri, Oct 9, 2009 at 8:36 AM, sahil seth sahiils...@gmail.com wrote: Hello R users, I am writing a summary() for a custom class, and am to display the integers right justified, Say where x is the vector with integers, I am using the following: cat(\t,format(x),\t...other columns) this way I am trying to pass the format(x), to the cat function to display it, but still I am getting a kink(b/w the 9th and 10th row). 6 81 170 251 1.998026e-08 7 26 93 119 4.937587e-10 8 96 209 305 8.750939e-11 9 94 211 305 1.758285e-11 10 88 205 293 6.47853e-12 11 82 244 326 7.943691e-20 12 57 145 202 4.964509e-10 Thanks, -- Regards, Sahil Seth JHSPH [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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] Problems with code containing a for loop
A parenthesis is missing. You can figure that out easily watching the first error. text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k])) Xavier - Mail Original - De: Antje## ann3bu...@hotmail.com À: r-help@r-project.org Envoyé: Vendredi 9 Octobre 2009 17h36:34 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: [R] Problems with code containing a for loop The following code isn't working and we can't figure out why.. letters = c(A,B,C,D,E,F,G,H,I,J) numbers = 1:3 for(i in 1:6){ #6 letters for (j in 1:3) { #3 numbers for (k in -1:1) { #answer -1,right or +1 fn = paste (i,j,k,.bmp,sep=) bmp(file = fn) plot(x = 10, y = 10, ylim=c(0,1), xlim=c(0,1), axes=FALSE, ylab=, xlab=) text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off() } } } We get the following errors: Error: unexpected symbol in: text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off } Error: unexpected '}' in } } Error: unexpected '}' in} } Error: unexpected '}' in} -- View this message in context: http://www.nabble.com/Problems-with-code-containing-a-for-loop-tp25823173p25823173.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.
[R] Problems with code
The following code isn't working and we can't figure out why.. letters = c(A,B,C,D,E,F,G,H,I,J) numbers = 1:3 for(i in 1:6){ #6 letters for (j in 1:3) { #3 numbers for (k in -1:1) { #answer -1,right or +1 fn = paste (i,j,k,.bmp,sep=) bmp(file = fn) plot(x = 10, y = 10, ylim=c(0,1), xlim=c(0,1), axes=FALSE, ylab=, xlab=) text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off() } } } We get the following errors: Error: unexpected symbol in: text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) dev.off } Error: unexpected '}' in } } Error: unexpected '}' in} } Error: unexpected '}' in} I hope you can figure out how to fix this.. Greetings _ [[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] For loop isn't working correctly
Hi. With your help, I've fixed the errors in my for loops. But now, the for loop isn't working correctly. There should be a plot, but there's no plot when I run the for loop.. This is the code: letters = c(A,B,C,D,E,F,G,H,I,J) numbers = 1:3 for(i in 1:6){ #6 letters for (j in 1:3) { #3 numbers for (k in -1:1) { #answer -1,right or +1 fn = paste (i,j,k,.bmp,sep=) bmp(file = fn) plot(x = 10, y = 10, ylim=c(0,1), xlim=c(0,1), axes=FALSE, ylab=, xlab=) text(0.5,0.5, labels = paste(letters[i], +, numbers[j],=, letters [i+j+k])) dev.off() } } } Can somebody see why this isn't running correctly? Thanks for the help untill now! Greetings _ [[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] different time series in one plot
Hello, I need to put 2 or more different time series to one plot for comparison each other. The problem is that the time series are irregular, moreover the time lenghts and periods are not the same. Is there a way to manage it in R? Many thanks for any hint and advice in advance Tomas __ 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] Problems with code
On Fri, Oct 9, 2009 at 4:54 PM, Anne Buunk ann3bu...@hotmail.com wrote: text(0.5,0.5, text = paste(letters[i], +, numbers[j],=, letters [i+j+k]) Missing ) on the end there. You have one ( for text( and one for paste( but only one ). Use an editor that matches parentheses, and read error messages to figure out where things are going wrong. Barry __ 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] For loop isn't working correctly
It plots on my system just fine. You might want to check what directory (getwd()) that you are plotting in. On Fri, Oct 9, 2009 at 12:17 PM, Anne Buunk ann3bu...@hotmail.com wrote: Hi. With your help, I've fixed the errors in my for loops. But now, the for loop isn't working correctly. There should be a plot, but there's no plot when I run the for loop.. This is the code: letters = c(A,B,C,D,E,F,G,H,I,J) numbers = 1:3 for(i in 1:6){ #6 letters for (j in 1:3) { #3 numbers for (k in -1:1) { #answer -1,right or +1 fn = paste (i,j,k,.bmp,sep=) bmp(file = fn) plot(x = 10, y = 10, ylim=c(0,1), xlim=c(0,1), axes=FALSE, ylab=, xlab=) text(0.5,0.5, labels = paste(letters[i], +, numbers[j],=, letters [i+j+k])) dev.off() } } } Can somebody see why this isn't running correctly? Thanks for the help untill now! Greetings _ [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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] wrong plot with fda or lda?
Hi, I have a strange behavior of plot function when trying to plot a discriminant analysis obtained by fda. I'd attached the data for reproduction. I made the same analysis (linear discriminant analysis) but using lda and fda (default args, using polyreg). The resulting coefficients and trace proportions for the two analysis are the same, that's good, but if you plot the two analysis the graphs are very different. Plotting the results of lda function gives much more overlapping of points from different groups than using fda. If you make: libray(MASS) library(mda) read.table(data, header=T) - data data[,1] - grp data[,2:24] - X #Linear discriminant analysis using fda fda(grp ~ ., data=X) - FDA plot(FDA) #Linear discriminant analysis using lda lda(grp ~ ., data=X) - LDA plot(LDA, col=palette()[grp])# Very different results #Same coefficients coef(FDA) coef(LDA) 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.
Re: [R] Any reference to Tukeyline algorithm?
Google is your friend! (search on Tukey median line fit); e.g. http://www.amstat.org/publications/jse/v14n2/morrell.html Bert Gunter Genentech Noclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of shanmukha patel Sent: Friday, October 09, 2009 6:26 AM To: r-help@r-project.org Subject: [R] Any reference to Tukeyline algorithm? Hi, I am using line function to plot the line. And I would like to understand Tukeyline algorithm. Since, the line function is calling the Tukeyline algorithm(which is compiled code) using foreign function interface, I am not able to look into the source code of this algorithm. Can somebody help me out, so that I can refer the same. Thanks in advance!!! Thanks, Shanmukh. Try the new Yahoo! India Homepage. Click here. http://in.yahoo.com/trynew [[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-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] row selection
Hi all, Thank you for your help. Now I am able to select every 5th row of the data from the main data set (x) using sub1- x[seq(1, nrow(x), by=5), ] So sub1 contains one fith of the data set X. I want also create another data set that will contain the remaining data set from X (ie., four fifth of the data set). Any help is highly appreciated. I have a matrix named x with N by C I want to select every 5 th rrow from matrix x I used the following code n- nrow(x) for(i in 1: n){ + b - a[i+5,] b } sc x[seq(1, nrow(x), by=5), ] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Thursday, October 08, 2009 4:19 PM To: Ashta Cc: R help Subject: Re: [R] row selection On Oct 8, 2009, at 4:14 PM, Ashta wrote: Hi all, I have a matrix named x with N by C I want to select every 5 th rrow from matrix x I used the following code n- nrow(x) for(i in 1: n){ + b - a[i+5,] b } Error: subscript out of bounds What did you expect when i in your loop counter became one greater than the number of rows? 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. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S. News World Report (2008). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} __ 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. [[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.
Re: [R] distr package
Thanks David, for answering this question. On Oct 8, 2009, at 4:33 AM, msig...@yahoo.com wrote: Dear all when I try to install distr, the following error appears, I am using R in windows. can u suggest me? I'm not a Windows user, but the obvious questions would be How?. What commands or method? and Which? (version of Windows and the ever present question for Vista users ... what is your level of admin privileges), and Is that everything? (was that the entire output?) And the second obvious question: Why have you not included output from: sessionInfo() Perhaps a not so obvious question that you should answer: what is the output from: .libPaths() Error in normalizePath(path) : path[1]=C:\Program Files\R\R-2.9.1\library/distr: The system cannot find the file specified I can assist David's comments. @ the original poster: It might be a backslash thing (and does not seem to be connected to package distr in any respect): Within R, even on Windows, you can use the forward slash as folder separator, so your trailing /distr seems to be oK. Backslashes, which in R on Windows may also serve for this purpose, have to be escaped, so you might eigher try C:/Program Files/R/R-2.9.1/library/distr or C:\\Program Files\\R\R-2.9.1\\library/distr In fact you have not told us all you saw, I suppose: Didn't you get this warning, too? In addition: Warning messages: 1: '\P' is an unrecognized escape in a character string 2: '\R' is an unrecognized escape in a character string 3: '\R' is an unrecognized escape in a character string 4: unrecognized escapes removed from C:\Program Files\R\R-2.9.1/distr which already told you the problem. btw: it would be nice also if you could at least tell us your name so that we can address you personally. Peter Ruckdeschel, maintainer of package distr __ 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] variogram
It probably means that your data is not in the right format. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. If you show the data, it might help. It sounds like something is empty, but it is hard to tell what from the information provided. On Thu, Oct 8, 2009 at 9:07 AM, JRE akun...@gmx.de wrote: Hello everybody, I want to run the following R-code, but it does'nt work. res.vgm = variogram(ertrag ~ rep, # !!! + loc = ~ xpos + ypos, # !!! + width = start.range / 10, + data = d) Error in vector(double, length) : element 2 is empty; the part of the args list of '.Internal' being evaluated was: (mode, length) What does the error message mean? Many thanks for your help! JRE -- View this message in context: http://www.nabble.com/variogram-tp25802976p25802976.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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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] row selection
sub3 - x[-seq(1, nrow(x), by=5), ] Notice the '-' in front of the seq() command. This will select everything but what is in the sequence. From: Ashta [mailto:sewa...@gmail.com] Sent: Friday, October 09, 2009 12:42 PM To: Nutter, Benjamin Cc: r-help@r-project.org Subject: Re: [R] row selection Hi all, Thank you for your help. Now I am able to select every 5th row of the data from the main data set (x) using sub1- x[seq(1, nrow(x), by=5), ] So sub1 contains one fith of the data set X. I want also create another data set that will contain the remaining data set from X (ie., four fifth of the data set). Any help is highly appreciated. I have a matrix named x with N by C I want to select every 5 th rrow from matrix x I used the following code n- nrow(x) for(i in 1: n){ + b - a[i+5,] b } sc x[seq(1, nrow(x), by=5), ] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Thursday, October 08, 2009 4:19 PM To: Ashta Cc: R help Subject: Re: [R] row selection On Oct 8, 2009, at 4:14 PM, Ashta wrote: Hi all, I have a matrix named x with N by C I want to select every 5 th rrow from matrix x I used the following code n- nrow(x) for(i in 1: n){ + b - a[i+5,] b } Error: subscript out of bounds What did you expect when i in your loop counter became one greater than the number of rows? 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. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S. News World Report (2008). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} __ 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. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S. News World Report (2008). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:16}} __ 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] Trendline for a subset of data
You are emitting weird hex-stuff from your mail client. And from what I can tell that is not a reproducible example even if hex-ation problem gets fixed. There is a worked example in segments. On Oct 9, 2009, at 10:45 AM, Steve Murray wrote: cb247343-29ec-495a-ba8e-d5a466bab...@comcast.net Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Thanks for flagging up the 'segments' command. However=2C I'm having troubl= e getting it to work - this is probably due to me misunderstanding the docu= mentation for this command. The plot section of my script appears as follows: test3 - 36:45 plot(data_means=2C type=3Db=2C pch=3D4=2C ylab=3D=2C xlab=3D=2C xaxt= =3Dn=2C yaxt=3Dn=2C col=3D3=2C ylim=3Dc(250=2C380)) abline(lm(data_means[36:45] ~ test3)=2C lty=3D2) As you can see=2C I cannot see anything. If you are under the impression that there should have been an attachment, then (re-?)read the Posting Guide on that topic. I'm only plotting points 36 to 45 from the object 'data_m= eans'. This intentionally results in much white space along the x- axis unti= l point 36 is reached. However=2C when inserting the trendline=2C this runs= along the entire length of the x-axis instead of just through points 36 to= 45. Ideally=2C a line which slightly overshoots the data subset would look= the best=2C but one constrained to the extents of the 36:45 would also do = the job just fine. So=2C my question is=2C how do I use 'segments' (or otherwise) to create a = linear trendline which only extends through points 36:45? (and overshoots a= t either end very slightly=2C if possible=2C rather than running along the = entire length of the x-axis). The basic strategy would be to calculate the x and y coordinates of the two points at the end of the desired segment and then say segments( x[1], y[1], x[2], y[2] ) Many thanks again=2C Steve CC: r-help@r-project.org From: dwinsem...@comcast.net To: smurray...@hotmail.com Subject: Re: [R] Trendline for a subset of data Date: Fri=2C 9 Oct 2009 09:27:43 -0400 On Oct 9=2C 2009=2C at 5:50 AM=2C Steve Murray wrote: Dear all=2C I am using abline(lm ...) to insert a linear trendline through a portion of my data (e.g. dataset[=2C36:45]). However=2C I am finding that whilst the trendline is correctly displayed and representative of the data portion I've chosen=2C the line continues to run beyond this data segment and continues until it intersects the vertical axes at each side of the plot. How do I display the line so that it only runs between point 36 and 45 (as shown in the example above) as doesn't continue to display a line throughout the rest of the plot space? ?segments =0A= _=0A= View your other email accounts from your Hotmail inbox. Add them now.=0A= http://clk.atdmt.com/UKM/go/167688463/direct/01/= 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.
Re: [R] row selection
On Oct 9, 2009, at 12:41 PM, Ashta wrote: Hi all, Thank you for your help. Now I am able to select every 5th row of the data from the main data set (x) using sub1- x[seq(1, nrow(x), by=5), ] So sub1 contains one fith of the data set X. I want also create another data set that will contain the remaining data set from X (ie., four fifth of the data set). sub1- x[-seq(1, nrow(x), by=5), ] Any help is highly appreciated. I have a matrix named x with N by C I want to select every 5 th rrow from matrix x I used the following code n- nrow(x) for(i in 1: n){ + b - a[i+5,] b } sc x[seq(1, nrow(x), by=5), ] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of David Winsemius Sent: Thursday, October 08, 2009 4:19 PM To: Ashta Cc: R help Subject: Re: [R] row selection On Oct 8, 2009, at 4:14 PM, Ashta wrote: Hi all, I have a matrix named x with N by C I want to select every 5 th rrow from matrix x I used the following code n- nrow(x) for(i in 1: n){ + b - a[i+5,] b } Error: subscript out of bounds What did you expect when i in your loop counter became one greater than the number of rows? 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.
Re: [R] different time series in one plot
plot.zoo and xyplot.zoo in the zoo package can both do that: library(zoo) z - zoo(c(21, 34, 33, 41, 39, 38, 37, 28, 33, 40), as.Date(c(1992-01-10, 1992-01-17, 1992-01-24, 1992-01-31, 1992-02-07, 1992-02-14, 1992-02-21, 1992-02-28, 1992-03-06, 1992-03-13))) # z and lag(z) have different spans and are irregular zz - merge(z, lag(z)) # same screem plot(zz, screen = 1) # different screens plot(zz) # similar but using zoo's xyplot lattice method library(lattice) xyplot(zz, screen = 1) xyplot(zz) Read the three vignettes that come with zoo and the help files. On Fri, Oct 9, 2009 at 12:18 PM, Tomas Lanczos lanc...@fns.uniba.sk wrote: Hello, I need to put 2 or more different time series to one plot for comparison each other. The problem is that the time series are irregular, moreover the time lenghts and periods are not the same. Is there a way to manage it in R? Many thanks for any hint and advice in advance Tomas __ 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.
Re: [R] Trendline for a subset of data
b2a99330-1d1d-49cc-b287-81f37c16b...@comcast.net Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Thanks Mark=2C the reg.line trick seemed to work really well. David - hopefully the hex-text will have gone now - if not=2C please accept= my apologies as=2C this is=2C as far as I know=2C the first time this has = happened. If it hasn't gone=2C then I'm afraid I'm a little clueless as to = how to remove it! Thanks again both of you=2C Steve =0A= _=0A= Save time by using Hotmail to access your other email accounts.=0A= http://clk.atdmt.com/UKM/go/167688463/direct/01/= __ 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] Re place many rows in a table with new rows in one step
On Oct 9, 2009, at 6:42 AM, Zhen Lin wrote: I tried this: (c is the column vector with indices of those rows I want to replace) table[c,]-replace(table[c,],c,newRows) but it does not work and the error is: new columns would leave holes after existing columns replace() is supposed to work on vectors, but if you have a table object then that might be better manipulated with indexing approaches. Try making up a small table object and they working on it. table1 - table(sample(LETTERS[1:5], 10, replace=T), sample(letters[1:5], 10, replace=T)) table1 a b c d A 1 0 1 2 B 0 1 0 0 C 0 1 0 1 D 0 0 0 1 E 0 1 0 1 table1[2,] - c(1,1,1,1) table1 a b c d A 1 0 1 2 B 1 1 1 1 C 0 1 0 1 D 0 0 0 1 E 0 1 0 1 -- 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.
Re: [R] celebrating revision 50000
Thanks to Dirk for pointing it out in my blog : thomas and tlumley are the same person. Also martyn and plummer, and paul and murrell ... updated number of commits per author below sort( table( simple$author ), decreasing=T ) ripleymaechler hornik pd murdoch iacus 20523 10207674446551370 915 leisch jmcluke ihaka murrell bates 743 643 618 481 427 350 tlumleyrgentlemurbaneks (no author) duncan r 337 299 274 203 172 96 plummer lyndon guidodeepayan falconmike 65 54 39 20 18 1 Not quite sure who r is (96 commits) and mike (1 commit). Also there are 203 commits that have (no author) The other thing is that it does not include data from the pre-svn era. Romain On 10/09/2009 03:41 PM, Romain Francois wrote: Hello, Today, Brian Ripley commited the revision 5 of R's svn repository. I took this as an opportunity to do some data analysis of the log and posted some code and graphics on my blog: http://romainfrancois.blog.free.fr/index.php?post/2009/10/09/celebrating-R-commit-5 The plots of the number of commits per day (and per month) indicates a peak in 2002. Here are the top 20 modified files : most.updated - head( sort( table( data$file ), decreasing=TRUE ), 20 ) cat( sprintf( %40s : %6d, names(most.updated), most.updated ), sep =\n ) /trunk/NEWS : 5449 /trunk/date-stamp : 2219 /trunk/BUGS : 1485 /trunk/src/gnuwin32/CHANGES : 994 /trunk/configure : 979 /trunk/doc/manual/R-FAQ.texi : 948 /trunk/doc/manual/R-exts.texi : 814 /trunk/doc/manual/R-admin.texi : 666 /trunk/src/main/names.c : 634 /trunk/tests/reg-tests-1.R : 621 /trunk/src/gnuwin32/Makefile : 542 /trunk/FAQ : 471 /trunk/doc/html/faq.html : 458 /trunk/src/include/Defn.h : 455 /trunk/configure.ac : 447 /trunk/src/scripts/check.in : 433 /trunk/src/library/tools/R/QC.R : 397 /branches/unlabeled-1.1139.4/date-stamp : 386 /trunk/src/main/connections.c : 349 /trunk/src/main/plot.c : 325 The most modified file extensions (the second element indicates files without extensions) : head( sort( table( data$extension ), decreasing=T ) , 24 ) Rd c R po in mo h 36766 33999 29849 25221 10215 8806 6280 6147 texi gmo html save pot f win m4 5274 3705 1920 1668 1285 1148 1060 1041 pl ac afm pm mac y packages sh 910 527 482 461 402 384 311 215 Many thanks to the R core team for these 50 000 commits. Romain -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/BcPw : celebrating R commit #5 |- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc `- http://tr.im/yw8E : New R package : sos __ 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] k-modes (Huang) in package klaR?
Uwe Ligges wrote: Uwe Ligges wrote: Kim Vanselow wrote: Dear R-Users and Developers, I want to calculate something like k-means clustering, but with ordinal data (Braun-Blanquet) to combine this classification technique with a NMDS-Ordination. I found an algorithm especially developed for categorical data: k-modes (Huang 1998). Is there a function implemented in R which can calculate with this algorithm. I found a hint on a poster-abstract from Gero Szepannek, Uwe Ligges and Claus Weihs. There it is stated that the algorithm is implemented in their package klaR. But I cannot find anything about k-modes in the klaR-Tutorial. Could you please help me. Dear Kim, well, maybe you start writing a message to the authors of that poster-abstract at first who might be able to help? Since I am one of those: Where can I find this abstract or poster (at least in order to remind Gero who does no longer work at the university to finally implement the feature, if it is not yet there)? Some news on this: Gero never presented it in his talk at the useR!2008 and we all forgot that he announced it in his abstract. He is working for a bank these days and is going to send his code within a few days. Will take a look if it is easy to add the existing code to klaR then. FYI: I got the code now, will try to incorporate it soon. Best, Uwe Best wishes, Uwe Ligges Best wishes, Uwe Ligges Thanks Kim __ 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] Satellite ocean color palette?
Dear List, Is there a color palette avaliable similar to what is used in satellite ocean color imagery? I.e. a gradient with blue on one end and red on the other, with yellow in the middle? I have tried topo.colors(n) but that comes out more yellow on the end. I am looking for something similar to what is found on the CoastWatch web page: http://oceanwatch.pifsc.noaa.gov/imagery/GA2009281_2009282_sst_2D_eddy.jpg Thanks! Tim Tim Clark Department of Zoology University of Hawaii __ 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] Satellite ocean color palette?
See ?colorRampPallete On Fri, Oct 9, 2009 at 3:51 PM, Tim Clark mudiver1...@yahoo.com wrote: Dear List, Is there a color palette avaliable similar to what is used in satellite ocean color imagery? I.e. a gradient with blue on one end and red on the other, with yellow in the middle? I have tried topo.colors(n) but that comes out more yellow on the end. I am looking for something similar to what is found on the CoastWatch web page: http://oceanwatch.pifsc.noaa.gov/imagery/GA2009281_2009282_sst_2D_eddy.jpg Thanks! Tim Tim Clark Department of Zoology University of Hawaii __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] Satellite ocean color palette?
On Fri, Oct 9, 2009 at 7:51 PM, Tim Clark mudiver1...@yahoo.com wrote: Dear List, Is there a color palette avaliable similar to what is used in satellite ocean color imagery? I.e. a gradient with blue on one end and red on the other, with yellow in the middle? I have tried topo.colors(n) but that comes out more yellow on the end. I am looking for something similar to what is found on the CoastWatch web page: http://oceanwatch.pifsc.noaa.gov/imagery/GA2009281_2009282_sst_2D_eddy.jpg Thanks! You could build one yourself with the colorRamp function: satRampP = colorRampPalette(c(black,blue,cyan,yellow,orange,red,black)) that looks roughly like the one in the jpg, but I'm not sure about the black at the far end...anyway, let's see: image(matrix(seq(0,1,len=100),100,1),col=satRampP(100)) Or you could try my colour schemes package: https://r-forge.r-project.org/projects/colourscheme/ Barry __ 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] Satellite ocean color palette?
On Fri, 2009-10-09 at 11:51 -0700, Tim Clark wrote: Dear List, Is there a color palette avaliable similar to what is used in satellite ocean color imagery? I.e. a gradient with blue on one end and red on the other, with yellow in the middle? I have tried topo.colors(n) but that comes out more yellow on the end. I am looking for something similar to what is found on the CoastWatch web page: http://oceanwatch.pifsc.noaa.gov/imagery/GA2009281_2009282_sst_2D_eddy.jpg Thanks! Tim Tim Clark Department of Zoology University of Hawaii Tim, You can make a palette in R, using colorRampPalette, look this example Satelite.Pallete - colorRampPalette(c(blue3,cyan,aquamarine,yellow,orange,red)) require(fields) image.plot(volcano, col = Satelite.Pallete(500), legend.lab=Scale) contour(volcano, levels = seq(90, 200, by = 5), add = TRUE) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ 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] Use R -- term and logo copyright?
Dear list, I would like to start some R workshops at King's College London, and to do so, I would like to use the Use R! logo at http://www.agrocampus-ouest.fr/math/useR-2009//useR%21%202008_fichiers/useR-middle.png Since it seems to be difficult to get a shell account at KCL, I also went ahead and registered use-r.org.uk and am starting to put together a website at kcl.use-r.org.uk. I really like the Use R! slogan, which seems to be used by the R user conferences and Springer (the latter without the exclamation mark). Even more, I really *really* like Use R! logo. I think it is very elegant indeed! Kudos to whoever designed it. However, I'm completely in the dark about copyright issues of the logo and the slogan. Can I use (a) the logo and/or (b) the slogan for the KCL R workshops? I think it is quite clear from my website that this is neither about the Springer book series nor about an R user conference. I enquired with the agrocampus-ouest.fr website about the logo but was pointed to r-project.org and the R development core team. I thought in that case it might be best to ask here to have the answer publicly available -- sorry if I overlooked the information online somewhere. Marianne -- Marianne Promberger PhD, King's College London http://promberger.info R version 2.9.2 (2009-08-24) Ubuntu 9.04 __ 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] Satellite ocean color palette?
Thanks! The colorRampPalette() did just what I need. Tim Tim Clark Department of Zoology University of Hawaii --- On Fri, 10/9/09, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: From: Barry Rowlingson b.rowling...@lancaster.ac.uk Subject: Re: [R] Satellite ocean color palette? To: Tim Clark mudiver1...@yahoo.com Cc: r-help@r-project.org Date: Friday, October 9, 2009, 9:06 AM On Fri, Oct 9, 2009 at 7:51 PM, Tim Clark mudiver1...@yahoo.com wrote: Dear List, Is there a color palette avaliable similar to what is used in satellite ocean color imagery? I.e. a gradient with blue on one end and red on the other, with yellow in the middle? I have tried topo.colors(n) but that comes out more yellow on the end. I am looking for something similar to what is found on the CoastWatch web page: http://oceanwatch.pifsc.noaa.gov/imagery/GA2009281_2009282_sst_2D_eddy.jpg Thanks! You could build one yourself with the colorRamp function: satRampP = colorRampPalette(c(black,blue,cyan,yellow,orange,red,black)) that looks roughly like the one in the jpg, but I'm not sure about the black at the far end...anyway, let's see: image(matrix(seq(0,1,len=100),100,1),col=satRampP(100)) Or you could try my colour schemes package: https://r-forge.r-project.org/projects/colourscheme/ Barry __ 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] Placing text in a ggplot
I am attempting to graph 12 months of temperatures, delineate the months with a vline and place the names of the months at the top of the graph. So far I have gotten everything to work except the names, despite getting a similar graph to work yesterday the day before yesterday with Baptise A's help. Can anyone suggest what I am doing wrong. Data set is below code. Thanks. Code = line.count - c(1,cumsum(as.vector((table(year$monthnum) namposts - line.count[1:12] temprange - range(year[,4], na.rm=TRUE) mlabs - month.name[1:12] p - ggplot(year, aes(duration, temps, colour=month)) + geom_line() + ylab(Temperature (C)) + xlab(Mean Daily Temperatures) + opts(legend.position = none, title=Ottawa, 2008, axis.text.x = theme_blank(), axis.ticks = theme_blank()) + geom_vline(xintercept= line.count) [[elided Yahoo spam]] p + geom_text(aes(x = namposts, y = temprange[2], label = mlabs), data = year, size = 2.5, colour='black', hjust = 0, vjust = 0) == year - structure(list(monthnum = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L), days = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L), month = structure(c(5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
[R] R CMD --meetup=Chicago --when=Oct 29 --where=Jak'sTap
Chicagoland R Users: We are pleased to announce a Fall meetup for Chicagoland R users. This is open to anyone with an interest in R: practioners, researchers, casual users and other interested parties. WHEN: October 29, 2009 @5:30 WHERE: Jak's Tap www.jakstap.com A short series of so-called lightning talks from some noted R contributors and users is on the agenda. Speakers include: Gib Basset (UIC) Bryan Lewis (Revolution Computing) JD Long (Cerebral Mastication) David St. John (UIC, ttrTests package) Casual conversation and food will follow, courtesy of the International Center for Futures and Derivatives at the University of Illinois at Chicago and the organizers of the R/Finance conferences: http://www.RinFinance.com Best, Jeffrey Ryan (on behalf of the organizing committee) __ 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] gregmisc library (Mandriva)
Hi You may find that you need to use the compilation tools. I gave up on using R from Mandriva repositories as the R base is usually out of date and the selection of packages available depends on the interests of those who produced them. If I knew how rpm spec files worked I might do something about it for my interests. Of course if the package is simply R code with no C, C++, Fortran needing compiling, then unpacking the source in your library location will do, though you may need to check dependencies. I do like Mandriva, but for programs like R using install.packages() and having the relevant devel-packages enables you to keep up to date. Paul Bivand 2009/10/3 chi ball c...@hotmail.it: Hi, I'm not able to find a rpm of gregmisc library (2.0.0) for Linux Mandriva 2008 Spring. Any suggestion? Thanks _ [[elided Hotmail spam]] [[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-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] different time series in one plot
Date: Fri, 09 Oct 2009 18:18:05 +0200 From: Tomas Lanczos lanc...@fns.uniba.sk Sender: r-help-boun...@r-project.org Precedence: list Hello, I need to put 2 or more different time series to one plot for comparison each other. The problem is that the time series are irregular, moreover the time lenghts and periods are not the same. Is there a way to manage it in R? The function plot(), maybe...? You need to have both series in a single mts object. Look also at the argument plot.type... HTH, Giovanni Many thanks for any hint and advice in advance Tomas __ 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. -- Giovanni Petris gpet...@uark.edu Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/ __ 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 last status change, ctime on Windows?
Hi, file.info is producing data.frame with ctime variable. Help file says that on Unix this is 'last status change' and on Windows 'creation time'. Is there a way to get 'last status change' on Windows using some R function? Thanks, Johannes __ 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] plot the same types of graphics on the same R graphic device
Hi, How to plot the same types of graphics on the same R graphic device? Suppose that we want to plot a vector y against x (using plot for instance). How is it possible to plot y against x for different values of these two vectors on the same device so that the plots could be compared? Cheers, Carol [[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] lm output
Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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.
Re: [R] lm output
That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now way to make this come out as a zero, because it fails the very assumptions of regression analysis. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Brecknock, Peter Gesendet: Friday, October 09, 2009 5:12 PM An: r-help@r-project.org Betreff: [R] lm output Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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-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] lm output
On 09-Oct-09 21:12:18, Brecknock, Peter wrote: Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete You should post-process! To incorporate such a thing into the function lm() itself would be an arbitrary resolution of an indeterminate situation, and would not be appropriate for a general-purpose function. Your situation is, graphically, 17 +* | 15 + | | 12 +* | 10 +* | | | | 5 +++ 0510 Any line whatever through the point (5,13) will fit the three points as well as any other, so the slope is indeterminate.[*] You have decided that you would like it to be zero, but that is an arbitrary decision! [*] Note that a vertical line (with slope +/- Inf) does not resolve the indeterminacy, since, although it goes through all three points, you do not know which point[s] on the line to use in evaluating the error -- the difference between a point on the line with given value of x and the y-value on the line corresponding to x -- because all points on the line qualify as potential y values, since they all have the same value of x. Since the slope is indeterminate, it is NA (that is what NA means). It arises numerically because the calculation of the slope is (N*sum(x*y) - sum(x)*sum(y))/(N*sum(x^2) - sum(x)^2) which is 0/0 -- likewise NA. Hoping this helps, Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 09-Oct-09 Time: 22:41:37 -- XFMail -- __ 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] lm output
Daniel Thanks very much for the reply. If the data fails the underlying assumptions of regression wouldn't it make sense to suppress all the output and not just the slope coefficient? Incidently, if I run this simple example in Excel it returns the slope as 0. Intuitively, this makes sense to me ... the best estimate of y would be its mean for any value of x. Kind regards Pete -Original Message- From: Daniel Malter [mailto:dan...@umd.edu] Sent: Friday, October 09, 2009 4:24 PM To: Brecknock, Peter; r-help@r-project.org Subject: AW: [R] lm output That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now way to make this come out as a zero, because it fails the very assumptions of regression analysis. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Brecknock, Peter Gesendet: Friday, October 09, 2009 5:12 PM An: r-help@r-project.org Betreff: [R] lm output Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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-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] lm output
On 09-Oct-09 21:45:04, Brecknock, Peter wrote: Daniel Thanks very much for the reply. If the data fails the underlying assumptions of regression wouldn't it make sense to suppress all the output and not just the slope coefficient? Incidently, if I run this simple example in Excel it returns the slope as 0. So much the worse for Excel -- not the first time Excel has been found to produce nonsense! Intuitively, this makes sense to me ... the best estimate of y would be its mean for any value of x. On the contrary -- your data give you no information whatever about the value of y at any value of x other than x=5. So, given your data, if you want to predict the value of y for some other value of x, you can choose whatever value you like -- hence the indeterminate slope. And this is where the statement made by Excel is grossly misleading: telling you that the slope is 0 would make you adopt the same value (mean(y) = 13) for any value of x, and you have no basis whatever for doing so. Ted. Kind regards Pete -Original Message- From: Daniel Malter [mailto:dan...@umd.edu] Sent: Friday, October 09, 2009 4:24 PM To: Brecknock, Peter; r-help@r-project.org Subject: AW: [R] lm output That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now way to make this come out as a zero, because it fails the very assumptions of regression analysis. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Brecknock, Peter Gesendet: Friday, October 09, 2009 5:12 PM An: r-help@r-project.org Betreff: [R] lm output Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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-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. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 09-Oct-09 Time: 23:00:09 -- XFMail -- __ 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] plot the same types of graphics on the same R graphic device
?lines ?points Something like : x - 1:10 y1 - rnorm(10, 4, 3) y2 - rnorm(5,5,2) ymax - max(c(y1,y2)) ymin - min(c(y1,y2)) plot(x, y1, col='red',ylim = c(ymin,ymax)) lines(y2, col='green') --- On Fri, 10/9/09, carol white wht_...@yahoo.com wrote: From: carol white wht_...@yahoo.com Subject: [R] plot the same types of graphics on the same R graphic device To: r-h...@stat.math.ethz.ch Received: Friday, October 9, 2009, 5:10 PM Hi, How to plot the same types of graphics on the same R graphic device? Suppose that we want to plot a vector y against x (using plot for instance). How is it possible to plot y against x for different values of these two vectors on the same device so that the plots could be compared? Cheers, Carol [[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. __ Looking for the perfect gift? Give the gift of Flickr! http://www.flickr.com/gift/ __ 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] lm output
On Oct 9, 2009, at 5:45 PM, Brecknock, Peter wrote: Daniel Thanks very much for the reply. If the data fails the underlying assumptions of regression wouldn't it make sense to suppress all the output and not just the slope coefficient? Incidently, if I run this simple example in Excel it returns the slope as 0. Intuitively, this makes sense to me ... the best estimate of y would be its mean for any value of x. R gave you the best estimate for y. It was Excel that gave you an estimate for something for which it had no basis. There is no mean of dy/dx because dx=0. -- David. Kind regards Pete -Original Message- From: Daniel Malter [mailto:dan...@umd.edu] Sent: Friday, October 09, 2009 4:24 PM To: Brecknock, Peter; r-help@r-project.org Subject: AW: [R] lm output That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now way to make this come out as a zero, because it fails the very assumptions of regression analysis. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] Im Auftrag von Brecknock, Peter Gesendet: Friday, October 09, 2009 5:12 PM An: r-help@r-project.org Betreff: [R] lm output Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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-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.
Re: [R] lm output
Fair point. Thanks. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Friday, October 09, 2009 5:02 PM To: Brecknock, Peter Cc: Daniel Malter; r-help@r-project.org Subject: Re: [R] lm output On Oct 9, 2009, at 5:45 PM, Brecknock, Peter wrote: Daniel Thanks very much for the reply. If the data fails the underlying assumptions of regression wouldn't it make sense to suppress all the output and not just the slope coefficient? Incidently, if I run this simple example in Excel it returns the slope as 0. Intuitively, this makes sense to me ... the best estimate of y would be its mean for any value of x. R gave you the best estimate for y. It was Excel that gave you an estimate for something for which it had no basis. There is no mean of dy/dx because dx=0. -- David. Kind regards Pete -Original Message- From: Daniel Malter [mailto:dan...@umd.edu] Sent: Friday, October 09, 2009 4:24 PM To: Brecknock, Peter; r-help@r-project.org Subject: AW: [R] lm output That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now way to make this come out as a zero, because it fails the very assumptions of regression analysis. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] Im Auftrag von Brecknock, Peter Gesendet: Friday, October 09, 2009 5:12 PM An: r-help@r-project.org Betreff: [R] lm output Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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-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.
Re: [R] plot the same types of graphics on the same R graphic device
Hi Carol, It isn't at all clear exactly what you are trying to do, but you might want to read the help for either points() and lines() [to put more than one data pair on a single plot], or for par, specifically mfrow and mfcol, or for layout [to put more than one plot on a single device window]. If none of those do it, then try again with a more detailed description of what you are looking for. Sarah On Fri, Oct 9, 2009 at 5:10 PM, carol white wht_...@yahoo.com wrote: Hi, How to plot the same types of graphics on the same R graphic device? Suppose that we want to plot a vector y against x (using plot for instance). How is it possible to plot y against x for different values of these two vectors on the same device so that the plots could be compared? Cheers, Carol -- Sarah Goslee http://www.functionaldiversity.org __ 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 last status change, ctime on Windows?
On 09/10/2009 5:05 PM, johannes rara wrote: Hi, file.info is producing data.frame with ctime variable. Help file says that on Unix this is 'last status change' and on Windows 'creation time'. Is there a way to get 'last status change' on Windows using some R function? What does last status change mean on Windows? mtime is the last modification time; is that good enough? If mtime isn't what you want, describe some other way in Windows to get what you do want. You can't get something that the OS doesn't maintain. Duncan Murdoch __ 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] user input in R
I'm just learning R (I don't know any other programming languages), and I have a question. I am trying to figure out how to ask for user input (say, a set of 3 numbers) then put those numbers into an array. I've looked around, but I haven't been able to find any answers that I understand. Thanks! __ 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] regressions on large dataframe: speed?
Dear R Helpers, I have a pretty large dataframe (150,000 variables, 10,000 entries for each) and have to run a regression on each of the variables. Recorded are the pvals. I wrote a function and use sapply. The function looks something like this: calcpval-function(x){ modela - lm(apples~age,data=m) modelb - lm(apples~age+ageSquared,data=m) modelc - lm(apples~age+ageSquared+bmi,data=m) p_main - anova(modela,modelb)$P[2] p_main_i - anova(modela,modelc)$P[2] p_i - anova(modelb,modelc)$P[2] return(c(p_main,p_main_i,p_i)) } This whole thing is terribly slow... I observed that it's faster when breaking down the file. But other suggestions could you please make to make it run faster (say days instead of weeks). Thank you and best regards, Georg. * Georg Ehret, Johns Hopkins Medicine [[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.
Re: [R] user input in R
On Oct 9, 2009, at 6:36 PM, Sharon Beckett wrote: I'm just learning R (I don't know any other programming languages), and I have a question. I am trying to figure out how to ask for user input (say, a set of 3 numbers) then put those numbers into an array. I've looked around, but I haven't been able to find any answers that I understand. Thanks! I am guessing that your version of looking around did not include going to r-search and typing in user input because when you do, you quite a bit: http://search.r-project.org/cgi-bin/namazu.cgi?query=%22user+input%22max=100result=normalsort=scoreidxname=functionsidxname=Rhelp08idxname=views You could also try this at the console: ??input Or even ??user input Althought the last one does not give you very much, it still has a link to readline in the first offered hit on my system. Also possible would be to install package sos and then try: ???user input ... which in this case gives you way too many hits. -- 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.
Re: [R] odfWeave XML error in post-processing
Just so we complete (partially) the web-record... Some further hunting determined that the apos was an apostrophe - obvious only in retrospect! Removal of this character has resolved the Entity errors, but not the xmlParseStartTag: invalid element name errors. I had assumed that the two errors were dependent, but they are not. odfWeave does have some ability with its translate command to address some XML/OO special characters, but I have not explored this facet of odfWeave yet, and I was a bit surprised that the use of this common grammatical mark generated an error, but.. Now, in search of a cause for the invalid element name error(s). Thanks to Duncan for his help. Duncan Temple Lang wrote: Hi Rob. Without the file content_1.xml or any information from the R call stack (e.g. options(error = recover) and then run the command and dynamically explore the state of affairs when the error occurs), there is no way for us to know what the problem might be. Somehow, the XML parser appears to be seeing a token and token is not a legitimate XML element name. It may also be seeing apos; which would identify an XML entity. Assuming that this is what the XML parser is seeing, the question is how they got into the document. So we need more to start diagnosing the problem. D. Rob James wrote: I've been happily building a file with odfWeave, and just as the hour draws nigh for it to be sent off, odfWeave or XML throws the following catastrophic error: ...this is the tail of entirely uneventful processing of input file. 31 : term xml(label=LR_Fall_Model_Results) 32 : term verbatim(label=LR_Model_Fall_graph) 33 : term xml(label=LR_OMC_tab) 'content_1.xml' has been Sweaved Removing content.xml Post-processing the contents xmlParseStartTag: invalid element name Entity 'apos' not defined Entity 'apos' not defined This triplet of errors XMLParse, and duplicate Entity lines is reported several times, then XML or odfWeave packs up its toys, and goes home without an output file. I'd (desperately) love any insights anyone might have. Thanks, Rob __ 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.
Re: [R] Satellite ocean color palette?
tim.colors() in library fields On Fri, Oct 9, 2009 at 2:51 PM, Tim Clark mudiver1...@yahoo.com wrote: Dear List, Is there a color palette avaliable similar to what is used in satellite ocean color imagery? I.e. a gradient with blue on one end and red on the other, with yellow in the middle? I have tried topo.colors(n) but that comes out more yellow on the end. I am looking for something similar to what is found on the CoastWatch web page: http://oceanwatch.pifsc.noaa.gov/imagery/GA2009281_2009282_sst_2D_eddy.jpg Thanks! Tim Tim Clark Department of Zoology University of Hawaii __ 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.
Re: [R] Creating a Clustered-Stacked Column Chart
Thanks a lot. Maybe someone else has the method to solve that. 2009/10/9 John Kane jrkrid...@yahoo.ca I don't think I've seen an R version, probably because the technique is not very good for displaying data. Have a look at http://chartsgraphs.wordpress.com/tag/r-and-excel/ for an alternative method of displaying the data using lattice. --- On Fri, 10/9/09, zhijie zhang rusers...@gmail.com wrote: From: zhijie zhang rusers...@gmail.com Subject: [R] Creating a Clustered-Stacked Column Chart To: r-h...@stat.math.ethz.ch Received: Friday, October 9, 2009, 5:31 AM Hi all, In R, is there some functions or ways to create a Clustered-Stacked Column Chart as the example in the following page http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html? I have browsed the R Graph Gallery ( http://addictedtor.free.fr/graphiques/) and searched the R site, and didnot find an appropriate method to do it. Anybody has met this problem before? Thanks a lot. [[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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ [[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] Fwd: Creating a Clustered-Stacked Column Chart
-- Forwarded message -- From: Khanh Nguyen kngu...@cs.umb.edu Date: Fri, Oct 9, 2009 at 10:10 PM Subject: Re: [R] Creating a Clustered-Stacked Column Chart To: zhijie zhang rusers...@gmail.com May be you can try to look into ggplot2 http://had.co.nz/ggplot2/position_fill.html -k On Fri, Oct 9, 2009 at 9:57 PM, zhijie zhang rusers...@gmail.com wrote: Thanks a lot. Maybe someone else has the method to solve that. 2009/10/9 John Kane jrkrid...@yahoo.ca I don't think I've seen an R version, probably because the technique is not very good for displaying data. Have a look at http://chartsgraphs.wordpress.com/tag/r-and-excel/ for an alternative method of displaying the data using lattice. --- On Fri, 10/9/09, zhijie zhang rusers...@gmail.com wrote: From: zhijie zhang rusers...@gmail.com Subject: [R] Creating a Clustered-Stacked Column Chart To: r-h...@stat.math.ethz.ch Received: Friday, October 9, 2009, 5:31 AM Hi all, In R, is there some functions or ways to create a Clustered-Stacked Column Chart as the example in the following page http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html? I have browsed the R Graph Gallery ( http://addictedtor.free.fr/graphiques/) and searched the R site, and didnot find an appropriate method to do it. Anybody has met this problem before? Thanks a lot. [[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 http://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ [[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. [[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.
Re: [R] Creating a Clustered-Stacked Column Chart
library(lattice) barchart(Titanic, scales = list(x = free), auto.key = list(title = Survived)) Or if you prefer vertical: barchart(Titanic, scales = list(x = free), auto.key = list(title = Survived), horizontal=FALSE) There are adjustments available to the space between bars. barchart(Titanic, scales = list(x = free), auto.key = list(title = Survived), horizontal=FALSE, box.ratio=100) On Oct 9, 2009, at 9:57 PM, zhijie zhang wrote: Thanks a lot. Maybe someone else has the method to solve that. 2009/10/9 John Kane jrkrid...@yahoo.ca I don't think I've seen an R version, probably because the technique is not very good for displaying data. Have a look at http://chartsgraphs.wordpress.com/tag/r-and-excel/ for an alternative method of displaying the data using lattice. --- On Fri, 10/9/09, zhijie zhang rusers...@gmail.com wrote: From: zhijie zhang rusers...@gmail.com Subject: [R] Creating a Clustered-Stacked Column Chart To: r-h...@stat.math.ethz.ch Received: Friday, October 9, 2009, 5:31 AM Hi all, In R, is there some functions or ways to create a Clustered-Stacked Column Chart as the example in the following page http://peltiertech.com/Excel/ChartsHowTo/ClusterStack.html? I have browsed the R Graph Gallery ( http://addictedtor.free.fr/graphiques/) and searched the R site, and didnot find an appropriate method to do it. Anybody has met this problem before? Thanks a lot. [[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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ Get the name you've always wanted @ymail.com or @rocketmail.com! Go to http://ca.promos.yahoo.com/jacko/ [[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. 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.
Re: [R] Help with printing fixed width
On 10/09/2009 11:36 PM, sahil seth wrote: Hello R users, I am writing a summary() for a custom class, and am to display the integers right justified, Say where x is the vector with integers, I am using the following: cat(\t,format(x),\t...other columns) this way I am trying to pass the format(x), to the cat function to display it, but still I am getting a kink(b/w the 9th and 10th row). 6 81 170 251 1.998026e-08 7 26 93 119 4.937587e-10 8 96 209 305 8.750939e-11 9 94 211 305 1.758285e-11 10 88 205 293 6.47853e-12 11 82 244 326 7.943691e-20 12 57 145 202 4.964509e-10 Thanks, HI Sahil, The kink is due to the fact that each row is being formatted separately. You may notice that there is a kink in row 7 as well, due to the same problem. What you may want to do is use formatC instead of format like this: cat(formatC(x,width=10),...,rep( ,6),last number,\n,sep=) Jim __ 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] lm output
No, actually it does better to not suppress all output, because it tells you where the trouble comes from by just showing the NA for the slope. The intercept the regression gives you is the mean of y in this case. As for the slope, Ted's graphic is illustrative as to why no slope can be estimated. Overall, I would say the output makes sense. Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: Brecknock, Peter [mailto:peter.breckn...@bp.com] Gesendet: Friday, October 09, 2009 5:45 PM An: Daniel Malter; r-help@r-project.org Betreff: RE: [R] lm output Daniel Thanks very much for the reply. If the data fails the underlying assumptions of regression wouldn't it make sense to suppress all the output and not just the slope coefficient? Incidently, if I run this simple example in Excel it returns the slope as 0. Intuitively, this makes sense to me ... the best estimate of y would be its mean for any value of x. Kind regards Pete -Original Message- From: Daniel Malter [mailto:dan...@umd.edu] Sent: Friday, October 09, 2009 4:24 PM To: Brecknock, Peter; r-help@r-project.org Subject: AW: [R] lm output That comes out as an NA because X'X is not invertible because it is not full rank (one row/column is a linear combination of the other(s)). And that means there is no unique solution to the system. y=c(10,12,17) x=c(5,5,5) X=cbind(1,x) X t(X)%*%X solve(t(X)%*%X) Therefore, nope, there is now way to make this come out as a zero, because it fails the very assumptions of regression analysis. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Brecknock, Peter Gesendet: Friday, October 09, 2009 5:12 PM An: r-help@r-project.org Betreff: [R] lm output Hi All I am running a linear regression using the lm object. In the event that my independent variable is the same across all observations the regression slope is returned as an NA. For example, if I have the following y=c(10,12,17) x=c(5,5,5) lm = lm(y~x) produces the following Coefficients: (Intercept)x 13 NA Other than post-processing the results, is there a way to output the slope as 0 rather than NA? Thanks Pete This e-mail may contain confidential or proprietary information belonging to the BP group and is intended only for the use of the recipients named above. If you are not the intended recipient, please immediately notify the sender and either delete this email or return to the sender immediately. You may not review, copy or distribute this email. Within the bounds of law, this part of BP retains all emails and IMs and may monitor them to ensure compliance with BP's internal policies and for other legitimate business purposes. [[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-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] Running R scripts from a GUI interface
It appears several that of my scripts are beginning to reaching maturity, so I am curious if it is possible to add an external GUI to run the scripts from this simplified GUI interface. The scripts are fairly rudimentary so the GUI only needs a few radial buttons and a could of numeric fields. I am curious if there is a typical approach for developing a GUI to run R scripts or to export R scripts in a DLL or other format so that they can be run from such a GUI. I also have not settled on a GUI development language so any suggestions there are also very much appreciated. Thank you again for any feedback and insights, especially if there is a blog or book that covers these topics. __ 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 last status change, ctime on Windows?
On Fri, 9 Oct 2009, Duncan Murdoch wrote: On 09/10/2009 5:05 PM, johannes rara wrote: Hi, file.info is producing data.frame with ctime variable. Help file says that on Unix this is 'last status change' and on Windows 'creation time'. No, that is not what it says. It actually says What is meant by the three file times depends on the OS and file system. On Windows 'ctime' is the creation time. The POSIX standard 1003 uses these terms, and its definitions are at http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_07 but of course Windows does not claim to be POSIX-compliant. So the help page is answering Duncan's question What does last status change mean on Windows? by saying that on Windows 'last status change' means 'creation time'. Unix-alikes differ in what they say about ctime, but for example Linux says The field st_ctime is changed by writing or by setting inode information (i.e., owner, group, link count, mode, etc.). Windows does not have inodes nor most of those concepts ... so we need to look at what its system documentation (MSDN) says it returns in the field st_ctime of its 'stat' system call. Other sources suggest that MSDN is wrong and st_ctime returns 'creation time' only on Windows' native file systems: but that possibility is covered by the two sentences quoted. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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.