)) + geom_histogram() + facet_grid(.~variable) +
geom_vline(xintercept=c(5,10,15))
How can I add a vertical line at different x positions on each facet?
Thanks very much,
Scott Chamberlain
[[alternative HTML version deleted]]
__
R-help@r-project.org
R in any fashion?
Thanks, Scott Chamberlain
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and
Dear R Community,
I recently switched to a Mac (10.6.5), and have installed Textwrangler to
run code to R. However, I can't install the syntax highlighting file because
I can't find the directory: "~Users/username/Library/Application
Support/TextWrangler/Language Modules/". Is there a different lo
ct instead all elements that are not
missing. That is, do not select any elements that are simply "".
output <- c("a b 6")
gsub(" ","",unlist(strsplit(output," ",fixed=TRUE)))
[1] "a""" "b"
nstead all elements that
are not missing. That is, do not select any elements that are simply "".
output <- c("a b 6")
gsub(" ","",unlist(strsplit(output," ",fixed=TRUE)))
[1] "a""" "b"&q
5
[5,] 0 1 1 0 1
[6,] 1 0 2 3 1
[7,] 1 1 0 1 2
[8,] 0 1 0 4 1
[9,] 0 0 1 0 0
[10,] 1 3 0 2 3
Sincerely,
Scott Chamberlain
Rice University, EEB Dept.
[[alternative HTML
> df.1 <- merge(df.1, df.2, by = "year") > df.1$sum <- df.1$number.x +
> df.1$number.y
> df.1 year level number.x number.y sum 1 1 a 11 21 32 2 1 a 17 21 38 3 1 a 14
> 21 35 4 2 b 12 22 34 5 2 b 15 22 37 6 2 b 18 22 40 7 3 c 16 23 39 8 3 c 13 23
> 36 9 3 c 19 23 42
Scott
On Wednesday, April
what about something like:
dat <- data.frame(var1 = c("a","b"), var2 = c("c","d"))
dat$var3 <- sapply(dat, function(x) paste(dat$var1,dat$var2,sep=""))[,1]
Scott
On Thursday, April 28, 2011 at 10:22 AM, Abraham Mathew wrote:
I've kind of solved the issue.
>
> dat$Time <- paste(dat[,2], dat[,1]
This for example could work
df <- data.frame(x = seq(1:10), y = rep(c("a","b"),5))
df
df$x[df$y %in% "a"]
Scott
On Wednesday, May 4, 2011 at 4:01 AM, tornanddesperate wrote:
> Hi everybody
>
> I couldn't find the solution to what must be quite a simple problem. Maybe
> you can help?
>
> tre
What about the example in gridExtra package:
require(ggplot2); require(lattice); require(gridExtra)
grid.arrange(qplot(1:10), xyplot(1:10~1:10), tableGrob(head(iris)), nrow=2,
as.table=TRUE, main="test main", sub=textGrob("test sub", gp=gpar(font=2)))
On Wednesday, May 4, 2011 at 1:44 PM, Jonatha
merge(dat, pheno, by.x = "sid", by.y = "sen")
Scott
On Wednesday, May 4, 2011 at 12:53 PM, 1Rnwb wrote:
> Hello,
>
> I have data in a dataframe with 139104 rows which is multiple of 96x1449. i
> have a phenotype file which contains the phenotype information for the 96
> samples. the snp name i
I think those functions are now defunct (were only available in previous
versions).
S
On Thursday, May 5, 2011 at 6:33 PM, Andrew Robinson wrote:
> Hi Arnau,
>
> please send the output of sessionInfo() and the exact commands and
> response that you used to install and load apTreeshape.
>
> Ch
Not knowing what format your data is in or what model you are using...
df # is your data frame with columns the variables you are running regressions
for
datout <- data.frame(coeff = NA, conf_low = NA, conf_high = NA, odd = NA) # a
table to put your results in
for(i in 1:length(names(df)[2:10]))
You should provide reproducible data in addition to your code.
S
On Tuesday, May 10, 2011 at 11:54 AM, Alaios wrote:
> Dear all,
> today I have writted the following code,
> to plot the contents of some matrices I have
>
> plot_shad_f
> function(f){
> library(ggplot2)
> dev.new()
> plotdata<
100)
> plot_shad_f(f)
>
>
> I would like to add a circle at the middle of this region with a range of 10.
>
> Best Regards
>
> Alex
>
> --- On Tue, 5/10/11, Scott Chamberlain wrote:
> >
> > From: Scott Chamberlain
> > Subject: Re: [R] ggplot2 and ad
Here is a thread I found on this
issue:http://www.mail-archive.com/r-sig-ecology@r-project.org/msg00755.html
It's not a simple correlation apparently, but I can't figure out how they get
the output from envfit using lm(Y ~ scores1 + scores2).
You can plot the data like:
library(MASS); require(
How about this:
ddply(test.set, .(site), colwise(max))
On Wednesday, May 11, 2011 at 11:46 AM, Justin wrote:
> test.set<-data.frame(site=1:10,x=.Random.seed[1:100],y=rnorm(100))
> means<-ddply(test.set,.(site),mean)
> means
[[alternative HTML version deleted]]
That's beyond my knowledge of plyr...S
On Wednesday, May 11, 2011 at 12:31 PM, Justin wrote:
> Scott Chamberlain gmail.com> writes:
>
> >
> > How about this:
> >
> > ddply(test.set, .(site), colwise(max))
> > On Wednesday, May 11, 2011 at 11:46 A
require(plyr)
laply(list(y1, y2, y3, y4), length)
Scott
On Thursday, May 12, 2011 at 11:50 AM, Asan Ramzan wrote:
Hi
>
> I have four groups
>
> y1=c(1.214,1.180,1.199)
> y2=c(1.614,1.710,1.867,1.479)
> y3=c(1.361,1.270,1.375,1.299)
> y4=c(1.459,1.335)
> Is there a function that can give me the
Have you looked into the options for par?, which it looks like can be included
in your call to biplot, perhaps adj or something else to reduce overlap.
Scott
On Friday, May 13, 2011 at 4:38 AM, Anna Renwick wrote:
> Hi all
>
> I have produced a biplot for a PCA (see attached pdf) that I ran ho
Can you provide a brief reproducible example for us to play with?
Scott
On Tuesday, May 17, 2011 at 12:31 PM, Stijn Van Daele wrote:
> Dear R users,
>
> I have a problem with reshaping data. I know such questions have been asked
> before, but I can't get it right, neither with the reshape funct
data$tp <- factor(data$tp, levels = c("TP-ANY","TP-SUB","TP-CLIN"))
qplot(life,geom="bar",weight=sym,ylim=c(0,1),legend=F,data=data) +
facet_grid(. ~ tp)
On Wednesday, May 18, 2011 at 9:14 AM, Christopher Desjardins wrote:
Hi I am running the following code:
>
> sym <- c(sym1,sym2,sym4)
>
> life
There are a number of discussion threads on the google groups ggplot2 page:
here are two of them.
http://groups.google.com/group/ggplot2/browse_thread/thread/ca546f7f4d636deb/e0763a54b7735c35?lnk=gst&q=fill+pattern#e0763a54b7735c35
http://groups.google.com/group/ggplot2/browse_thread/thread/9a9c
The following works to get an igraph object from a matrix edgelist:
dat2 <- matrix(rep(seq(1,5,1), 4), nrow=10, ncol=2)
graph.edgelist( dat2 )
I tried with NA's but graph.edgelist did not allow NA's. Wouldn't you just
leave those rows out with NA's in them? An NA means there is no edge, right?
Is it not something like?
package1::myfunction
package2::myfunction
On Wednesday, May 18, 2011 at 9:02 PM, Nick Matzke wrote:
> Hi,
>
> If I load 2 packages that have a function with the same
> name, how do I tell R to run one or the other?
>
> (Instead of having R automatically use the first
# If you know how many years are needed you could do this
makenewtable <- function(x, years) {
xlist <- split(x, x$firm)
new <- list()
dat <- lapply(xlist, function(z) if(length(unique(z$year)) == years) {new <- z}
)
dat_ <- do.call(rbind, dat)
return(dat_)
}
makenewtable(finaldata, 5)
Scott
On
You generally aren't allowed to have duplicate row names in a data frame in R.
If you want to keep your rownames you can make them a column in the data frame
before unsplitting.
Scott
On Thursday, May 19, 2011 at 5:27 AM, Cecilia Carmo wrote:
> Hi everyone,
>
>
>
> I have already used split
rches.
Is there a connection to the site that needs to be closed or cleared somehow
prior to another search to the same site?
Scott Chamberlain
Rice University, EEB Dept.
> sessionInfo() R version 2.13.0 (2011-04-13) Platform:
> x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C/
lts from
the lapply call above
This will give you a data frame of all the results.
Scott Chamberlain
Rice University, EEB Dept.
On Monday, May 23, 2011 at 4:32 PM, Bazman76 wrote:
Hi there,
>
> I ran the following code:
>
> vols=read.csv(file="C:/Documents and Settings/H
See ?t
__Scott Chamberlain
Rice University, EEB Dept.
On Wednesday, May 25, 2011 at 9:07 AM, Mohamed Lajnef wrote:
> Dear All,
> Suppose this data.frame
> D
>
> V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22
> C C C C T T G G A A C C G G C C
> G G T T A A A A T
Or use melt in the reshape2 package to melt all columns to one with an indexing
column to boot...
__Scott Chamberlain
Rice University, EEB Dept.
On Wednesday, May 25, 2011 at 7:06 AM, zoe.cryocla wrote:
> Ok, I found how to do,
> with the function paste()
>
> --
> View th
The following returns zeros where elements do match, and NaN's where they don't
match
mat1 <- matrix(c(1,2,1,2), 2, 2)
mat2 <- matrix(c(0,0,1,2), 2, 2)
mat1 %% mat2
__Scott Chamberlain
Rice University, EEB Dept.
On Tuesday, May 31, 2011 at 8:41 AM, Alaios wrote:
> Dear
Would this work for you, using the example in the TukeyHSD documentation?
summary(fm1 <- aov(breaks ~ wool + tension, data = warpbreaks))
temp <- TukeyHSD(fm1, "tension", ordered = TRUE)
write.csv(data.frame(temp$tension), 'tukeyresults.csv')
__Scott Chamberlain
Rice Universi
t(p2s),t(p3s),t(p9s)))
Error in t(p9s) : object 'p9s' not found
Thanks, Scott Chamberlain
Rice University
Houston, TX
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www
te(Names,collapse=",")
> expr = paste("output <- data.frame(",Names,")",sep="")
> eval(parse(text=expr))
>
> Both are not really the most optimal solution, but do work. It would
> be better if you made a list or matrix beforehand and then sav
Dear R users,
I am curious if someone could direct me towards websites/tutorials for uses of
progress bars (especially) in R. I can't seem to figure them out.
Thanks very much, Scott
[[alternative HTML version deleted]]
__
R-help@r-projec
Dear R users,
I tried to use the built in parallelization in RevolutionR 2.10.0 on my Mac
OSX, with i5 processor (so 4 cores). Nothing happens when I use %dopar% for
parallelization in RevolutionR 2.10.0, and using 2.12.1 I just get errors:
library(doMC)
registerDoMC()
getDoParWorkers()
x <-
Dear Jari,
For what it's worth, I could see the need in my own work for species
accumulation curves with variable sampling effort.
Scott Chamberlain
On Tuesday, February 22, 2011 at 2:26 AM, Jari Oksanen wrote:
Vanessa Francisco gmail.com> writes:
>
> >
> > Hello! I&
this works:
colnames(IBM) <- c("open","high","low","close","vol")
scott
On Wednesday, February 23, 2011 at 7:55 AM, Kushan Thakkar wrote:
> colnames(my.ticker) <- c("open","high","low","close","vol")
[[alternative HTML version deleted]]
__
R
Hi Sandra,
Terribly ugly, but this way at least you don't have to know which years are
missing, etc.:
dat <- data.frame(year = c(1981,1984,1985,1986), size = c(1,2,3,4))
year_ <- data.frame(year = seq(1981,1986,1))
year_dat <- merge(year_, dat, by = "year", all=T)
na_s <- subset(year_dat, is.n
I imagine you want the ggplot2 package.
something like:
ggplot(dataframe, aes(x = yourxvar, y = youryvar)) +
geom_point() +
facet_wrap(~ ProbeSet.ID)
Or facet_grid(), either of which makes a different panel for each unique level
of ProbeSet.ID
see gggplot help here: http://had.co.nz/ggplot2/
Works fine on my machine:
> DF
A B C D E
1 1 a 1999 0 0
2 1 b 1999 0 0
3 1 c 1999 0 0
4 1 d 1999 0 0
5 2 c 2001 0 1
6 2 d 2001 1 0
7 3 a 2004 1 0
8 3 b 2004 0 1
9 3 d 2004 1 1
10 4 b 2001 0 2
11 4 c 2001 1 1
12 4 d 2001 1 2
here's my session info:
> sessionInfo()
R version 2.12.1 (2010-12-16)
chris, it seems like you need the plyr package, esp ddply. for example:
stems353 <- data.frame(Time = rep(c("Modern", "Old"), 4),
SizeClass = rep(c("class1","class2"), each = 4),
Species = rep(c("a","b"), each = 4),
Stems = seq(1,8,1))
ddply(stems353, .(Species, SizeClass, Time), summarise,
mea
VarCorr() and then calculate percentage variance for each component from output
of VarCorr
On Tuesday, March 1, 2011 at 6:55 AM, John Sorkin wrote:
> R 2.10
> Windows Vista
>
> Is it possible to run a variance-components analysis using lme? I looked at
> Pinheiro and Bates' book and don't see c
cor.prob function gives matrix of correlation coefficients and p-values together
### Function for calculating correlation matrix, corrs below diagonal,
### and P-values above diagonal cor.prob <- function(X, dfr = nrow(X) - 2)
{ R <- cor(X) above <- row(R) < col(R) r2 <- R[above]^2 Fsta
see package plyr, especially the function ddply(), eg.., in your case:
ddply(dataframe, .(columnA, columnB), summarise,
columnC = length(columnB)
)
Scott
On Wednesday, March 2, 2011 at 9:10 AM, Simone Gabbriellini wrote:
> Hello List,
>
> I would like to simplify a data.frame like this
>
> co
install.packages("Rcmdr", dependencies=TRUE)
library(Rcmdr)
Scott
On Wednesday, March 2, 2011 at 2:41 AM, Selda Korkmaz wrote:
> Dear Sirs,
>
> i just downloaded the R programm on my Macbook, but I can´t open Rcmdr,
> although I installed the needed Rcmdr-packages. I would be very happy, if y
This thread seems freakishly similar to what you are askingScott
http://tolstoy.newcastle.edu.au/R/help/06/07/30127.html
On Wednesday, March 2, 2011 at 7:43 AM, SK MAIDUL HAQUE wrote:
> I have a text file that I have imported into R. It contains 3 columns and
> 316940 rows. The first column
Agreed Peter: weird. What is the purpose of your inquiry SK? And why is your
inquiry so similar to the one at the hyperlink I provided?
Scott
On Wednesday, March 2, 2011 at 6:10 PM, P Ehlers wrote:
> Scott Chamberlain wrote:
> > This thread seems freakishly similar to what you a
The "y" object within the loop returns a list and you are trying to put the
first row of the 2nd column of the list (which refers to a vector of length 1
to i) into the object z, which is vector. I am not sure at all what you are
trying to end up with.
Scott
On Wednesday, March 2, 2011 at 9:19
You could get close with the ggplot2 package using the function facet_grid or
facet_wrap, but each histogram would be on a separate x-axis
Scott
On Thursday, March 3, 2011 at 8:00 AM, djbirdnerd wrote:
> Hallo everyone,
>
> I want to evaluate the change of the distribution for several size clas
library(igraph)
G <- erdos.renyi.game(1000, 1/1000) # a random graph
dd1 = degree.distribution(G)
plot(dd1, xlab = "degree", ylab="frequency")
abline(h = mean(dd1)) # the mean would be a horizontal line
On Thursday, March 3, 2011 at 4:43 PM, kparamas wrote:
> Hi,
>
> I am plotting degree dis
Hi Richard, This may be a bit ugly, but it should work if you have all your
files in a folder you are calling from. Use dir() within the lapply call in
combination with read.table as the function
require(plyr)
setwd("/Mac/R_stuff/files") # where your files are in this directory, and no
files y
Does this seems like a good stand in for now:
require(ggplot2)
x <- runif(100,1,2)
y <- runif(100,50,60)
z <- runif(100,99,100)
xyz <- melt(data.frame(x,y,z))
ggplot(xyz, aes(value)) +
geom_histogram() +
facet_grid(~ variable, scale="free")
On Sunday, March 6, 2011 at 9:25 PM, cassie jones wr
The code to use would be something like
limits <- aes(ymax = y + se, ymin = y - se) # set error bar dimensions
ggplot(yourdataframe, aes(x = x, y = y, colour = z)) +
geom_point() +
geom_errorbar(limits)
On Tuesday, March 8, 2011 at 9:34 AM, Sascha Vieweg wrote:
> Hello
>
> Currently, I plot
library(tseries)
sie <- get.hist.quote(instrument="SIE.DE", start="2010-01-01", quote="AdjClose")
vow <- get.hist.quote(instrument="VOW.DE", start="2010-01-01", quote="AdjClose")
lin <- get.hist.quote(instrument="LIN.DE", start="2010-01-01", quote="AdjClose")
dax <- get.hist.quote(instrument="^GDA
you could run source(directory/textfilename.txt) [and then you can use it in R]
or paste the function into the console,
or highlight and pass the function from the built in R text editor,
or highlight and pass the function from your external text editor (notepad++,
emacs, textwrangler, etc.)
require(reshape2)
melt(dum, id = 1)
On Wednesday, March 16, 2011 at 9:28 AM, pelt wrote:
Dear all,
>
> I have a dataframe which looks like this (dummy):
>
> date<-c("jan", "feb", "mar", "apr", "may", "june", "july",
> "aug","sep","oct","nov","dec")
> col1<-c(8.2,5.4,4.3,4.1,3.1,2.5,1.1,4.5,3.2,1
require(reshape2)
dcast(stock.returns, Date ~ Ticker)
The numbers were changed from their original values, but if you originally
created the values Return as.numeric they should stay the same
On Wednesday, March 16, 2011 at 9:37 AM, chris99 wrote:
Hi group,
>
> I am trying to convert the organi
> paste(samp, ".pdf", sep="")
[1] "20110317.pdf"
> paste(samp, ".csv", sep="")
[1] "20110317.csv"
On Thursday, March 17, 2011 at 10:05 AM, pierz wrote:
I would like to use samp as a part of a filename that I can change. My source
> files are .csv files with date as the file name, and I would like t
I can't reproduce your work, but I think you just need
> regionMatchABCDE[,i] <- cbind(regionMatch[,10:18])
instead of
regionMatchABCDE <- cbind(regionMatch[,10:18])
within the for loop
Scott
On Monday, March 21, 2011 at 7:36 AM, Who Am I? wrote:
Hoi All,
>
> I am trying to append collums
What about the metafor package?
Or just create your own plot.
For example, using ggplot2 package:
limits <- aes(ymax = OR + (OR - 95%LCI), ymin = OR - (OR - 95%LCI))
ggplot(dataframe, aes(x = Study.Name, y = OR)) + geom_point() +
geom_errobar(limits)
Best,
Scott
On Wednesday, April 6, 2011
Dear R,
I have a bunch of geographic locations specified by lat-long coordinates.
What's an easy way to calculate geographic distance between any two points? OR,
perhaps there is a function for calculating a distance matrix for K sites?
Sincerely,
Scott Chambe
I don't know if it can, but have you looked into the metafor package?
On Monday, April 11, 2011 at 1:46 PM, Iuri Gavronski wrote:
> Sorry for the cross-posting, but I would like to know if anyone is
> aware of a package in R for this.
>
>
>
> -- Forwarded message --
> From: John
Thanks very much for the help!
Scott
On Monday, April 11, 2011 at 12:54 PM, seeliger.c...@epamail.epa.gov wrote:
> I have a bunch of geographic locations specified by lat-long
> > coordinates. What's an easy way to calculate geographic distance
> > between any two points? OR, perhaps there is
Hi Curt,
Thanks for the help.
According to that blogpost you sent, I am using the function gcd.hf using the
Haversine formula. I wrapped it up in a function called CalcDists so that I can
get a distance matrix between N sites.
I don't know much about calculating distances, so does this seem
Something like this could work for you (note that a few other packages would be
faster, such as data.table), but plyr is intuitive.
require(plyr)
# example data set
dat <- data.frame(col1 = rep(c("a","b"), each=5),
col2 = rep(c("prog1","prog2","prog3","prog4","prog5"), 2),
col3 = rnorm(10), co
Hello,
Are there any built in or user defined functions for printing the date created
or date updated for a given file? Ideally a function that works across
operating systems.
Thanks!
Scott Chamberlain
[[alternative HTML version deleted
Eik,
Thanks very much!
Scott
On Tuesday, July 12, 2011 at 8:34 AM, Eik Vettorazzi wrote:
> Hi,
> file.info (http://file.info)()
> does that.
>
> Cheers
>
> Am 12.07.2011 15:29, schrieb Scott Chamberlain:
> > Hello,
> >
> > Are there any built in or
69 matches
Mail list logo