Re: [R] [ggplot2] Wind rose orientation

2009-12-03 Thread Thomas S. Dye
Hi Hadley, That solved a lot of problems. Thanks! Do you get a vertically oriented bar? Here I get 15 bars with a space where the north bar, the 16th bar, should be. All the best, Tom On Dec 3, 2009, at 8:16 PM, hadley wickham wrote: Hi Thomas, Ok, the key thing that you were missing w

Re: [R] R and eclipse

2009-12-03 Thread Romain Francois
On 12/03/2009 08:43 PM, Gene Leynes wrote: I thought of your email when I ran across this link: http://romainfrancois.blog.free.fr/index.php?post/2009/09/02/R-capable-version-of-ant I don't understand why you post this link with regards to this question. The link is about the ant package that

Re: [R] Incorporating the results of White's HCCM into a linear regression:

2009-12-03 Thread Yoseph Zuback
Hi Frank, I'm trying to repair heteroscedastic variables using the hccm. A statistician in my department gave an incomplete solution that included: OLS1$coefficients/(sqrt(hccm(OLS1))) Trying to solve my problem I get different results with the method you gave me and what I am trying with the c

Re: [R] shorten str() output for long list

2009-12-03 Thread Henrik Bengtsson
str(head(x)) str(head(x, n=5)) /H On Thu, Dec 3, 2009 at 10:18 PM, David Winsemius wrote: > > On Dec 3, 2009, at 10:11 PM, Peng Yu wrote: > >>> x=split(1:1000,1:1000) >>> str(x) >> >> Although str() can suppress long output for vectors, but it can not >> suppress long output for list. I'm wonde

Re: [R] shorten str() output for long list

2009-12-03 Thread Peng Yu
On Fri, Dec 4, 2009 at 12:18 AM, David Winsemius wrote: > > On Dec 3, 2009, at 10:11 PM, Peng Yu wrote: > >>> x=split(1:1000,1:1000) >>> str(x) >> >> Although str() can suppress long output for vectors, but it can not >> suppress long output for list. I'm wondering how to suppress the >> output fo

[R] Lattice : Help with changing the labels of x-axis in respective panels

2009-12-03 Thread Sunny Srivastava
Dear R-Helpers, I am not very experienced in using lattice and I am still in the learning stage I have a data set which looks like this: (I have deleted a few lines in order to save space) Chromosome marker Marker.Name Distance 1 1 1 PeMm261 0. 2 1 2

Re: [R] shorten str() output for long list

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 10:11 PM, Peng Yu wrote: x=split(1:1000,1:1000) str(x) Although str() can suppress long output for vectors, but it can not suppress long output for list. I'm wondering how to suppress the output for long lists. Very simple ... You examine the code (for str.default it's no

Re: [R] [ggplot2] Wind rose orientation

2009-12-03 Thread hadley wickham
Hi Thomas, Ok, the key thing that you were missing was: scale_x_continuous(limits = c(0, 360)) Since you don't have any data at 0, and because ggplot2 doesn't know that your variable had intrinsic meaning as a degree, it was starting zero degrees at 22.5. A few other tweaks below: wind.data$wi

Re: [R] Speed of accessing list element by index or name

2009-12-03 Thread Jorge Ivan Velez
One way to answer it would be comparing: system.time(replicate(10^5, l[[1]] ) ) system.time(replicate(10^5, l[['name']] ) ) HTH, Jorge On Fri, Dec 4, 2009 at 1:01 AM, Peng Yu <> wrote: > I'm wondering if the speed of accessing list element by index is the > same as that of accessing list eleme

Re: [R] Speed of accessing list element by index or name

2009-12-03 Thread Sharpie
pengyu.ut wrote: > > I'm wondering if the speed of accessing list element by index is the > same as that of accessing list element by name. > > l[[1]] > l[['name']] > Have you tried answering this question yourself using the system.time() function? -- View this message in context: http://n4

Re: [R] how to calculate covariance matrix in R? why cov doesn't work

2009-12-03 Thread Jorge Ivan Velez
Try this: a <- c(9,3,5) b<-c(3,4,1) cbind(a, b) # a b # [1,] 9 3 # [2,] 3 4 # [3,] 5 1 cov(cbind(a, b)) # a b # a 9.333 -0.667 # b -0.667 2.333 HTH, Jorge On Thu, Dec 3, 2009 at 11:29 PM, aegea <> wrote: > > Hello, > > Sorry. It may be a stupid question

Re: [R] [ggplot2] Wind rose orientation

