Displaying 20 results from an estimated 10000 matches similar to: "tapply within a data.frame: a simpler alternative?"
2008 Jul 25
3
melting a list: basic question
Dear list,
I'm trying to use the reshape package to perform a merging operation
on a list of data.frames as illustrated below,
> a <- 1:10
> example <- list( data.frame(a=a, b=sin(a)), data.frame(a=a,
> b=cos(a)) )
>
> melt(example, id = a)
this produces the desired result, where the data.frames have been
coerced into one with a common identifier variable
2009 Jan 14
1
publication statistics from Web of Science
Dear list,
This is a bit of an off-topic question, but I'm hoping to get some
advice from more experienced people. I've used the website "Web of
Science" to manually collect publication counts responding to several
keywords as a function of date, since the 1960s.
http://apps.isiknowledge.com/RAMore.do?product=UA&search_mode=&SID=P1g9lFJp9 at
2010 Aug 11
2
help to polish plot in ggplot2
Hi,
I wanted to generate a plot which is almost like the plot generated by the
following codes.
category <- paste("Geographical Category", 1:10)
grp1 <- rnorm(10, mean=10, sd=10)
grp2 <- rnorm(10, mean=20, sd=10)
grp3 <- rnorm(10, mean=15, sd=10)
grp4 <- rnorm(10, mean=12, sd=10)
mydat <- data.frame(category,grp1,grp2,grp3,grp4)
dat.m <- melt(mydat)
p <-
2008 Feb 03
1
distances between points in R^3
Dear R helpers,
I'm trying to write a numerical scheme for a boundary integral method
to solve an electromagnetic problem. This requires the computation of
the distance between points at the surface of an object (a sphere, in
my example). Here is my code,
> require(rgl)
> r<-1
> size<-10
> theta<-seq(0,2*pi,length=size*2)
> phi<-seq(0,pi,length=size)
> pc
2009 Apr 03
2
Help pasting string as object name
I have a data frame containing monthly observations of the 'density' of each US state, recorded in variables named "density.AL", "density.AK", "density.AZ", and so on for all 50 states. The data frame (called d) also contains a variable called "Date" which is encoded as a string in the format "Jan-09", "Feb-09", etc.
I also have
2009 Apr 03
3
plyr and table question
Dear all,
I'm puzzled by the following example inspired by a recent question on
R-help,
cc <- textConnection("user_id website time
20 google 0930
21 yahoo 0935
20 facebook 1000
25 facebook 1015
61 google 0940")
d <- read.table(cc, head=T) ; close(cc)
table(d$user_id) # count the
2009 Mar 25
2
"[.data.frame" and lapply
Dear all,
Trying to extract a few rows for each element of a list of
data.frames, I'm puzzled by the following behaviour,
> d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5)))
> str(d)
>
> lapply(d, "[", i= c(1)) # fine, this extracts the first columns
> lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?!
>
> library(plyr)
2009 Mar 25
2
"[.data.frame" and lapply
Dear all,
Trying to extract a few rows for each element of a list of
data.frames, I'm puzzled by the following behaviour,
> d <- lapply(1:4, function(i) data.frame(x=rnorm(5), y=rnorm(5)))
> str(d)
>
> lapply(d, "[", i= c(1)) # fine, this extracts the first columns
> lapply(d, "[", j= c(1, 3)) # doesn't do nothing ?!
>
> library(plyr)
2008 Aug 25
1
lattice : using both strip and strip.left
Dear all,
I'm routinely using lattice and ggplot2, I wish to create a lattice
theme that looks not too dissimilar to ggplot's defaults so I can
include both graphs in a document with a consistent look.
To illustrate my questions, consider the following example:
> library(ggplot2)
> library(lattice)
>
> # example data
> x <- seq(0, 10, len = 100)
> y1 <-
2009 May 27
3
Axis label spanning multiple plots
Hello
I need to plot 3 graphs in a single column; the top two plots have the
same title, and I would like it to be written only once, centered
horizontally and spanning the two plots. Something like
t +------------+
| |
i | |
| |
t +------------+
l +------------+
| |
e | |
| |
1 +------------+
t
2008 Aug 09
2
levels values of cut()
Dear list,
I have the following example, from which I am hoping to retrieve
numeric values of the factor levels (that is, without the brackets):
>
> x <- seq(1, 15, length=100)
> y <- sin(x)
>
> my.cuts <- cut(which(abs(y) < 1e-1), 3)
> levels(my.cuts)
hist() does not suit me for this, as it does not necessarily respect
the number of breaks.
getAnywhere
2009 Jul 03
3
Variable names in lattice XY-plot
Hi,
how can I get a more descriptive text
instead of the variable names in my XY-lattice plot,
according to the table below?
Variable text
acet = "Acetylaspartate Thalamus"
chol = "Choline Thalamus"
acetp = "Acetylaspartate parieoc"
ino = "Inositole Thalamus"
I could not find a solution.
Please have a look at my syntax.
Thanks a lot,
2009 Jun 25
3
grid.polygon() + color gradient
Hi,
I wonder whether there is a way to generate a polygon (a triangle in
my case) with color gradient using grid.polygon() in package grid?
I tried something like
library(grid)
grid.polygon(x=c(0, 0.5, 1), y=c(0.5, 1, 0.5), gp=gpar(col=NA,
fill=colorRampPalette(c("green", "lightgray"),
space="Lab")(200)))
But am only
2011 Aug 25
1
Specifying argument values in a function
Hello all,
I am trying write a fairly simple function that provide a quick way to
calculate several distributions for a data set. I am trying to provide
a function that has a argument that specifies which distribution is
outputted (here "norm" or "cumu"). I also have a melt argument but
that seems to be working fine. I have been able to get my function
working well for just
2008 Nov 09
1
[Rd] Re Bessel functions of complex argument
Dear all,
I'm writing a code that requires Bessel functions with complex argument.
Searching the list, I found the continuation of a thread I initiated a few
months ago:
http://tolstoy.newcastle.edu.au/R/e4/devel/08/03/0746.html
As I understand, the most promising option would be to use the fortran or C
implementation of Amos,
2009 Mar 27
3
Ploting a matrix
Hi evrybody,
in a matrix consisting of 49 columns, I would like to plot all columns
against the first in 48 different graphs.
Can you help me?
Thank you in advance
Sebastian
--
***************************************************************************************************************
Dipl. Biol. Sebastian Krug
PhD - student
IFM - GEOMAR
Leibniz Institute of Marine Sciences
Research
2009 Jan 25
1
Multiple lattice plots on a page: aligning x-axes vertically
Dear R-help,
I am creating a two lattice plots (a densityplot() and xyplot()) that
have the same x-axes and then 'printing' them onto the same page, one
above the other (see end of email for an example to generate the graph).
With different labels on the y-axis for each plot the left spacing is
different, and the x-axes don't align vertically. Although I can
manually modify the
2009 Apr 16
3
segment between points on different plots
Hi,
I need to draw a line segment between two points on different plots in the
same multigraph.I've tried looking at the zoominplot function in plotrix but
havent understood much.any help is appreciated
~Aks
[[alternative HTML version deleted]]
2009 Jan 09
2
recursive relevel
Dear list,
I'm having second thoughts after solving a very trivial problem: I
want to extend the relevel() function to reorder an arbitrary number
of levels of a factor in one go. I could not find a trivial way of
using the code obtained by getS3method("relevel","factor"). Instead, I
thought of solving the problem in a recursive manner (possibly after
reading
2009 Jul 30
4
Scatter Plot
Dear Sir
I want to write the numbers 1,2,3,----on a scatter plot instead of points,
like 1 corresponding to first point on plot, 2 corresponding second point
etc.
Help in this regard.
Regards
--
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
[[alternative HTML version deleted]]