Re: [R] help to sum up data frame

2010-11-07 Thread John Kane
With your data set as the data.frame xx library(reshape2) xx - melt(xx) dcast(xx, name ~ variable, sum) --- On Sun, 11/7/10, Mohan L l.mohanphys...@gmail.com wrote: From: Mohan L l.mohanphys...@gmail.com Subject: [R] help to sum up data frame To: r-help@r-project.org Received: Sunday,

Re: [R] Populating then sorting a matrix and/or data.frame

2010-11-11 Thread John Kane
--- On Thu, 11/11/10, William Dunlap wdun...@tibco.com wrote: From: William Dunlap wdun...@tibco.com Subject: Re: [R] Populating then sorting a matrix and/or data.frame To: Peter Langfelder peter.langfel...@gmail.com, r-help@r-project.org Received: Thursday, November 11, 2010, 4:19 PM

Re: [R] sum in vector

2010-11-14 Thread John Kane
Have a look at the reshape2 package. http://had.co.nz/reshape/ reshape2 is, to the user a slight modification of rehape but the author says it is much faster. The code below seems to do what you want. - xx - data.frame(market, price)

Re: [R] replace a row in a matrix

2010-11-14 Thread John Kane
Indexing (xx - matrix(1:4, nrow=2)) vec - 5:6 xx[2,] - vec xx --- On Sun, 11/14/10, cassie jones cassiejone...@gmail.com wrote: From: cassie jones cassiejone...@gmail.com Subject: [R] replace a row in a matrix To: r-help@r-project.org Received: Sunday, November 14, 2010, 10:59 AM Dear

Re: [R] how to get rid of unused space on all 4 borders in plot() render

2010-11-21 Thread John Kane
Alternatively give ggplot2 package a try: x= c(1,5,7,-3,4) y= c(2,4,-5,2,5) xx - data.frame(x,y) library(ggplot2) qplot(x,y, data=xx) --- On Sun, 11/21/10, madr madra...@interia.pl wrote: From: madr madra...@interia.pl Subject: [R] how to get rid of unused space on all 4 borders in

[R] specifying colours in a ggplot2 piechart

2010-11-23 Thread John Kane
Someone was asking how to do a 16 category piechart in OpenOffice Calc and it appears that it can not be done (which we, probably, should be happy about) but I thought that I'd try it in ggplot2. It works but I then thought I'd like to make the colours more distinctive but fro some reason I

Re: [R] specifying colours in a ggplot2 piechart

2010-11-23 Thread John Kane
auguie baptiste.aug...@googlemail.com wrote: From: baptiste auguie baptiste.aug...@googlemail.com Subject: Re: [R] specifying colours in a ggplot2 piechart To: John Kane jrkrid...@yahoo.ca Cc: r-h...@stat.math.ethz.ch Received: Tuesday, November 23, 2010, 2:02 PM fixing the various typos in your

Re: [R] Creating Enumerated Variables