2009-12-03 Thread Thomas S. Dye
Aloha Hadley, Thanks very much for ggplot. It's a terrific piece of work. Specifying width = 1 in the call to geom_bar didn't change the orientation of the coordinates. If you run the example, you'll see that 100 is horizontal, where 90 would be on the compass. Here is a reproducible e

[R] Speed of accessing list element by index or name

2009-12-03 Thread Peng Yu
I'm wondering if the speed of accessing list element by index is the same as that of accessing list element by name. l[[1]] l[['name']] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] how to seperate a matrix

2009-12-03 Thread Jorge Ivan Velez
Hi aegea, Here is one: m <- structure(c(6, 5, 20, 7, 8, 25, 14, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 7), .Dim = c(7L, 3L)) m1 <- m[m[,1] >= m[,2], ] m1 m2 <- m[m[,1] < m[,2], ] m2 Best, Jorge On Thu, Dec 3, 2009 at 10:12 PM, aegea <> wrote: > > Hello, > > I am working on seperate the

Re: [R] how to seperate a matrix

2009-12-03 Thread milton ruser
Hi there, mymat<-matrix(c(6,8,1, 5,9,2, 20,10,3, 7,11,4, 8,12,5, 25,13,6, 14,14,7), byrow=T, ncol=3) mymat1<-mymat[mymat[,1]=mymat[,2],] mymat2 bests milton On Thu, Dec 3, 2009 at 10:12 PM, aegea wrote: > > Hello, > > I am working on seperate the matrix to two matrices but got trouble on > do

Re: [R] Avoiding singular fits in rlm

2009-12-03 Thread Matt Crawford
Thanks, that was right (factor levels with no data). I forgot or didn't know that when data gets changed, the factor levels don't get changed as well. I'm sorry about missing parts of the Posting Guide. Matt Crawford On Wed, Dec 2, 2009 at 10:45 PM, Prof Brian Ripley wrote: > There is something

[R] Get back to the console with ssh access

2009-12-03 Thread Timothée Poisot
Dear R users, I am currently learning how to work with a new shared computer (a Mac pro) in our lab, that is dedicated to execute R code for large simulations (over a few days). We have a VNC option to remote control the computer, with a shared used session, but this is not really needed in mo

Re: [R] suggestion for analysis ....MANOVA ?

2009-12-03 Thread ychu066
up up up .. ychu066 wrote: > > Hi eveyone, > > I am currently working with a porject which requires me to compare 6 > profiles which have 146 response variables . . . where profile one, two > and three are tested on the same day say Day1 but ptofile five and six are > on different days say Day

[R] how to seperate a matrix

2009-12-03 Thread aegea
Hello, I am working on seperate the matrix to two matrices but got trouble on doing it. Please give me some suggestions on doing this. Thanks a lot! My original matrix m is as follows for example, [,1] [,2] [,3] [1,]681 [2,]592 [3,]20 103 [4,]

[R] how to calculate covariance matrix in R? why cov doesn't work

2009-12-03 Thread aegea
Hello, Sorry. It may be a stupid question. I have two vectors a<-c(9,3,5) b<-c(3,4,1) How can I get the variance-covariance matrix of these two vectors? I tried cov(a,b), I got a number not a matrix. I tried to transpose vector a and b as t(a) and t(b), it still cannot work. Any suggestions? T

[R] Re shorten str() output for long list

2009-12-03 Thread Charlotte Maia
I doubt str is intended to work the way you want it to. I certainly wouldn't use it that way. The choice of data structure here is inappropriate, use a vector not a list. If you absolutely must do what you are asking, then simply write your own function. Use a heuristic for object length, say if

Re: [R] How to get a matrix by sapply (with strsplit)?

2009-12-03 Thread hadley wickham
> I'm not sure what the other lines(but the last) have to do anything, but are > you looking for something like this: > > do.call(rbind, sapply(paste(1:10, 1:10), strsplit, split=' ')) strsplit is already vectorised wrt its first argument, so all you need is: do.call(rbind, strsplit(paste(1:10,

Re: [R] Data Manipulation Question

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 10:52 PM, Gray Calhoun wrote: The data import/export manual can elaborate on a lot of these; this is all straightforward, although many people would prefer to use a relational database for some of the things you mentioned. See Wickham's pithy response to this. I'm not awa

Re: [R] How to get a matrix by sapply (with strsplit)?

