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
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
--- 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:
> >
?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
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,
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
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
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
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
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
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])
===
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
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.
==
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
--- 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.
_
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
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
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
>
>
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
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
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
--- 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
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
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
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:
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
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
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
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,
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
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
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
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]
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
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.
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
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
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
?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
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
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.
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
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- ",
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
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
>
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)
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)
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:
?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
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]
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
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
?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]==
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:
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
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
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
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
)
> 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
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"
>
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
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
?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
?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
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
?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
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
>
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,
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
?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
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
==
--- 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,
>
>
--- 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
--- 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
?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
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:
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
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,
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
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
--- 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
>
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(
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@
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
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:
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
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
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
?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
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-
?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
?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
>
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
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
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
?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,
>
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
--- 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
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
>
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),
401 - 500 of 1800 matches
Mail list logo