2010-07-16 Thread John Kane
I think this is simpler but still not all that clean. === xx - structure(list(ID = 1:9, Age = c(10L, 10L, 10L, 11L, 11L, 11L, 10L, 10L, 11L), School = c(1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L ), Grade = c(98L, 97L, 92L, 90L, 80L, 70L, 80L,

Re: [R] sort file names in numerical order

2010-07-17 Thread John Kane
library(gtools) ?mixedorder --- On Sat, 7/17/10, Sebastian Gibb li...@sebastiangibb.de wrote: From: Sebastian Gibb li...@sebastiangibb.de Subject: [R] sort file names in numerical order To: r-help@r-project.org Received: Saturday, July 17, 2010, 4:31 AM Hello, I get some file names by

Re: [R] Reshaping data

2010-07-19 Thread John Kane
Assuming your data is in data.frame xx library(reshape) mm1 - melt(xx, id=c(ID)) cast(mm1, ID ~ variable ) = --- On Mon, 7/19/10, Thomas Jensen thomas.jen...@eup.gess.ethz.ch

Re: [R] Sequence from 2 Vectors

2010-07-19 Thread John Kane
enum.list - function(x,y) { mylist - NULL for(i in 1:length(x)) { mylist[[i]] - x[i]:y[i] } xx - unlist(mylist) } a - c(1,2,3) b - a+2 (harry - enum.list(a,b) ) --- On Mon, 7/19/10, Suphajak Ngamlak supha...@phatrasecurities.com wrote: From: Suphajak Ngamlak supha...@phatrasecurities.com

Re: [R] simplify if statement in R ?

2010-07-20 Thread John Kane
Will something like the %in% statements below help? x1 - 1 x2 - 5 y1 - c(2,3) y2 - c(4,5) y3 - c(7,8) x1 %in% y1 ||x2 %in% y2 x1 %in% y1 ||x2 %in% y3 --- On Tue, 7/20/10, Jim Maas jimmaa...@gmail.com wrote: From: Jim Maas jimmaa...@gmail.com Subject: [R] simplify if statement in R ?

Re: [R] Issues reshaping data

2010-07-21 Thread John Kane
A small useable data set would help immensely. Have a look at ?dput as a way to supply one. --- On Wed, 7/21/10, JGull8502 jason.gulli...@gmail.com wrote: From: JGull8502 jason.gulli...@gmail.com Subject: [R] Issues reshaping data To: r-help@r-project.org Received: Wednesday, July 21,

Re: [R] xtable

2010-07-21 Thread John Kane
Try str(influencia) I don't think xtable is intended to print lists. --- On Wed, 7/21/10, Silvano silv...@uel.br wrote: From: Silvano silv...@uel.br Subject: [R] xtable To: r-help@r-project.org Received: Wednesday, July 21, 2010, 4:15 PM Hi, How do I build a table from a regression

Re: [R] how to write legend of a plot

2010-07-22 Thread John Kane
There is no simpler way. It's not automatic but it is fairly simple at the most basic. It can get a bit complicated later. ltxt - c(cat,dog) x - 1:5 y - 1:5 plot (x,y, type='n', ann=FALSE) lines(x,y,col=1,lty=solid) points(x,y,pch=16) legend(1,4,ltxt, pch=16) --- On Thu, 7/22/10, Yogesh

Re: [R] Help with scatterplots in R

2010-07-28 Thread John Kane
I think that we need an example of what you are doing before anyone can really answer that question. At the moment we don't even know how you are plotting the scatterplot. --- On Wed, 7/28/10, Sarah Chisholm sarah.chisholm...@ucl.ac.uk wrote: From: Sarah Chisholm sarah.chisholm...@ucl.ac.uk

Re: [R] save plot

2010-08-04 Thread John Kane
Yes, ?jpeg --- On Tue, 8/3/10, linda.s samrobertsm...@gmail.com wrote: From: linda.s samrobertsm...@gmail.com Subject: Re: [R] save plot To: gavin.simp...@ucl.ac.uk Cc: r-help@r-project.org Received: Tuesday, August 3, 2010, 5:36 PM [I presume you addressed this to Duncan Murdoch for a

Re: [R] colour of label points on a boxplot

2010-08-05 Thread John Kane
It would really help if you could reduce the information below to a small reproducible example, that is, some small bit of code that a reader can paste into R and poke around at. For sending a small sample dataset have a look at ?dput I believe that this problem has been discussed on the

Re: [R] a question about 'read.table' with or without 'read.table'.(urgent)

2010-08-05 Thread John Kane
I believe Wu Gong has given you a solution. As a note you were probably reading in the first two columns as either factors or characters and the last one as numeric. You might want to try it again and then do a str() on the resulting data.frame to see what was happening. It can be

Re: [R] odfWeave

2010-08-31 Thread John Kane
It looks like a path problem. I have not figured out how to handle it in Win 7 (new system last week) but have a look at http://r.789695.n4.nabble.com/odfWeave-Error-td1595848.html#a1595848 which I think addresses the problem. --- On Tue, 8/31/10, Michael Kubovy kub...@virginia.edu wrote:

Re: [R] odfWeave

2010-08-31 Thread John Kane
Replying to my own post, it is a path problem. I downloaded the UnZip and Zip binaries, the 5.51-1 UnZip and the most recent Zip and then added a path to the UnZip directory, and odfWeave seems to be working. --- On Te, 8/31/10, John Kane jrkrid...@yahoo.ca wrote: From: John Kane jrkrid

Re: [R] how to represent error bar in a plot legend?

2010-09-01 Thread John Kane
Can you give us a working example of what you are doing? I don't understand why you would need a pch symbol for an error bar. Perhaps if you are using an unboxed legend you could just use arrow() and text() to add the error bar to the legend? --- On Wed, 9/1/10, josef.kar...@phila.gov

Re: [R] Function Gini or Ineq

2010-09-03 Thread John Kane
You installed the package but probably forgot to load the library. This works fine for me. = library(reldist) x-c(541, 1463, 2445, 3438, 4437, 5401, 6392, 8304, 11904, 22261) G-gini(x)

Re: [R] how can I plot bar plots with all the bars (negative and positive) in the same direction????

2010-09-03 Thread John Kane
I believe that you will have to draw them in ggplot2 as someone mentioned or in base graphics. Here is a rough first attempt that may give you some ideas. xx - -3:4 yy - rep(-3,length(xx)) plot(xx,xx, type=n, xlim=c(-4, 5)) rect(xx, yy, xx+.5, xx )

Re: [R] Newbie cross tabulation issue

2010-09-09 Thread John Kane
It would help if you included a bit of sample data. See ?dput as a way of doing this. Also a good place to start is by looking at the package reshape. Have a look at http://had.co.nz/reshape/ for some information on the package. --- On Wed, 9/8/10, Jonathan Finlay jmfinl...@gmail.com wrote:

Re: [R] Alignment of lines within barplot bars

2010-09-09 Thread John Kane
Like this? x - 4:7 barplot(x, density=10, angle=180) --- On Thu, 9/9/10, Steve Murray smurray...@hotmail.com wrote: From: Steve Murray smurray...@hotmail.com Subject: [R] Alignment of lines within barplot bars To: r-help@r-project.org Received: Thursday, September 9, 2010, 11:35 AM

Re: [R] Alignment of lines within barplot bars

2010-09-09 Thread John Kane
Okay, I misread what you wanted. Try this == x - 4:7 positions - barplot(x) mid - x/2 arrows(positions-.5,mid,positions+.5,mid,angle=0) == --- On Thu, 9/9/10, Steve Murray

Re: [R] adding labels above bars in a barplot

2010-09-10 Thread John Kane
Are you trying to say that you don't really like barplots? At least the OP did not ask for error bars as well. :) --- On Fri, 9/10/10, Dennis Murphy djmu...@gmail.com wrote: From: Dennis Murphy djmu...@gmail.com Subject: Re: [R] adding labels above bars in a barplot To: Antonio Olinto

Re: [R] Create Dot Chart

2010-09-19 Thread John Kane
?dotchart perhaps. --- On Sun, 9/19/10, avsha38 avsha...@post.tau.ac.il wrote: From: avsha38 avsha...@post.tau.ac.il Subject: [R] Create Dot Chart To: r-help@r-project.org Received: Sunday, September 19, 2010, 10:46 AM Hello everyone... I would like to create a chart (see below), how

Re: [R] SAS user now converting to R - Help with Transpose

2009-09-28 Thread John Kane
library(reshape) melt(dataset) # assuming dataset is a data.frame. --- On Mon, 9/28/09, baxterj j...@vt.edu wrote: From: baxterj j...@vt.edu Subject: [R] SAS user now converting to R - Help with Transpose To: r-help@r-project.org Received: Monday, September 28, 2009, 10:24 AM I am just

Re: [R] Urgently needed Exercise solutions related to Practical Data Analysis Using R Statisctial Software

2009-10-04 Thread John Kane
Ah, but the offer of the permanent job with a foreign company is so enticing. BTW I think he says that he is a computer science student. I doubt business school students would be so cheap. --- On Sat, 10/3/09, David Winsemius dwinsem...@comcast.net wrote: From: David Winsemius

Re: [R] Saving each output of a loop into something that can be graphed

2009-10-05 Thread John Kane
Define a matrix to hold the data and insert it into the loop? Something like mymat - matrix(rep(NA, 20), nrow=10) for(i in 1:10){ a - i b - i+1 mymat[i,] - c(a,b) } matplot(mymat) --- On Mon, 10/5/09, RR99 redhwanza...@hotmail.com wrote: From: RR99 redhwanza...@hotmail.com

[R] ggplot equivalent of par(xaxt)

2009-10-06 Thread John Kane
I am playing around learning ggplot and cannot see how to suppress the x or y axis values ( equivalent of xaxt in basic graphics) It must be obvious but I'm not seeing it. Problem = timedata - structure(list(month =

Re: [R] ggplot equivalent of par(xaxt)

2009-10-06 Thread John Kane
Subject: Re: [R] ggplot equivalent of par(xaxt) To: John Kane jrkrid...@yahoo.ca Cc: R R-help r-h...@stat.math.ethz.ch Received: Tuesday, October 6, 2009, 2:57 PM Hi, 2009/10/6 John Kane jrkrid...@yahoo.ca: How do I suppress the numbers on the x-axis? Try this, p + opts(axis.text.x

Re: [R] ggplot equivalent of par(xaxt)

2009-10-06 Thread John Kane
(xaxt) To: John Kane jrkrid...@yahoo.ca Cc: R R-help r-h...@stat.math.ethz.ch Received: Tuesday, October 6, 2009, 3:07 PM body(theme_grey) could help you find the name of a particular option (that's what I did). baptiste 2009/10/6 John Kane jrkrid...@yahoo.ca: Lovely.  I knew

Re: [R] Creating a Clustered-Stacked Column Chart

2009-10-09 Thread John Kane
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

[R] Placing text in a ggplot

2009-10-09 Thread John Kane
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

Re: [R] plot the same types of graphics on the same R graphic device

2009-10-09 Thread John Kane
?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

Re: [R] Adding additional X-axis data to charts, e.g. N values

2009-10-13 Thread John Kane
?mtext should help. --- On Tue, 10/13/09, spidermonkeydp gbabo...@gmail.com wrote: From: spidermonkeydp gbabo...@gmail.com Subject: [R] Adding additional X-axis data to charts, e.g. N values To: r-help@r-project.org Received: Tuesday, October 13, 2009, 6:06 AM Hello All, Does

Re: [R] SPSS long variable names

2009-10-13 Thread John Kane
library(Hmisc) spss.get may do it but it's been some time since I used it. --- On Sat, 10/10/09, Orvalho Augusto orvaq...@gmail.com wrote: From: Orvalho Augusto orvaq...@gmail.com Subject: [R] SPSS long variable names To: r-help@r-project.org Received: Saturday, October 10, 2009, 12:14 PM

Re: [R] Division of data frame and deletion of values from column

2009-10-16 Thread John Kane
?subset ?split --- On Fri, 10/16/09, Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com wrote: From: Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com Subject: [R] Division of data frame and deletion of values from column To: r-help@r-project.org Received: Friday, October 16,

Re: [R] negative length vectors are not allowed in wilcox.exact() and perm.test()

2009-10-16 Thread John Kane
Number of politicians' promises kept? --- On Fri, 10/16/09, Patrick Burns pbu...@pburns.seanet.com wrote: From: Patrick Burns pbu...@pburns.seanet.com Subject: Re: [R] negative length vectors are not allowed in wilcox.exact() and perm.test() To: Ben Bolker bol...@ufl.edu Cc:

Re: [R] Different way of scaling data

2009-10-16 Thread John Kane
library(reshape) ?rescaler I think something along the lines of rescaler(data.frame, type=range) should do what you want. --- On Fri, 10/16/09, Noah Silverman n...@smartmediacorp.com wrote: From: Noah Silverman n...@smartmediacorp.com Subject: [R] Different way of scaling data To: r

Re: [R] How to right-align labels in dotchart

2009-10-16 Thread John Kane
Oops replying to the wrong post but anyway does this do what you want? aa - c(3,6,3,5,8) lbs - c('cat','goat', 'elephant', 'horse', 'whale') dotchart(aa, pch=(16), col = 1:5, main=A Dotchart) axis(side = 2, seq_along(aa), lbs, las=1) --- On Thu, 10/15/09, Sean Carmody seancarm...@gmail.com

Re: [R] doing a Tukey HSD post-hoc

2009-10-17 Thread John Kane
?TukeyHSD --- On Fri, 10/16/09, Leslie J Seltzer lselt...@wisc.edu wrote: From: Leslie J Seltzer lselt...@wisc.edu Subject: [R] doing a Tukey HSD post-hoc To: r-help@r-project.org Received: Friday, October 16, 2009, 5:38 PM Hi all I have a large spreadsheet (Excel) file with many

[R] Putting names on a ggplot

2009-10-17 Thread John Kane
Putting names on a ggplot Can anyone suggest what I am doing wrong here. I am plotting daily temperatures at Ottawa Ontario for 2008 broken down by months, I seperate them by lines and want to put the names of the months at the top of the chart ( with in the graphing area) Everything is working

Re: [R] Putting names on a ggplot

2009-10-18 Thread John Kane
Subject: Re: [R] Putting names on a ggplot To: John Kane jrkrid...@yahoo.ca Cc: R R-help r-h...@stat.math.ethz.ch Received: Saturday, October 17, 2009, 5:53 PM hi, On Sat, Oct 17, 2009 at 02:04:43PM -0700, John Kane wrote: Putting names on a ggplot p - p + geom_text(aes(x = namposts

Re: [R] Putting names on a ggplot

2009-10-18 Thread John Kane
--- On Sun, 10/18/09, m...@z107.de m...@z107.de wrote: From: m...@z107.de m...@z107.de Subject: Re: [R] Putting names on a ggplot To: John Kane jrkrid...@yahoo.ca Cc: R R-help r-h...@stat.math.ethz.ch Received: Sunday, October 18, 2009, 6:05 PM hello, On Sun, Oct 18, 2009 at 08:29:19AM

Re: [R] Putting names on a ggplot

2009-10-22 Thread John Kane
--- On Tue, 10/20/09, hadley wickham h.wick...@gmail.com wrote: From: hadley wickham h.wick...@gmail.com Subject: Re: [R] Putting names on a ggplot To: John Kane jrkrid...@yahoo.ca Cc: m...@z107.de, R R-help r-h...@stat.math.ethz.ch Received: Tuesday, October 20, 2009, 10:59 AM On Sun

Re: [R] Inserting rows

2009-10-23 Thread John Kane
?rbind df1 - data.frame(matrix(rep(0,9),nrow=3)) names(df1) - c(x1,x2,x3) rbind(df,df1) --- On Fri, 10/23/09, Ashta sewa...@gmail.com wrote: From: Ashta sewa...@gmail.com Subject: [R] Inserting rows To: R help r-help@r-project.org Received: Friday, October 23, 2009, 9:44 AM Hi all, I

Re: [R] Change positions of columns in data frame

2009-10-23 Thread John Kane
dataframe xx x1 x2 x3 1 2 5 2 4 1 5 6 0 1 1 2 data.frame(xx$x2,xx$x1,xx$x3) # or Awkward but works --- On Fri, 10/23/09, Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com wrote: From: Joel Fürstenberg-Hägg joel_furstenberg_h...@hotmail.com Subject: [R] Change positions

Re: [R] exclude data for boxplot stats using mathematical operator

2009-10-26 Thread John Kane
Perhaps subset the data first? subset(x, x[,2] =0) --- On Mon, 10/26/09, e-letter inp...@gmail.com wrote: From: e-letter inp...@gmail.com Subject: [R] exclude data for boxplot stats using mathematical operator To: r-help@r-project.org Received: Monday, October 26, 2009, 3:25 AM Readers,

Re: [R] reshaping a data frame

2009-10-26 Thread John Kane
Why not just unlist the data.frame and specify the number of rows in a matrix each time you need look at a different layout, assuming I understand the question. Example === aa - data.frame(1:100) bb - unlist(aa) (cc - matrix(bb,

Re: [R] automatically adjusting axis limits

2009-10-27 Thread John Kane
PLEASE provide commented, minimal, self-contained, reproducible code. particularly a sample data.set. At the moment it sounds like you have one variable (Wavelength) with a length of 56 and Reflectance with a length of 5,000. What format(s) are the data in? Data.frames? Clearly this is not

Re: [R] R crashes

2009-10-29 Thread John Kane
And PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --- On Thu, 10/29/09, premmad mtechp...@gmail.com wrote: From: premmad mtechp...@gmail.com Subject: [R] R crashes To: r-help@r-project.org

Re: [R] polar.plot

2009-10-31 Thread John Kane
--- On Fri, 10/30/09, Tony Greig tony.gr...@gmail.com wrote: From: Tony Greig tony.gr...@gmail.com Two questions: 1 - Say I have average speed and directions for tide and I would like to plot them on a polar plot, but with different colors so I can indicate the two directions. I'm

Re: [R] how to loop thru a matrix or data frame , and append calculations to a new data frame?

2009-10-31 Thread John Kane
Do you mean to apply the same calculation to each element? ? apply mydata - data.frame(aa = 1:5, bb= 11:15) mp5 - function(x) x*5 mp5data - apply(mydata, 2, mp5) mp5data This is functionally equivelent to a double if loop. mydata - data.frame(aa = 1:5, bb= 11:15) newdata -

Re: [R] how to loop thru a matrix or data frame , and append calculations to a new data frame?

2009-11-01 Thread John Kane
Duh, thought of that after I'd left for dinner :( --- On Sat, 10/31/09, David Winsemius dwinsem...@comcast.net wrote: From: David Winsemius dwinsem...@comcast.net Subject: Re: [R] how to loop thru a matrix or data frame , and append calculations to a new data frame? To: John Kane jrkrid

Re: [R] look up and Missing

2009-11-08 Thread John Kane
I'm not quite sure I understood the second queston but does this work? subset(temp, xx$v2==-9) subset(temp, xx$v2!= -9) --- On Sun, 11/8/09, Ashta sewa...@gmail.com wrote: From: Ashta sewa...@gmail.com Subject: [R] look up and Missing To: r-h...@stat.math.ethz.ch Received: Sunday, November

Re: [R] Counting non-empty levels of a factor

2009-11-08 Thread John Kane
With xx as your sample data will this work? See ?addmargins jj - table(xx) addmargins(jj, 2) # or for both margins addmargins(jj, c(1,2)) or apply(jj, 1, sum) --- On Sun, 11/8/09, sylvain willart sylvain.will...@gmail.com wrote: From: sylvain willart sylvain.will...@gmail.com Subject:

Re: [R] Complicated For Loop (to me)

2009-11-09 Thread John Kane
I think that we probably need a sample database of your original data. A few lines of the dataset would probably be enough as long as it was fairly representative of the overall data set. See ?dput for a way of conveniently supply a sample data set. Otherwise off the top of my head, I would

Re: [R] Noobie question on aggregate tapply and by

2010-04-25 Thread John Kane
Here's one way with aggregate() library(car) # You probably will need to install it. aggregate(DF[,3-4], by=list(years), mean,na.rm=TRUE) recode(x, c(1,2)='A'; else='B') DF$years - recode(DF$years, c(5,6,7)= '5-7') DF You may also want to have a look at the reshape and plyr packages. ---

Re: [R] numerical or not?

2010-04-26 Thread John Kane
I don't seem to be able to duplicate the problem. Using your read.table command I get a data.frame (which is of course a type of list) and something like sum(dat1[,1] gives me a numerical result. What variable is giving you the not numerical error message --- On Mon, 4/26/10, Laetitia Schmid

Re: [R] How to make legend with line+ character

2010-04-26 Thread John Kane
I suspect that you may have to construct the legend by hand (well, by explicit text commands anyway) Something like this seems to work and it should not be that difficult to write a function to handle the text commands. plot(1:10,10:1,lty=1,type='b', lwd=2,pch='a') text(1.4,6, label=-a- ,

Re: [R] Newbie question

2010-04-30 Thread John Kane
It depends on what kind of plot etc and which package you are using. The basic plot routines are summarized in ?plot.default with many of the parameters controlled by ?par I think at the simplist something like this would work and you can add colour plotting specs etc as you experiment.

Re: [R] Scree diagram,

2010-05-02 Thread John Kane
Presumably, a scree plot? Philip may find something useful here http://www.statmethods.net/advstats/factor.html --- On Sun, 5/2/10, Ista Zahn istaz...@gmail.com wrote: From: Ista Zahn istaz...@gmail.com Subject: Re: [R] Scree diagram, To: Philip Wong tombfigh...@mysinamail.com Cc:

Re: [R] adding year information to a scatter plot

2010-05-02 Thread John Kane
I think that one of the packages, perhaps Hmisc or plotrix does this but you can also do it just using text() Example plot(b~a,data=df, xlim=c(min(df$a)-5,max(df$a)+5), ylim= c(min(df$b)-5,max(df$b)+5)) text( df$a+1,df$b, labels=df$year) Alternatively you can do this in ggplot

Re: [R] / Operator not meaningful for factors

2010-05-03 Thread John Kane
I think that you are correct. R has the annoying habit of converting character data to factors when you don't want it to while it is importing data. This is because the in the option stringsAsFactors is set to TRUE for some weird historical reasons. Try the command str(insert name of data)

Re: [R] Help needed with legend

2010-05-03 Thread John Kane
A small executable example would help here. We don't even know how you are graphing this. There are several packages including lattice and ggplot as well as the base graphs. If you are doing this in base graphics have a look at ?text --- On Mon, 5/3/10, Nish nisha.mukte...@gmail.com wrote:

Re: [R] How to replace all NA values in a data.frame with another ( not 0) value

2010-05-04 Thread John Kane
?replace Something like this should work replace(df1, is.na(df1), 000/000) --- On Tue, 5/4/10, Nevil Amos nevil.a...@gmail.com wrote: From: Nevil Amos nevil.a...@gmail.com Subject: [R] How to replace all NA values in a data.frame with another ( not 0) value To: r-h...@stat.math.ethz.ch

Re: [R] Show number at each bar in barchart?

2010-05-04 Thread John Kane
Try this. My appologies for not giving the attribution but I forget who wrote it. my.values=10:15 x - barplot(my.values, ylim=c(0,11)) text(x, my.values, my.values, pos=3) text(x, my.values, wibble, pos=3) --- On Tue, 5/4/10, someone vonhof...@t-online.de wrote: From:

Re: [R] make a column from the row names

2010-05-04 Thread John Kane
Have a look at ?substring --- On Tue, 5/4/10, Mohan L l.mohan...@gmail.com wrote: From: Mohan L l.mohan...@gmail.com Subject: [R] make a column from the row names To: r-help@r-project.org Received: Tuesday, May 4, 2010, 9:06 AM Dear All, avglog 01/11/09 02/11/09 03/11/09 04/11/09

Re: [R] / Operator not meaningful for factors

2010-05-04 Thread John Kane
--- On Tue, 5/4/10, Petr PIKAL petr.pi...@precheza.cz wrote: From: Petr PIKAL petr.pi...@precheza.cz Subject: Re: [R] / Operator not meaningful for factors To: John Kane jrkrid...@yahoo.ca Cc: r-help@r-project.org, vincent.deluard vincent.delu...@trimtabs.com Received: Tuesday, May 4, 2010

Re: [R] What is the best way to have R output tables in an MS Word format? (shaping R core)

2010-05-07 Thread John Kane
For simply doing tables xtable has done some nice work for me. --- On Fri, 5/7/10, Joris Meys jorism...@gmail.com wrote: From: Joris Meys jorism...@gmail.com Subject: Re: [R] What is the best way to have R output tables in an MS Word format? (shaping R core) To: Duncan Murdoch

Re: [R] What is the best way to have R output tables in an MS

2010-05-07 Thread John Kane
Let me see. I open a Word document and type, Dear Dr.Harrell, I open a new LaTeX document and type something like: \documentclass[10pt,a4paper]{letter} \usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \address{your name and address} \signature{your

Re: [R] Removing points

2010-05-12 Thread John Kane
?subset --- On Wed, 5/12/10, Blue.Egg avonpfe...@gmail.com wrote: From: Blue.Egg avonpfe...@gmail.com Subject: [R] Removing points To: r-help@r-project.org Received: Wednesday, May 12, 2010, 8:33 AM I have a some data, and imagine a column of how many parasitic eggs found in the stool

Re: [R] Loading Intraday Time Series Data

2010-05-16 Thread John Kane
Hi Steve, I think what you want to do is get a unique time-date from the first two columns. Try something like this: (changing the file name obviously. mydate should give you a time and date format that you can add to the existing data.frame. mydata - read.table(C:/rdata/dates.junk.csv,

Re: [R] Function that is giving me a headache- any help appreciated (automatic read )

2010-05-18 Thread John Kane
I don't think you can do this precipitation!=NA) have a look at ?is.na --- On Tue, 5/18/10, stephen sefick ssef...@gmail.com wrote: From: stephen sefick ssef...@gmail.com Subject: [R] Function that is giving me a headache- any help appreciated (automatic read ) To: r-help@r-project.org

Re: [R] question about graph

2010-05-22 Thread John Kane
This is not enough information to let us give a good example but perhaps ?lines or ?points might help? Example aa - 1:5 bb - 1:5 cc - c(1.5,2.5,3.5,4.2,4.4) plot(aa,bb) lines(aa,cc,col='red') points(aa,cc, col=blue) --- On Sat, 5/22/10, khaz...@ceremade.dauphine.fr

Re: [R] website address for the pseuso-XLS files

2010-05-25 Thread John Kane
The Prostatic_Neoplasm-miRNAs.DiseaseTargets.xls file seems to be an HTML table and seems to open with no problem in OpenOffice.org Writer/Web. OOo 3.2.0 when opened from within OOOo. At a guess it is some collection of PubMed references. I don't know if that's any use but it's a nice table

Re: [R] write.csv fails with $ operator invalid for atomic

2009-12-01 Thread John Kane
Where does the table come from? write.csv(t, file = t.csv) looks like it would work --- On Tue, 12/1/09, ggraves ggwra...@sfwmd.gov wrote: From: ggraves ggra...@sfwmd.gov Subject: [R] write.csv fails with $ operator invalid for atomic To: r-help@r-project.org Received: Tuesday, December

Re: [R] Creating a string

2009-12-14 Thread John Kane
?paste a - 1:5 paste(X,a, sep=) --- On Mon, 12/14/09, Tom Pitt t.p...@hotmail.com wrote: From: Tom Pitt t.p...@hotmail.com Subject: [R] Creating a string To: r-help@r-project.org Received: Monday, December 14, 2009, 4:31 PM Hi All, Thanks for your help. I want to add a letter x

Re: [R] write.csv and header

2009-12-16 Thread John Kane
Just write the headers once and append as many times as needed? You can append as many datasets as you want. --- On Wed, 12/16/09, rkevinbur...@charter.net rkevinbur...@charter.net wrote: From: rkevinbur...@charter.net rkevinbur...@charter.net Subject: Re: [R] write.csv and header To:

Re: [R] How to print to file?

2009-12-19 Thread John Kane
?sink perhaps? --- On Sat, 12/19/09, Peng Yu pengyu...@gmail.com wrote: From: Peng Yu pengyu...@gmail.com Subject: [R] How to print to file? To: r-h...@stat.math.ethz.ch Received: Saturday, December 19, 2009, 7:12 AM I don't find a function to print a string to file. Would somebody let

Re: [R] Two Easy questions

2009-12-24 Thread John Kane
?text for the first question ? plot(xx$Eight, xx$Punctuation) text(xx$Eight, xx$Punctuation, xx$Name) You will need to play around with the values for Punctuation to get the names to be beside the dots --- On Thu, 12/24/09, Jose Narillos de Santos narillosdesan...@gmail.com wrote: From:

Re: [R] Column naming issues using read.table

2009-12-24 Thread John Kane
I'm not exactly an expert so this is not likely a good way to do it but if the actual variable names are constant across the files why not just read in the data and assign the names later? see skip in ?read.table. x - read.table(d:/junk1.txt, skip=2) should read in the data. You can

Re: [R] Reading Input file

2009-12-26 Thread John Kane
First of all there seems to be something wrong with your equation rate_name[i] = (paste(`rate', i, ‘.csv`, sep = ‘’)) Try this rate_name[i] - paste(rate,i,.csv, sep=) I am not --- On Sat, 12/26/09, Maithili Shiva maithili_sh...@yahoo.com wrote: From: Maithili Shiva maithili_sh...@yahoo.com

Re: [R] how to create a simple loop ?

2009-12-27 Thread John Kane
An alternative approach (clumsy but probably not as clumsy as a loop) would be to create a sixth column as a factor and aggregate on that. Simple-minded example : === mydata - data.frame(matrix(rnorm(100),nrow=20)) mydata[,6] -

Re: [R] refering to the 'boundaries' of a graph

2009-12-28 Thread John Kane
I think what you are encountering is a standard R default. R, by default, adds 4% to the axes. I suspect that this is to avoid graphing points right on the x or x axis and thus obscuring them. Have a look at ?par xaxs for more information and how to change the default. --- On Mon,

Re: [R] Accessing member

2009-12-28 Thread John Kane
Assuming the data set is called xx subset (xx, xx$V1==AB) or xx[1,] if you now AB is the first row of the data. --- On Mon, 12/28/09, Nick Torenvliet nick.torenvl...@gmail.com wrote: From: Nick Torenvliet nick.torenvl...@gmail.com Subject: [R] Accessing members To:

Re: [R] Newbie needs to count elements in a row

2009-12-29 Thread John Kane
Could you just transpose the matrix? Otherwise you can write a simple function that should work. Try this -(mat1 - matrix(c(1, 2, 3, NA, 10, 2, NA, 8, 9, NA),nrow=2)) gl - function(x)length(x[!is.na(x)] apply(mat1, 1, gl)

Re: [R] iterating over a data frame the R way?

2009-12-31 Thread John Kane
Uh what do you want to do to it/them? Here are a couple of R-type commands on a data.frame. mydata - data.frame(vec1 = seq(19,109, by=10), vec2 =seq(30,120, by=10)) mydata[,1]+mydata[,2] apply(mydata, 2, mean) --- On Thu, 12/31/09, donahc...@me.com donahc...@me.com wrote: From:

Re: [R] how to plot multiple density functions in one graph

2010-01-04 Thread John Kane
?lines ?points --- On Mon, 1/4/10, John Westbury jrwestb...@gmail.com wrote: From: John Westbury jrwestb...@gmail.com Subject: [R] how to plot multiple density functions in one graph To: r-help@r-project.org Received: Monday, January 4, 2010, 3:13 PM Hello, I am new to R and have two

Re: [R] Data Frame Transpose

2010-01-05 Thread John Kane
Well, if nothing else, you have missing comma. :) x01=y[,1]), x01=y[,1], x02=y[,2], x03=y[,3] -- fn - function(x) {   y - t(x[,2])   data.frame( Croptype=x[1,1], Period =x[1,2], name=colnames(x)[2], x01=y[,1])x01=y[,1], x02=y[,2], x03=y[,3] } ---Problem here m -

Re: [R] Bar plots with stacked and grouped (juxtaposed) bars together

2010-01-05 Thread John Kane
I have the feeling that you can do this with ggplot2 but why? You are likely to be much better off using a dotchart. ?dotchart --- On Mon, 1/4/10, Elmer Wix elmer.cabekaziruronometu@gmail.com wrote: From: Elmer Wix elmer.cabekaziruronometu@gmail.com Subject: [R] Bar plots with

Re: [R] (no subject)

2010-06-03 Thread John Kane
It looks like superpose.eb is someone's function and not in a package. https://stat.ethz.ch/pipermail/r-help/2002-November/027299.html --- On Thu, 6/3/10, Rosario Garcia Gil m.rosario.gar...@genfys.slu.se wrote: From: Rosario Garcia Gil m.rosario.gar...@genfys.slu.se Subject: [R] (no subject)

Re: [R] import text file into R

2010-06-03 Thread John Kane
What does the text look like? --- On Thu, 6/3/10, dhanush dhana...@gmail.com wrote: From: dhanush dhana...@gmail.com Subject: [R] import text file into R To: r-help@r-project.org Received: Thursday, June 3, 2010, 7:32 AM can anyone tell me how to import a text file in R? the text file

Re: [R] horizontal and vertical line with arrow in a plot

2010-06-04 Thread John Kane
# A very quick example of how to draw an arrow on a graph. plot(1:10) text(2,5, Point 5 , cex=.8) arrows(3,5, 4.5, 5) --- On Thu, 6/3/10, Roslina Zakaria zrosl...@yahoo.com wrote: From: Roslina Zakaria zrosl...@yahoo.com Subject: [R] horizontal and vertical line with arrow in a plot To:

Re: [R] how to use 'points' function to plot two curves with errbar

2010-06-05 Thread John Kane
The first thing we need to know is what errbar are you using? There are at least two, on in the Hmisc package and one in sfsmisc. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained,reproducible code. I'm not sure what

Re: [R] variation

2010-06-05 Thread John Kane
?var perhaps --- On Sat, 6/5/10, Adel ESSAFI adel.s...@imag.fr wrote: From: Adel ESSAFI adel.s...@imag.fr Subject: Re: [R] variation To: r-help@r-project.org Received: Saturday, June 5, 2010, 7:57 AM 2010/6/5 Jannis bt_jan...@yahoo.de What exactly do you mean by variation? As I

  1   2   3   4   5   6   7   8   9   10   >