2009-12-03 Thread Steve Lianoglou
Hi, On Dec 4, 2009, at 12:10 AM, Peng Yu wrote: > I want a command (last line) that can return a matrix. I'm wondering > if there is a way to do so. > > g<-function(x) { > c(x,x) > } > lapply(1:10,g) > sapply(1:10,g) > > sapply(paste(1:10, 1:10), strsplit, split=' ')# I want a command that > r

[R] How to get a matrix by sapply (with strsplit)?

2009-12-03 Thread Peng Yu
I want a command (last line) that can return a matrix. I'm wondering if there is a way to do so. g<-function(x) { c(x,x) } lapply(1:10,g) sapply(1:10,g) sapply(paste(1:10, 1:10), strsplit, split=' ')# I want a command that returns a matrix __ R-help@

Re: [R] Can we get rid of bar charts with error bars?

2009-12-03 Thread Frank E Harrell Jr
Jim Lemon wrote: On 12/04/2009 12:56 AM, Frank E Harrell Jr wrote: Bar charts with error bars are far inferior to dot charts and other types of displays. One of many problems is demonstrated if you draw a bar chart displaying temperature in F then re-draw it on the degrees C scale. See http:

[R] Re Off topic - Compendium of distributions

2009-12-03 Thread Charlotte Maia
Hi, I am going to sound mean here, however I don't feel the document is "very comprehensive". Maybe concise is a better word. I quickly looked through the document. The biggest problem is that there is very little discussion on multivariate distributions. Noting that multivariate distributions p

Re: [R] how to use different ylim scales on a lattice bwplot?

2009-12-03 Thread Deepayan Sarkar
On Thu, Dec 3, 2009 at 2:32 PM, Felix Andrews wrote: > You can define a custom prepanel function: see the entry for > 'prepanel' in ?xyplot > > If you just want to set specified ylims in each panel, you can do that > by passing a list to 'ylim'. All this assuming, of course, that scales="free" is

Re: [R] Data Manipulation Question

2009-12-03 Thread Gray Calhoun
The data import/export manual can elaborate on a lot of these; this is all straightforward, although many people would prefer to use a relational database for some of the things you mentioned. I'm not aware of a "goto" command in R, though (although I could be wrong). --Gray On Thu, Dec 3, 2009 a

Re: [R] Lattice: multiple data sets on same plot

