[R] drawing an axis using axis command

2009-07-06 Thread John Kane
I am clearly doing something extremely stupid here but why is this code not writing the axis values for this graph? Any suggestions gratefully received. structure(list(year = c(1911L, 1921L, 1931L, 1941L, 1951L, 1961L, 1971L, 1981L, 1991L, 2001L, 2006L), total = c(7206643L, 8788483L, 103767

Re: [R] drawing an axis using axis command

2009-07-06 Thread John Kane
d > To: "John Kane" , r-help@r-project.org > Received: Monday, July 6, 2009, 3:47 PM > After your plot command, type > >    par()$usr > > It will show you that your x axis range is 1907 to 2009. > But you > tried to put the axis labels at x=1 to 11, whic

Re: [R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread John Kane
--- On Tue, 7/7/09, Duncan Murdoch wrote: > From: Duncan Murdoch > Subject: Re: [R] r-project.org address blacklisted by anti-spam software > To: "Hans W Borchers" > Cc: r-h...@stat.math.ethz.ch > Received: Tuesday, July 7, 2009, 6:15 PM > On 07/07/2009 5:59 PM, Hans W > Borchers wrote: > >

Re: [R] #INCLUDE

2009-07-08 Thread John Kane
?source perhaps? --- On Wed, 7/8/09, Idgarad wrote: > From: Idgarad > Subject: [R] #INCLUDE > To: r-help@r-project.org > Received: Wednesday, July 8, 2009, 11:16 AM > What is R's equivalent to a C-like > #include to incorporate external files. I > have a 2k line function that is generated and

Re: [R] (no subject)

2009-07-12 Thread John Kane
I have no idea to be honest. I have never used the package, I simply did a search for it. Hopefully a more experienced user can help --- On Sun, 7/12/09, maram salem wrote: > From: maram salem > Subject: Re: [R] (no subject) > To: "John Kane" > Received: Sunday,

Re: [R] Help needed in identifying type of plot

2009-07-14 Thread John Kane
It looks like a forest plot normally used in meta-analysis work. See http://www.bmj.com/cgi/content/full/322/7300/1479 . See http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=114 for an example from rmeta package with accompanying code. I think that package metafor also gives fore

Re: [R] Grouping data in dataframe

2009-07-15 Thread John Kane
Another approach is to use the reshape package --Assuming your data.frame is called xx -- libarary(reshape) mm <- melt(xx, id=c("Size")) ; mm cast(mm, Size ~variable, median) -- --- On Tue, 7/14/09, Timo Schneider wrot

Re: [R] Sample Function

2009-07-16 Thread John Kane
What is dataset? What is this supposed to be doing? newsample<-dataset[sample(m,replace=T),] --- On Thu, 7/16/09, MarcioRibeiro wrote: > From: MarcioRibeiro > Subject: [R] Sample Function > To: r-help@r-project.org > Received: Thursday, July 16, 2009, 11:55 AM > > Hi listers, > Suppose I

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread John Kane
It your times are chron objects then trunc(tt, "minutes") where tt are your times may do what you want. It truncated but that seems to be what you want. --- On Thu, 7/16/09, Jason Rupert wrote: > From: Jason Rupert > Subject: [R] Best way to replace :SS with :00 > To: R-help@r-project.or

Re: [R] Transformation of data!

2009-07-16 Thread John Kane
That is what you have. It just prints to screen that way. If you want you could put it into a one column data.frame, that is, mydata <- data.frame(myvector) which may give you the layout you want. --- On Thu, 7/16/09, Andriy Fetsun wrote: > From: Andriy Fetsun > Subject: [R] Transformation

Re: [R] Count data categories from table

2009-07-17 Thread John Kane
aggregate? Something like this should work although it is not very elegant. mydata <- data.frame(aa=rep(letters[1:10],2), bb=rnorm(20, 5,1)) ss <- aggregate(mydata[,2],list(aa=mydata$aa), sum) pie(ss[,2]) ===

Re: [R] Histograms on a log scale

2009-07-20 Thread John Kane
How about using the ggplot2 package? Does this give you something along the lines of what you want? === library(ggplot2) r <- data.frame(rlnorm(1000)) names(r) <- "rr" ggplot(r, aes(rr)) + geom_histogram()+ scale_x_log10() + s

Re: [R] geom_histogram help

2009-07-21 Thread John Kane
Without your code it is impossible to say why you are getting the error message. However, are you aware that you need to have a classifying variable to set the colours? Try this to see if it is something like what you want. ==

Re: [R] how to use a list to create a plot

2009-07-21 Thread John Kane
It looks like a data.frame to me. Try str(psd) or class(psd) to check. Typeof returns "list" for a data.frame since "data.frame" apparently is a subset of "list". The 'months' that you are seeing are simply the rownames which by chance are the same as the months. I's suggest adding the mont

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread John Kane
--- On Mon, 7/20/09, 1Rnwb wrote: > I thought this forum is for help. now i know what the > statistician in my dept > does all day long Clearly he's not talking to you. Your first step probably should be to go talk to him or her. _

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread John Kane
Why not convert them to dates? Assuming you are using that perverse Month/Day/Year format x <- c("12/9/2007" ,"12/16/2007","1/1/2008","1/3/2008","1/12/2008") xx <- as.Date(x, "%m/%d/%Y") xx --- On Tue, 7/21/09, liujb wrote: > From: liujb > Subject: [R] how to transform m/d/ to mmd

Re: [R] Problem with "merge" command duplicating values

2009-07-22 Thread John Kane
What package is 'grand.merge' in? --- On Wed, 7/22/09, Archana Dayalu wrote: > From: Archana Dayalu > Subject: [R] Problem with "merge" command duplicating values > To: r-help@r-project.org > Received: Wednesday, July 22, 2009, 3:44 PM > Hello, > I am attempting to merge 8 different data sets

Re: [R] simple question about exporting data...

2009-07-23 Thread John Kane
I vote for it. --- On Thu, 7/23/09, Marc Schwartz wrote: > From: Marc Schwartz > On Jul 23, 2009, at 8:59 AM, Greg Snow wrote: > > > Doing the computations in R then the graphs in Excel > reminds me of the maxim: > > > > Measure with a micrometer > > Mark with chalk > > Cut with an ax > >

[R] ggplot2 : commands on one line vs two lines.

2009-07-23 Thread John Kane
I have just started using ggplot2 and I seem to be doing something stupid in writing ggplot2 commands on more than one line. In the example below the commands on one line are working fine, but as soon as I put them on two lines I get an error. Can any one point out what I am doing wrong? It must

Re: [R] CI wiskers

2009-07-24 Thread John Kane
Or a simple approach is to use arrows to draw the CI whiskers Example == # Uses arrows to produce confidence intervals for a set of values. low <- c(312.9460, 312.9419, 312.9422, 312.9380 ) mass <- c(312.9476, 312.9435, 312.9438

Re: [R] Stting non-overlaping text positions

2009-07-24 Thread John Kane
You might want to have a look at thigmophobe.labels in the plotrix package. --- On Fri, 7/24/09, Ana Conesa wrote: > From: Ana Conesa > Subject: [R] Stting non-overlaping text positions > To: r-help@r-project.org > Received: Friday, July 24, 2009, 8:29 AM > Dear List > > I am having problems

Re: [R] ggplot2 : commands on one line vs two lines.

2009-07-24 Thread John Kane
--- On Fri, 7/24/09, Kingsford Jones wrote: > From: Kingsford Jones > Subject: Re: [R] ggplot2 : commands on one line vs two lines. > To: "John Kane" > Cc: r-h...@stat.math.ethz.ch > Received: Friday, July 24, 2009, 2:26 AM > Hi John, > > Thank you for t

Re: [R] numbers on barplot

2009-07-27 Thread John Kane
names(dat)<-c("NumberOfPeople","Average") Graph<-barplot(dat$Average) barplot(dat$Average, ylim=c(0,max(dat[,2]+.2))) text(Graph, dat[,2], dat[,1], pos=3) The reason for the ylim is so that the number for the righthand bar does not go outside the plot area. --- On Mon, 7/27/09, Mohsen Jafariki

Re: [R] How should i change the SAS Codes into R Codes?

2009-07-27 Thread John Kane
I see Matt Aldridge has given you the answers to your specific questions. If you are used to using SAS you might find Bob Meunchen's book "Muenchen, R. A. (2008). R for SAS and SPSS Users (1st ed.). Springer." useful. A shorter version is available as a pdf at http://rforsasandspssusers.co

Re: [R] pairs plot

2009-07-28 Thread John Kane
Have you installed it first? First: install.packages("TeachingDemos") Then: library(TeachingDemos) --- On Tue, 7/28/09, Jose Narillos de Santos wrote: > From: Jose Narillos de Santos > Subject: Re: [R] pairs plot > To: "Petr PIKAL" , r-help@r-project.org, > greg.s...@imail.org > Received:

Re: [R] formatting in r

2009-07-28 Thread John Kane
I'm not really clear on what you want here. First I guess, is the question of where those results are coming from? To 'print' or output to another format depends on what you have and how you want to print it. At the very simplest is ?sink, after that is ?write.table and after that you might

Re: [R] how to skip a numeric column for averaging other columns?

2009-07-29 Thread John Kane
log.raw.data <- log(raw.data[,2:10]) I think but I don't understand the "Data has the first row for variable name" comment --- On Wed, 7/29/09, sandsky wrote: > From: sandsky > Subject: [R] how to skip a numeric column for averaging other columns? > To: r-help@r-project.org > Received: We

Re: [R] Package with function for plots with embedded hyperlinks?

2009-07-29 Thread John Kane
Don't leave us hanging! What is it? --- On Wed, 7/29/09, Don MacQueen wrote: > From: Don MacQueen > Subject: Re: [R] Package with function for plots with embedded hyperlinks? > To: r-help@r-project.org > Received: Wednesday, July 29, 2009, 11:43 AM > Never mind, just after I sent this I > fi

Re: [R] Side by Side Barplot Newbie Question

2009-07-29 Thread John Kane
I think your data is set up incorrectly. With your data below as "xx" try this. # Dotcharts are often better than barplots so you might want to # try this library(reshape) mm <- melt(xx, id=c(1:2)); mm bb <- as.matrix(cast(mm,

Re: [R] Scatter Plot

2009-07-30 Thread John Kane
x <- 1:10 y <- 1:10 plot("", xlim=c(1,10),ylim=c(0,10) text(x,y, labels=x) --- On Thu, 7/30/09, amna khan wrote: > From: amna khan > Subject: [R] Scatter Plot > To: r-help@r-project.org > Received: Thursday, July 30, 2009, 12:14 PM > Dear Sir > > I want to write the numbers 1,2,3,on a sca

Re: [R] for loop for file names

2009-07-30 Thread John Kane
I'm just guessing but what about letters <- letters[1:6] mynames <- paste("pred/Pred_pres_",letters,"_indpdt") for(i in 1:6) load(mynames[i]) --- On Thu, 7/30/09, waltzmiester wrote: > From: waltzmiester > Subject: Re: [R] for loop for file names > To: r-help@r-project.org > Received: Thursd

Re: [R] weight median by count for multiple records

2009-07-30 Thread John Kane
This may do it but I have not verified the figures. library(cwhmisc) by(xx[,3:4],xx[,2],function(x,y) weighted.mean(x,y)) --- On Thu, 7/30/09, Kirsten Beyer wrote: > From: Kirsten Beyer > Subject: [R] weight median by count for multiple records > To: r-help@r-project.org > Received: Thursday

Re: [R] ask help about boxplot , different list variation into the tick of x-axis?

2009-07-30 Thread John Kane
You are trying to apply a funtion to a data.frame that is intended to work on a vector that is indexed on another vector. Try pasting this into R to see what I mean boxplot(len ~ dose, data = ToothGrowth) ToothGrowth --- On Thu, 7/30/09, Jie TANG wrote: > From: Jie TANG > Subject: [R]

Re: [R] ask help about boxplot , different list variation into the tick of x-axis?

2009-07-30 Thread John Kane
x(rnorm(60, 25, 5),ncol=5), years)) library(reshape) newdata <- (melt(mydata, id=c("years"))) boxplot(value~years, data=newdata) #== --- On Thu, 7/30/09, John Kane wrote: > From: John Kane > Subjec

Re: [R] What is the best method to produce means by categorical factors?

2009-07-30 Thread John Kane
The most common would be aggregate. You can change mean for other functions ( e.g. sum or length, median, or one you write yourself) You probably would find Bob Munechen's book http://rforsasandspssusers.com/ very useful and there is a shorter pdf available on that page. Example: dd <- data.

Re: [R] Fill dataframe from a table according to a criteria

2009-07-31 Thread John Kane
Your posting arrives as plain text so it is impossible to see what you had highlighed in red. Also it is very difficult to see what is in that data.frame. Could you either reduce the data.frame to make minimal, self-contained, reproducible code. A good approach might be to use dput to cre

Re: [R] Add columns in a dataframe and fill them from another table according to a criteria

2009-08-02 Thread John Kane
I'm still not sure that I understand what you are looking for. However building on David Winsemius does this give you what you want? #== pstate<-read.table(textConnection("Changes State1 State2 State3 State4 a Pa1 Pa2 Pa3 Pa

Re: [R] why is 0 not an integer?

2009-08-05 Thread John Kane
Pesumably because v[1] <- 0 give a numeric result, then the rest of v is coerced into numeric. Observe v <- 0:10 class(v) v[1] <- as.integer(0) class(v[1]) class(v) --- On Wed, 8/5/09, Steve Jaffe wrote: > From: Steve Jaffe > Subject: [R] why is 0 not an integer? > To: r-help@r-project.org

Re: [R] problem with r import data

2009-08-06 Thread John Kane
?read.table and check on the options offered by read.csv2. Open the file in a text editor and see what you have. Check the delimiters and be sure that that they are either ; as specified in read.csv2 or else specify the delimiter ( sep= "???" --- On Thu, 8/6/09, Inchallah Yarab wrote: > F

[R] Simple plot of values and error bars: Is there an existing function for this

2010-04-02 Thread John Kane
In an OpenOffice.org forum someone asked if it was possible to plot some raw data and then add a line for the confidence interval. Example at  http://www.graphpad.com/help/Prism5/scatter%20-%20grouped.png While it may be possible to do this in OOo's spreadsheet program it looks nasty (both to

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. This

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 wrote: > From: Ista Zahn > Subject: Re: [R] Scree diagram, > To: "Philip Wong" > Cc: r-help@r-project.org > Received: Sunday, May 2, 2010, 10:51 AM >

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 library(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 wrote: > From: Nish > Subject:

Re: [R] How to replace all 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 wrote: > From: Nevil Amos > Subject: [R] How to replace all values in a data.frame with another ( > not 0) value > To: r-h...@stat.math.ethz.ch > Received: Tuesday, May 4, 2010, 8:54

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 wrote: > From: someone > Subject: [R]

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 wrote: > From: Mohan L > 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 > 9.75 4.50 4.50 8.67

Re: [R] save txt file

2009-09-24 Thread John Kane
a<-rbinom(4,10,0.8) b<-rbinom(2,6,0.7) # See ?write.table for many options write.table(t(a), file="D:/myfile.txt") # t() to give row of data. write.table(t(b), file="D:/myfile.txt", append=TRUE) --- On Wed, 9/23/09, Eiger wrote: > From: Eiger > Subject: [R] save txt file > To: r-help@r-pr

Re: [R] grep or other complex string matching approach to capture necessary information...

2009-09-26 Thread John Kane
?subset problems <- c( "Water damage", "Water off", "water pipes damaged", "leaking water") damaged <- subset(house_info, house_info[,1]==problems[1] | house_info[,1]==problems[2] | house_info[,1]==problems[3] | house_info[,1]==

Re: [R] Re tain current graphs in figure

2009-09-26 Thread John Kane
Depends on the graphing system. For basic graphics have a look at ?points ?line ?par(new) for varous options ggplot2 is designed pretty much to do this so you might want to have a look at its documentation. Not sure about lattice as don't use it. --- On Thu, 9/24/09, Natalie Wong wrote:

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 wrote: > From: baxterj > 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 starting to code

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 wrote: > From: David Winsemius > Subject: Re: [R] Urgently needed

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 wrote: > From: RR99 > Subject: [R] Saving each output of a loop into so

[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 = structure(c(5

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

2009-10-06 Thread John Kane
) > To: "John Kane" > Cc: "R R-help" > Received: Tuesday, October 6, 2009, 2:57 PM > Hi, > > 2009/10/6 John Kane : > > How do I suppress the numbers on the x-axis? > > > > Try this, > > p + opts(axis

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

2009-10-06 Thread John Kane
Blindingly obvious!! Thanks for that. I can see it will help me find more than one option that I've been interested in. --- On Tue, 10/6/09, baptiste auguie wrote: > From: baptiste auguie > Subject: Re: [R] ggplot equivalent of par(xaxt) > To: "John Kane" >

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 wrote: > From: zhiji

[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 h

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 wrote: > From: carol white > Subject: [R] plot the same types

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 wrote: > From: spidermonkeydp > 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 anyone know if it is possible to a

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 wrote: > From: Orvalho Augusto > Subject: [R] SPSS long variable names > To: r-help@r-project.org > Received: Saturday, October 10, 2009, 12:14 PM > Hello guys I am new to this list

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 wrote: > From: Joel Fürstenberg-Hägg > Subject: [R] Division of data frame and deletion of values from column > To: r-help@r-project.org > Received: Friday, October 16, 2009, 12:16 PM > > Hi all, > > I guess this might be an easy que

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 wrote: > From: Patrick Burns > Subject: Re: [R] "negative length vectors are not allowed" in wilcox.exact() > and perm.test() > To: "Ben Bolker" > Cc: r-help@r-project.org > Received: Friday, October 16, 2009, 1:45 PM >

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 wrote: > From: Noah Silverman > Subject: [R] Different way of scaling data > To: "r help" > Received: Friday, October 16, 2009,

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 wrote: > From: Sean

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

2009-10-17 Thread John Kane
?TukeyHSD --- On Fri, 10/16/09, Leslie J Seltzer wrote: > From: Leslie J Seltzer > 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 rows and > columns in it. I

[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
== --- On Sat, 10/17/09, m...@z107.de wrote: > From: m...@z107.de > Subject: Re: [R] Putting names on a ggplot > To: "John Kane" > Cc: "R R-help" > Received: Saturday, October 17, 2009, 5:53 PM > hi, > >

Re: [R] Putting names on a ggplot

2009-10-18 Thread John Kane
--- On Sun, 10/18/09, m...@z107.de wrote: > From: m...@z107.de > Subject: Re: [R] Putting names on a ggplot > To: "John Kane" > Cc: "R R-help" > Received: Sunday, October 18, 2009, 6:05 PM > hello, > > On Sun, Oct 18, 2009 at 08:29:19AM -0

Re: [R] Putting names on a ggplot

2009-10-22 Thread John Kane
--- On Tue, 10/20/09, hadley wickham wrote: > From: hadley wickham > Subject: Re: [R] Putting names on a ggplot > To: "John Kane" > Cc: m...@z107.de, "R R-help" > Received: Tuesday, October 20, 2009, 10:59 AM > On Sun, Oct 18, 2009 at 10:29 AM, > J

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 wrote: > From: Ashta > Subject: [R] Inserting rows > To: "R help" > Received: Friday, October 23, 2009, 9:44 AM > Hi all, > > I have the data set  df with three varaib

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 wrote: > From: Joel Fürstenberg-Hägg > Subject: [R] Change positions of columns in data frame > To: r-help@r-project.org > Received:

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 wrote: > From: e-letter > 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, > > I have a data set as fo

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 wrote: > From: premmad > Subject: [R] R crashes > To: r-help@r-project.org > Received: Thursday, October 29, 20

Re: [R] polar.plot

2009-10-31 Thread John Kane
--- On Fri, 10/30/09, Tony Greig wrote: > From: Tony Greig > 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 using polar.plot from the plotrix >

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 <- data.frame(

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 wrote: > From: David Winsemius > Subject: Re: [R] how to loop thru a matrix or data frame , and append > calculations to a new data frame? > To: "John Kane" > Cc: r-help@

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 wrote: > From: Ashta > Subject: [R] look up and Missing > To: r-h...@stat.math.ethz.ch > Received: Sunday, November 8, 2009, 10:23 AM > HI  R-User

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 wrote: > From: sylvain willart > Subject: [R] Counting non-empty levels of a factor > To:

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 t

Re: [R] How to z-standardize for subgroups?

2009-11-29 Thread John Kane
http://finzi.psych.upenn.edu/R/library/QuantPsyc/html/Make.Z.html Make.Z in the QuantPsych package may already do it. --- On Sun, 11/29/09, Karsten Wolf wrote: > From: Karsten Wolf > Subject: [R] How to z-standardize for subgroups? > To: r-help@r-project.org > Received: Sunday, November 29, 20

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 wrote: > From: ggraves > Subject: [R] write.csv fails with $ operator invalid for atomic > To: r-help@r-project.org > Received: Tuesday, December 1, 2009, 1:36 PM > > I want

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 wrote: > From: Tom Pitt > 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" and a number to a stri

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 wrote: > From: rkevinbur...@charter.net > Subject: Re: [R] write.csv and header > To: "Gustaf Rydevik" , "Patrick Connolly" > > Cc: r-

Re: [R] How to print to file?

2009-12-19 Thread John Kane
?sink perhaps? --- On Sat, 12/19/09, Peng Yu wrote: > From: Peng Yu > 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 > me know what function I should us

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 wrote: > From: Jose Narillos de Santos >

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 cl

Re: [R] [OT?]R Reference Manual review/recommend

2009-05-14 Thread John Kane
I don't know the book but I doubt that it is a good way to learn R. I'd suggest having a look at some of the documentation available on the R site. Click on Other (in left column of page) have a look there and then select the " contributed documentation" link to get more documentation. Hav

Re: [R] How to convert blanks to NA

2009-06-02 Thread John Kane
Does this do what you want x <- data.frame(1,"" , 5) x[x==""] <- NA x where x is substituted for your 'data'? - Original Message From: Mark Na To: r-help@r-project.org Sent: Tuesday, June 2, 2009 3:14:00 PM Subject: [R] How to convert blanks to NA Hi R-helpers, I have imported d

Re: [R] vector and NA

2009-06-23 Thread John Kane
?is.na and its negative !is.na Try something like this xx <- c(NA, NA, 1, 2, 3) bb <- xx[!is.na(xx)] bb --- On Tue, 6/23/09, Alfredo Alessandrini wrote: > From: Alfredo Alessandrini > Subject: [R] vector and NA > To: r-help@r-project.org > Received: Tuesday, June 23, 2009, 5:41 AM > Hi, >

Re: [R] driver file

2009-06-24 Thread John Kane
Do you mean something like source? Type ?source for help --- On Tue, 6/23/09, Derek Lacoursiere wrote: > From: Derek Lacoursiere > Subject: [R] driver file > To: r-help@r-project.org > Received: Tuesday, June 23, 2009, 3:05 PM > > Hi, > > How can I, from a single "driver" file, source othe

Re: [R] Do you use R for data manipulation?

2009-05-06 Thread John Kane
--- On Wed, 5/6/09, Farrel Buchinsky wrote: > Is R an appropriate tool for data > manipulation and data reshaping and data > organizing? I think so but someone who recently joined our > group thinks not. I only do small scale projects and am by no means a programmer. Isn't Perl something for

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 wrote: > From: Maithili Shiva > Subject: Re: [R] Reading Input file >

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] <- c(rep("a",5),

<    1   2   3   4   5   6   7   8   9   10   >