2009-12-03 Thread Felix Andrews
As a non-statistician, here is my naive method: densityplot(~ value | cat1 * cat2, xx, groups = paste(variable, which), from = 0, to = 360, bw = 100, panel = function(x, ...) panel.densityplot(c(x-360,x,x+360), ...), plot.points = FALSE, auto.key = list(columns=2), par.settings = s

Re: [R] How to exclude lines that match certain regex when using read.table?

2009-12-03 Thread Gabor Grothendieck
Using grep in a pipeline is pretty fast so if that is workable that is probably the way to go; however, one other possibility is to use read.csv.sql from the sqldf package. read.csv.sql allows you to specify an sql statement that it will use to filter the data. It reads the data into a temporary

Re: [R] How to exclude lines that match certain regex when using read.table?

2009-12-03 Thread Peng Yu
On Thu, Dec 3, 2009 at 9:09 PM, Sharpie wrote: > > > pengyu.ut wrote: >> >> I'm thinking of using external program 'grep' and pipe() to do so. But >> I'm wondering if there is a more efficient way to do so purely in R >> > > I would just suck the whole table in using read.table(), locate the lines

[R] shorten str() output for long list

2009-12-03 Thread Peng Yu
> x=split(1:1000,1:1000) > str(x) Although str() can suppress long output for vectors, but it can not suppress long output for list. I'm wondering how to suppress the output for long lists. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailm

Re: [R] How to exclude lines that match certain regex when using read.table?

2009-12-03 Thread Sharpie
pengyu.ut wrote: > > I'm thinking of using external program 'grep' and pipe() to do so. But > I'm wondering if there is a more efficient way to do so purely in R > I would just suck the whole table in using read.table(), locate the lines that I don't want using apply() and grepl() and then red

Re: [R] Naming conventions for R?

2009-12-03 Thread Sharpie
pengyu.ut wrote: > > On Thu, Dec 3, 2009 at 8:27 PM, Sharpie wrote: >> You should browse this thread: >> >>  http://n4.nabble.com/Google-s-R-Style-Guide-td901694.html#a901694 >> >> It was a pretty thorough discussion of style different guides for R. > > Why variables has to be of the form some

Re: [R] Can we get rid of bar charts with error bars?

2009-12-03 Thread Jim Lemon
On 12/04/2009 12:56 AM, Frank E Harrell Jr wrote: Bar charts with error bars are far inferior to dot charts and other types of displays. One of many problems is demonstrated if you draw a bar chart displaying temperature in F then re-draw it on the degrees C scale. See http://biostat.mc.vande

Re: [R] Naming conventions for R?

2009-12-03 Thread Peng Yu
On Thu, Dec 3, 2009 at 8:27 PM, Sharpie wrote: > > > pengyu.ut wrote: >> >> There are documents for naming conventions for other languages. I'm >> wondering if there is a document that clearly describes the >> recommended naming convention for R. >> > > > You should browse this thread: > >  http:/

Re: [R] Lattice: multiple data sets on same plot

2009-12-03 Thread Joel Thomas
Thank you! Worked perfectly. Is it also possible to do the same but for circular data, for example, a density plot of circular object from the circular package using a trellis display. I have the same set of data but var1 and var2 are azimuth directions 0-360 so a standard density plot doesn't make

Re: [R] [ggplot2] Wind rose orientation

2009-12-03 Thread hadley wickham
Hi Thomas, I suspect you want geom_bar(stat = "identity", width = 1), but it's hard to be sure without a reproducible example. Hadley On Thu, Dec 3, 2009 at 8:18 PM, Thomas S. Dye wrote: > Aloha all, > > I love using ggplot.  It took a while to get used to the grammar of > graphics, but it is

[R] How to exclude lines that match certain regex when using read.table?

2009-12-03 Thread Peng Yu
I'm thinking of using external program 'grep' and pipe() to do so. But I'm wondering if there is a more efficient way to do so purely in R __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Naming conventions for R?

2009-12-03 Thread Sharpie
pengyu.ut wrote: > > There are documents for naming conventions for other languages. I'm > wondering if there is a document that clearly describes the > recommended naming convention for R. > You should browse this thread: http://n4.nabble.com/Google-s-R-Style-Guide-td901694.html#a901694

[R] [ggplot2] Wind rose orientation

2009-12-03 Thread Thomas S. Dye
Aloha all, I love using ggplot. It took a while to get used to the grammar of graphics, but it is starting to get easy now that I am thinking in a more structured way. A question. I'm making a wind rose that I'd like to be oriented with due north straight up. I've discovered that the ori

Re: [R] Normal tests disagree?

2009-12-03 Thread GlenB
And now some advice: I'm of the opinion that one should only in very rare circumstances be doing hypothesis testing of distributions. For example, the most common reason people give for doing a hypothesis test of the distribution of a sample is that they want to check the appropriateness of the

[R] R igraph clusters component

2009-12-03 Thread Gaurav Kumar
Hi R-users, I'm using igraph for an undirected graph. i used clusters() igraph function to know the component size(subgraphs) as shown bellow: c <-clusters(g)    # component sizes size <- sort(c$csize, decreasing=TRUE) cat("Top 20 cluster of the graph","\n") for (i in 1:20) {   cat(i,"  size:",s

[R] Naming conventions for R?

2009-12-03 Thread Peng Yu
There are documents for naming conventions for other languages. I'm wondering if there is a document that clearly describes the recommended naming convention for R. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Scraping a web page

2009-12-03 Thread Duncan Temple Lang
Hi Michael If you just want all of the text that is displayed in the HTML docment, then you might use an XPath expression to get all the text() nodes and get their value. An example is doc = htmlParse("http://www.omegahat.org/";) txt = xpathSApply(doc, "//body//text()", xmlValue) The resul

[R] Rounding a Measurement to be Consistent with its Uncertainty

2009-12-03 Thread Tom La Bone
I have a measurement of 8165.666 and an uncertainty of 338.9741 (the units of both are unimportant). I can easily round the uncertainty to two significant digits with signif(338.9741,2), which gives 340. Is there a function in R that will take 8165.666 and round it to be consistent with its uncert

Re: [R] Scraping a web page

2009-12-03 Thread hadley wickham
> If you're after text, then it's probably a matter of locating the element > that encloses the data you want-- perhaps by using getNodeSet along with an > XPath[1] that specifies the element you are interest with.  The text can > then be recovered using the xmlValue() function. And rather than tr

Re: [R] [Rd] Error in namespaceExport(ns, exports) :

2009-12-03 Thread Tony Plate
Try looking in the NAMESPACE file (in the same directory as the DESCRIPTION file). -- Tony Plate David Scherrer wrote: Dear all, I get the error "Error in namespaceExport(ns, exports) : undefined exports function1 , function2" when compiling or even when I roxygen my package. The two func

[R] Passing arguments to gpar

2009-12-03 Thread Sebastien Bihorel
Dear R-users, I would like to know how to pass arguments to gpar() without hard-coding them. I tried to store my arguments in a list and passed this list to gpar(), but it did find the way to do it properly. Any help would be appreciated. a<- list(fontisze=8,col=3) gpar(fontsize=8,col=3) gpa

Re: [R] Scraping a web page

2009-12-03 Thread Sharpie
Michael Conklin wrote: > > I would like to be able to submit a list of URLs of various webpages and > extract the "content" i.e. not the mark-up of those pages. I can find > plenty of examples in the XML library of extracting links from pages but I > cannot seem to find a way to extract the text

[R] Off topic - Compendium of distributions

2009-12-03 Thread Francisco J. Zagmutt
This is not an R related posting but I thought it would be interesting for readers of this list. Apologies for any cross-posting Dear all Our company Vose Software has just made a very comprehensive “Compendium of Distributions” available for free online at www.vosesoftware.com/content/ebook

Re: [R] Scraping a web page

2009-12-03 Thread Gabor Grothendieck
If you only need to grab text it can be conveniently done with lynx. This example is for Windows but its nearly the same on other platforms: > out <- shell("lynx.bat --dump --nolist http://www.google.com";, intern = TRUE) > head(out) [1] "" [2] " Web Images Videos Maps News Books Gmail more »"

Re: [R] corrupted matrix data.. sporadic result appears to be pairs of decimal numbers glommed together

2009-12-03 Thread jim holtman
Those appear to be complex numbers; some place in your script you must be computing something that return a complex number. Do an str on the matrix to see what it says; see if it says this: > x.1 [,1] [,2] [1,] 0.1820848-0.032i 0.1820848-0.032i [2,] 0.

Re: [R] dataset index

2009-12-03 Thread Lisa
Thank you for your help. Your script works very well. Lisa jholtman wrote: > > Does this do what you want: > >> x <- matrix(c( > + 0, 0, 0, > + 0, 0, 0, > + 0, 1, 0, > + 0, 1, 0, > + 0, 1, 0, > + 1, 2, 1, > + 1, 2, 1, > + 1, 3, 1, > + 1, 3, 1, > + 1, 3, 1), > + ncol = 3, byrow = T, > + dimn

[R] Question about R Functions

2009-12-03 Thread Stephanie Cooke
Is there a place to find the code for R functions like lsoda? 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, min

Re: [R] Multiple grouping on the X axis.

2009-12-03 Thread Munin
This looks like exactly what I was looking for, except I forgot to mention that they are looking for box-plots. Any ideas on a package that can do the same kind of organization but with box-plots? Jim Lemon wrote: > > Hi Munin, > Look at hierobarp in the plotrix package. The current version do

[R] corrupted matrix data.. sporadic result appears to be pairs of decimal numbers glommed together

2009-12-03 Thread Stephen Grubb
Hello, We are occasionally getting matrix results that appear to be corrupted... here are the last several rows of an example. These are supposed to be floating point numbers. [25015,] 1.820848e-01-3.2090e-06i [25016,] 2.178046e-01-4.8140e-06i [25017,] 1.820848e-01-3.2090e-06i [25018,] 1.

[R] Tobit model fluid milk consumption

2009-12-03 Thread mrsilva
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 Tobit model.pdf Description: Adobe PDF document _

Re: [R] Arules - Association Rules

2009-12-03 Thread Alexandre - UEL
Hi I'm a windows XP user. My notebook have 1gb ram, 160gb hd, processor amd turion64 1,6gh. For processing, it takes about 40 minutes. This is the code i used: dados=read.csv("C:/Documents and Settings/Administrador/Meus documentos/My Dropbox/Estatística/Association Rules/Top2009 alterado.csv", h

Re: [R] Arules - Association Rules

2009-12-03 Thread Alexandre Shimada
Hi I'm a windows XP user. My notebook have 1gb ram, 160gb hd, processor amd turion64 1,6gh. For processing, it takes about 40 minutes. This is the code i used: dados=read.csv("C:/Documents and Settings/Administrador/Meus documentos/My Dropbox/Estatística/Association Rules/Top2009 alterado.csv", h

[R] Please help with AR(2)

2009-12-03 Thread PeterS
I need help in interpreting AR(2) model which is of a form y=phi2(t-2)+e... I can't get past the fact that phi1 is missing -does it mean that phi1 = 0? why would that be a case? Thank you all in advance! -- View this message in context: http://n4.nabble.com/Please-help-with-AR-2-tp947912p947912.

Re: [R] dataset index

2009-12-03 Thread Charles C. Berry
On Thu, 3 Dec 2009, Lisa wrote: Hello, All, I have a dataset that looks like this: x <- matrix(c( 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1), ncol = 5, byrow = T, dimnames = list(1:10, c("gender", "race", "disease"))) I want to write a function

Re: [R] how to use different ylim scales on a lattice bwplot?

2009-12-03 Thread Felix Andrews
You can define a custom prepanel function: see the entry for 'prepanel' in ?xyplot If you just want to set specified ylims in each panel, you can do that by passing a list to 'ylim'. 2009/12/4 : > A colleague is interested in modifying the ylim definition for individual > panels of a common bwp

Re: [R] Question about R Functions

2009-12-03 Thread David Winsemius
http://search.r-project.org/cgi-bin/namazu.cgi?query=lsoda&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08&idxname=views On Dec 3, 2009, at 5:26 PM, Stephanie Cooke wrote: Is there a place to find the code for R functions like lsoda? Thanks __

Re: [R] Question about R Functions

2009-12-03 Thread Ista Zahn
Yep! just do RSiteSeqarch("lsoda") -Ista On Thu, Dec 3, 2009 at 5:26 PM, Stephanie Cooke wrote: > Is there a place to find the code for R functions like lsoda? Thanks > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r

[R] Scraping a web page

2009-12-03 Thread Michael Conklin
I would like to be able to submit a list of URLs of various webpages and extract the "content" i.e. not the mark-up of those pages. I can find plenty of examples in the XML library of extracting links from pages but I cannot seem to find a way to extract the text. Any help would be greatly appr

[R] Revolutions blog: November roundup

2009-12-03 Thread David M Smith
I write about R every weekday at the Revolutions blog: http://blog.revolution-computing.com . In case you missed them, here are some articles from last month of particular interest to R users. http://bit.ly/un680 demonstrated reader Paul Bleicher's code for visualizing a time series as a heat-map

Re: [R] dataset index

2009-12-03 Thread jim holtman
Does this do what you want: > x <- matrix(c( + 0, 0, 0, + 0, 0, 0, + 0, 1, 0, + 0, 1, 0, + 0, 1, 0, + 1, 2, 1, + 1, 2, 1, + 1, 3, 1, + 1, 3, 1, + 1, 3, 1), + ncol = 3, byrow = T, + dimnames = list(1:10, c("gender", "race", "disease"))) > key <- apply(x, 1, paste, collapse=":") > m.flags <- lapply(

[R] Question about R Functions

2009-12-03 Thread Stephanie Cooke
Is there a place to find the code for R functions like lsoda? 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, min

[R] dataset index

2009-12-03 Thread Lisa
Hello, All, I have a dataset that looks like this: x <- matrix(c( 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 2, 1, 1, 2, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1), ncol = 5, byrow = T, dimnames = list(1:10, c("gender", "race", "disease"))) I want to write a function to produce several matrices inc

Re: [R] Data Manipulation Question

2009-12-03 Thread Jason Morgan
Please refrain from posting HTML. The results can be incomprehensible: On 2009.12.03 13:52:09, John Filben wrote: > Can R support data manipulation programming that is available in the SAS > datastep??? Specifically, can R support the following: > -?? Read multiple dataset one rec

Re: [R] Data Manipulation Question

2009-12-03 Thread hadley wickham
On Thu, Dec 3, 2009 at 3:52 PM, John Filben wrote: > Can R support data manipulation programming that is available in the SAS > datastep?  Specifically, can R support the following: > -  Read multiple dataset one record at a time and compare values from > each; then base on if-then logic

[R] Data Manipulation Question

2009-12-03 Thread John Filben
Can R support data manipulation programming that is available in the SAS datastep?  Specifically, can R support the following: -          Read multiple dataset one record at a time and compare values from each; then base on if-then logic write to multiple output files -        Â

Re: [R] documentation of intersect() on string vector and num vector and on duplicated elements

2009-12-03 Thread Peter Ehlers
Greg Snow wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of David Winsemius Sent: Wednesday, December 02, 2009 3:25 PM To: Peng Yu Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] documentation of intersect() on string vector an

Re: [R] S4 Classes, nested objects and references

2009-12-03 Thread Martin Morgan
Joris Meys wrote: > Hi all, > > I'm currently programming my first complete package in S4. (thanks to > Christophe Genolini for the nice introduction he wrote). I have an > object "Data" with a number of slots. One of those slots is "meteo". > Now "Meteo" is on itself a class with again a number o

Re: [R] count number of empty cells in a table/matrix/data.frame

2009-12-03 Thread maja zaloznik
Thanks everyone who bothered to reply... I'm in the middle of a working binge and my brain is clearly fried if I wasn't able to figure that one out! Time to take a break... m. 2009/12/3 Greg Snow > If you only want to count cells that are exactly 0.0 (not slightly > different due to rounding e

Re: [R] Dataframe help

2009-12-03 Thread Ramya
Thanks it worked!!! i was trying to use %in% and matching it. Ramya On Thu, Dec 3, 2009 at 2:06 PM, Peng Cai [via R] < ml-node+947950-541874...@n4.nabble.com > wrote: > Try this: > > both <- merge(left, right, by.x="column1", by.y="column1") > > left dataset > column1column2 > 121 1234

Re: [R] matrix data appears corrupted.. appears to be pairs of decimal numbers glommed together

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 3:02 PM, Stephen Grubb wrote: Hello, We are occasionally getting matrix results that appear to be corrupted... here are the last several rows of an example, copy- pasted out of the R command window. These are supposed to be floating point numbers. [25015,] 1.820848e

Re: [R] Dataframe help

2009-12-03 Thread Peng Cai
Try this: both <- merge(left, right, by.x="column1", by.y="column1") left dataset column1column2 121 12345 145 1675 167 2765 right datset column1 column3 121abc 345lmn 167efg HTH, Peng On Thu, Dec 3, 2009 at 2:47 PM, Ramya wrote: > > Hi there > > I

[R] matrix data appears corrupted.. appears to be pairs of decimal numbers glommed together

2009-12-03 Thread Stephen Grubb
Hello, We are occasionally getting matrix results that appear to be corrupted... here are the last several rows of an example, copy-pasted out of the R command window. These are supposed to be floating point numbers. [25015,] 1.820848e-01-3.2090e-06i [25016,] 2.178046e-01-4.8140e-06i [25017,

Re: [R] Dataframe help

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 2:47 PM, Ramya wrote: Hi there I have two dataframes Dataframe_1 column_1colum_2 121 12345 145 1675 167 2765 Dataframe_2 column_1 column2 121abc 345lmn 167efg I want a resulting dataframe 121 12345abc 167

[R] Dataframe help

2009-12-03 Thread Ramya
Hi there I have two dataframes Dataframe_1 column_1colum_2 121 12345 145 1675 167 2765 Dataframe_2 column_1 column2 121abc 345lmn 167efg I want a resulting dataframe 121 12345abc 167 2765 efg how do i go abt it Ramya -- V

Re: [R] R and eclipse

2009-12-03 Thread Gene Leynes
I thought of your email when I ran across this link: http://romainfrancois.blog.free.fr/index.php?post/2009/09/02/R-capable-version-of-ant I think that you would have word your question more carefully for a longer response. Also, I use StatEt almost everyday. It works great with R. I have not u

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread Peng Cai
Thanks again! On Thu, Dec 3, 2009 at 2:19 PM, David Winsemius wrote: > > On Dec 3, 2009, at 2:14 PM, Peng Cai wrote: > > Also, can I control for number of decimal places printed. Like when I use > "mean" function. By default it shows upto 7 dec. Thanks! > > > > print(4.567891234, digits=3) > [1]

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 2:14 PM, Peng Cai wrote: > Also, can I control for number of decimal places printed. Like when > I use "mean" function. By default it shows upto 7 dec. Thanks! > print(4.567891234, digits=3) [1] 4.57 > > > On Thu, Dec 3, 2009 at 2:08 PM, Peng Cai > wrote: > Thanks Davi

[R] how to use different ylim scales on a lattice bwplot?

2009-12-03 Thread Steve_Friedman
A colleague is interested in modifying the ylim definition for individual panels of a common bwplot plotting statement. Is there an approach to modifying the bwplot function to allow for a dynamic ylim range given different panel factors ? He is using R 2.6.2 on a Linux distribution running from

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread Peng Cai
Also, can I control for number of decimal places printed. Like when I use "mean" function. By default it shows upto 7 dec. Thanks! On Thu, Dec 3, 2009 at 2:08 PM, Peng Cai wrote: > Thanks David for your suggestions. > > > On Thu, Dec 3, 2009 at 2:03 PM, David Winsemius wrote: > >> >> On Dec 3,

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread Peng Cai
Thanks David for your suggestions. On Thu, Dec 3, 2009 at 2:03 PM, David Winsemius wrote: > > On Dec 3, 2009, at 1:50 PM, Peng Cai wrote: > > Hi R Users, >> >> I'm wondering how can I calculate two (or three) way sum of a variable. A >> sample data is: >> >> State Month Year Value >> NC Jan 1996

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 1:50 PM, Peng Cai wrote: Hi R Users, I'm wondering how can I calculate two (or three) way sum of a variable. A sample data is: State Month Year Value NC Jan 1996 1 NC Jan 1996 2 NC Feb 1997 2 NC Feb 1997 3 NC Mar 1998 3 NC Mar 1998 4 NY Jan 1996 4 NY Jan 1996 5 NY Feb 19

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread Peng Cai
Thanks Greg, Jorge, and Jim for your help. Peng On Thu, Dec 3, 2009 at 1:58 PM, jim holtman wrote: > try this: > > > x >State Month Year Value > 1 NC Jan 1996 1 > 2 NC Jan 1996 2 > 3 NC Feb 1997 2 > 4 NC Feb 1997 3 > 5 NC Mar 1998 3 > 6

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread Jorge Ivan Velez
Hi Peng, Here is a suggestion using tapply: R> with(x, tapply(Value, list(State, Month), FUN = sum)) R> with(x, tapply(Value, list(State, Year), FUN = sum)) R> with(x, tapply(Value, list(State, Year, Month), FUN = sum)) with 'x' your data set. Please take a look at ?tapply for more information.

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread jim holtman
try this: > x State Month Year Value 1 NC Jan 1996 1 2 NC Jan 1996 2 3 NC Feb 1997 2 4 NC Feb 1997 3 5 NC Mar 1998 3 6 NC Mar 1998 4 7 NY Jan 1996 4 8 NY Jan 1996 5 9 NY Feb 1997 5 10NY Feb 1997

Re: [R] Two-way/Three-way sum.

2009-12-03 Thread Greg Snow
?tapply -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Peng Cai > Sent: Thursday, December 03, 2009 11:50 AM

[R] Two-way/Three-way sum.

2009-12-03 Thread Peng Cai
Hi R Users, I'm wondering how can I calculate two (or three) way sum of a variable. A sample data is: State Month Year Value NC Jan 1996 1 NC Jan 1996 2 NC Feb 1997 2 NC Feb 1997 3 NC Mar 1998 3 NC Mar 1998 4 NY Jan 1996 4 NY Jan 1996 5 NY Feb 1997 5 NY Feb 1997 6 NY Mar 1998 6 NY Mar 1998 7 I'm

Re: [R] Three-dimensional (3D) movement using 'R'

2009-12-03 Thread Duncan Murdoch
On 03/12/2009 7:59 AM, StRose, Suzanne wrote: Hi Everyone, I have a question regarding the construction of 3D graphs in 'R', BUT these graphs also need to illustrate movement (with time) of the prostate gland (using radiological techniques). I am not sure how to do this in 'R' although I'm

Re: [R] Three-dimensional (3D) movement using 'R'

2009-12-03 Thread David Winsemius
On Dec 3, 2009, at 7:59 AM, StRose, Suzanne wrote: Hi Everyone, I have a question regarding the construction of 3D graphs in 'R', BUT these graphs also need to illustrate movement (with time) of the prostate gland (using radiological techniques). I am not sure how to do this in 'R' althoug

Re: [R] Help R2WinBUGS

2009-12-03 Thread Uwe Ligges
TTsai wrote: Hello, I have problem running WinBUGS from R. The following example works in WinBUGS but it does not work in R through package R2WinBUGS. Works for me. What is the error message you get? Best wishes, Uwe Ligges Does anyone know what the problem is? x <- c(0.2, 1.1, 1, 2.2

Re: [R] GLM Question

2009-12-03 Thread Peter Flom
Knut Krueger wrote > >I think this is more an general question to GLMs. > >The result was better in all prior GLMs when I admitted the non >significant factors, but this is the first time that the result is worse >than before. What could be the reason for that? > >glm(data1~data2+data3+data4+data5

Re: [R] count number of empty cells in a table/matrix/data.frame

2009-12-03 Thread Greg Snow
If you only want to count cells that are exactly 0.0 (not slightly different due to rounding errors) then try: > sum( x==0 ) If you want a little wiggle room for rounding error, then you can try something like: > sum( -0.001 < x & x < 0.001 ) Adjusting the number of 0's as you see fit

  1   2   >