Hi:
The 'easy' solution is to define the colors corresponding to the genotypes
directly in lattice:
xyplot( result ~ time | location, data=dataset, groups=genotype, pch=19,
type=b, col = c('red', 'green', 'blue'))
The problem with trying to use color as a variable to 'match' to genotype is
that
Hi:
Here's a slightly different approach, using both mapply() in base (a la
David) and mlply() in plyr.
My thought was to put the arguments together into a three column data frame;
the names were chosen to correspond to the first three arguments of runif():
params - data.frame(n =
Hi:
Do you mean something like
RSiteSearch('loess predict')
[opens up a web page with 53 matches to the request] or
package(sos)
findFn('multiple imputation')
? If not, could you be more specific about what you're after?
HTH,
Dennis
On Fri, Sep 3, 2010 at 2:23 PM, Waverley @ Palo Alto
Hi:
I did the following test using function ddply() in the plyr package on a toy
data frame with 5 observations using five studies, 20 subjects per
study, 25 cycles per subject, five days per cycle and four observations by
type per day. No date-time variable was included.
# Test data frame
Hi:
Thanks, David and Thierry. I knew what I did was inefficient, but I'm not
very adept with cast() yet. Thanks for the lesson!
The time is less than half without the fun = mean statement, too. On my
system, the timing of David's call was 2.06 s elapsed; with Thierry's, it
was 4.88 s. Both big
Hi:
One option to search for functions in R is to download the sos package:
library(sos)
findFn('Anderson-Darling')
On my system (Win 7), it found 51 matches. The two likeliest packages are
nortest and ADGofTest. To answer your question, nortest still exists on
CRAN. I can't comment on Ubuntu,
Hi:
aggregate() is not well suited for summarization when the summary function
takes multiple input arguments. Better choices for this type of summary are
packages plyr, as David mentioned, and data.table.
Here's a toy example to illustrate. The fake data contain two grouping
variables as
Hi:
As a statistician and long time baseball addict, I concur wholeheartedly
with David that:
...you've got to admit that was one gawdawful graph.
Firstly, the areas are not proportional to the values; this is a common
graphics mistake. (For example, compare baserunning to power - is the area
Hi:
You've already gotten some good replies re aggregate() and plyr; here are
two more choices, from packages doBy and data.table, plus the others for
a contained summary:
key - c(1,1,1,2,2,2)
val1 - rnorm(6)
indf - data.frame( key, val1)
outdf - by(indf, indf$key, function(x) c(m=mean(x),
Hi:
Try this:
library(sos) # install from CRAN if you don't have it
findFn('imputation')
I got 285 hits. That should be enough to get you started.
Here's a recent paper about how to use sos from the R Journal (Dec. 2009):
Hi:
See below.
On Mon, Aug 30, 2010 at 2:21 PM, Bruce Johnson
bruce.ejohn...@verizon.netwrote:
I am trying to do post-hoc tests associated with a repeated measures
analysis with on factor nested within respondents.
The factor (SOI) has 17 levels. The overall testing is working fine, but I
Hi:
I don't know if this is exactly what you wanted, but here goes. I made
a few adjustments in the data frame before calling ggplot():
# library(ggplot2)
# Reorient the order in which variables appear
winter - winter[, c(1, 7, 3, 6, 4, 5, 2)]
# Get rid of second week 26 at the end
winter2 -
Hi:
Here are some functions for computing elementary matrices so that you can do
Gauss elimination the hard way (the easy way is the LU decomposition, but I
digress) I wouldn't use these for serious work, since there are no
checks for matrix instability, but the essential ideas are there. It
Hi:
I'm kind of wondering why Area and Plot are nested within Day. Are you
measuring different areas and different plots on different days?
Dennis
On Fri, Aug 27, 2010 at 12:43 AM, Pablo R ri...@hotmail.com wrote:
Hi,
I need a help. I am new in R and I need to run a nested anova with
Hi:
To find functions in R for particular tasks, package sos is an invaluable
resource:
library(sos)
findFn('latent factor analysis')
produces 72 hits on my system, not all of which are relevant, but at least
it
gets you in the vicinity of what you're looking for. In addition to sem, it
Hi:
One form of a multivariate beta distribution is the Dirichlet, so using
package sos,
library(sos) # install if necessary
u - findFn('Dirichlet distribution')
grepFn('Dirichlet distribution', u, column = 'Description', ignore.case =
TRUE)
reveals about 25 matches, about half of which
Hi:
Here's a ggplot2 version of your graph. Since you didn't include the dates,
I had to make them up, and it may have some consequence with respect to your
times because yours don't appear to be exactly equally spaced.
I created two data frames - an 'original' one that contains both series in
Hi:
Let's start with the data:
str(test.data)
'data.frame': 100 obs. of 4 variables:
$ StudentID: num 17370 17370 17370 17370 17379 ...
$ GroupID : num 1 1 1 1 1 1 1 1 1 1 ...
$ Time : num 1 2 3 4 1 2 3 4 1 2 ...
$ Score: num 76.8 81.8 89.8 92.8 75.9 ...
Both StudentID and
Hi:
You can probably do what you want in either ggplot2 or lattice, but I would
recommend at least a couple different approaches:
(1) Plot individual bar charts by combinations of year and period.
This is easy to do in both ggplot2 and lattice: in ggplot2, one
would use geom_bar(x) +
Hi:
I'm just ideating here (think IBM commercial...) but perhaps a graphical
model approach might be worth looking into. It seems to me that Mr. Rhodes
is looking for clusters of banks that are under the same ownership umbrella.
That information is not directly available in a single variable, but
Hi:
Here are a couple of ways to render a basic 2D table. Let's call your input
data frame dat:
names(dat) - c('samp', 'sequen')
ssTab - as.data.frame(with(dat, table(samp, sequen)))
ssTab # data frame version
samp sequen Freq
1 111abc1
2 1079abc1
3 5576abc1
4
Hi:
The function below plots the line segment between two points A and B as well
as the normal from C to AB, with a dot as the intersection point (D), which
is returned with the function call. The aspect ratio is kept at one so that
the orthogonality between the two lines is not distorted by the
Hi:
On Wed, Aug 25, 2010 at 11:28 AM, Greg Snow greg.s...@imail.org wrote:
Using the barplot function in base graphics you just set space=0, but that
function does not have a box.ratio argument which would imply that you are
using something else. If you let us know which function (and which
Hi:
Here's one way, but there may be better options:
de - read.table(textConnection(
+
Subject,Sessionblock,LotteryImg,SubjectResp,Pictime,Bidtime,Voltage,ForcedAns
+ 10816,Session1,75_C2.jpg,No,7095,9548,Mid,Yes
+ 10816,Session1,25_C1.jpg,No,16629,18130,Low,Yes
+
Hi:
This looks to be a step in the right direction, but the resulting
panels are all the same size. Perhaps you can build on it...
# Solution based on an R-help post by Deepayan Sarkar:
# http://tolstoy.newcastle.edu.au/R/e2/help/06/09/1579.html
dotplot(A ~ B | C, data=dfr,
Hi:
A reasonable place to start would be the Optimization task view at CRAN:
http://cran.r-project.org/web/views/
HTH,
Dennis
On Tue, Aug 24, 2010 at 10:47 AM, David Beacham
d.beacha...@imperial.ac.ukwrote:
I'm relatively new to R, but I'm attempting to do a non-linear maximum
likelihood
Hi:
This is pretty straightforward to do in ggplot2, but it would be nice to
have some data to work with (hint). The job requires processing the two
input series and dates with melt() from the reshape package, a couple of
opts() to change, proper rotation of the dates, etc. It's easier to show
Hi:
Are you running 32-bit or 64-bit R? For memory-intensive processes like
these, 64-bit R is almost a necessity. You might also look into more
efficient ways to invert the matrix, especially if it has special properties
that can be exploited (e.g., symmetry). More to the point, you want to
Hi:
On Mon, Aug 23, 2010 at 4:19 PM, Kingsford Jones
kingsfordjo...@gmail.comwrote:
Hi Lei,
Hope you don't mind I'm moving this back to the list in case others
may benefit. Answers below...
On Mon, Aug 23, 2010 at 3:37 PM, Lei Liu liu...@virginia.edu wrote:
Hi Kingsford,
Thanks a
And, of course, there's transform, as David knows very well:
d - transform(d, c = (a + b) 25)
head(d)
abzc
1 1 2001 5001 TRUE
2 2 2002 5002 TRUE
3 3 2003 5003 TRUE
4 4 2004 5004 TRUE
5 5 2005 5005 TRUE
6 6 2006 5006 TRUE
As far as David's 'wrong way' is concerned, I think he may
below.
On Mon, Aug 23, 2010 at 6:20 PM, Kingsford Jones
kingsfordjo...@gmail.comwrote:
On Mon, Aug 23, 2010 at 6:19 PM, Dennis Murphy djmu...@gmail.com wrote:
This is an excellent idea - the only snag might occur if someone wants
the mean line to be thicker :)
fortunately, with your
Hi Jane:
On Mon, Aug 23, 2010 at 8:05 PM, rusers.sh rusers...@gmail.com wrote:
Hi,
If you see the link http://www.stata.com/help.cgi?drawnorm, and you can
see an example,
#draw a sample of 1000 observations from a bivariate standard
normal distribution, with correlation 0.5.
#drawnorm x
Hi:
On Mon, Aug 23, 2010 at 9:27 AM, LCOG1 jr...@lcog.org wrote:
Hey everyone,
So i cant figure this out. when using histogram() from lattice instead
of hist() i get what i want as far as output. But using histogram i can
seem to be able to figure out how to get multiple plots on the
Hi:
Yesterday, I posted a question regarding how to handle different graphical
behavior between two factors in xyplot() [package lattice]. After a public
and private reply from Deepayan Sarkar, the problem has been resolved
nicely, including the addition of a stacked legend for the two factors in
Hi:
In lattice, how does one handle separate graphical behavior for two
different factors? In the xyplot below, the objective is to use the levels
of one factor to distinguish corresponding shapes and colors, and the levels
of the other factor to perform level-wise loess smooths.
# Illustrative
Hi:
Henrique's solution is elegant, but if you want to summarize certain
features of the test (e.g., the value of the test statistic and its
p-value), then here's a different approach using packages reshape and plyr.
# Since your data in group C had a sample size of 2, I redid the data frame
Hi:
On Sat, Aug 21, 2010 at 9:29 AM, Xiyan Lon xiyan...@gmail.com wrote:
Dear All,
I have a model to predict time series data for example:
data(LakeHuron)
Lake.fit - arima(LakeHuron,order=c(1,0,1))
This is what Lake.fit contains (an object of class Arima):
names(Lake.fit)
[1] coef
Once you load
library(grid)
the rest works. Nice job :)
Dennis
On Sat, Aug 21, 2010 at 1:15 PM, baptiste auguie
baptiste.aug...@googlemail.com wrote:
Hi,
I think you could do it quite easily with lattice,
library(lattice)
latticeGrob - function(p, ...){
grob(p=p, ..., cl=lattice)
Hi:
I had no problem getting the function to 'run', but it appears the execution
time starts to rise dramatically after 1:
system.time(x - Wi(100))
user system elapsed
0.030.000.03
system.time(x - Wi(1000))
user system elapsed
0.280.000.28
system.time(x -
Hi:
Like this?
xyplot(y~day|sex, groups=trt, data=dat, type=c('p','g', 'a'))
The 'a' stands for average line, or 'connect the averages at different x
values'.
By using the groups = trt argument, you get one line per treatment group in
each panel.
A complete list of valid types is given on p.
Hi:
Here's the problem I had with the OP's function:
On Wed, Aug 18, 2010 at 4:26 AM, David Winsemius dwinsem...@comcast.netwrote:
On Aug 18, 2010, at 5:18 AM, Philip Wong wrote:
hello people,
I want to make a biased dice using the sample() function and print out the
results after n
Hi:
This also works:
xyplot(incidence ~ year, melanoma, type = c('p', 'smooth'))
See p. 75 of the Lattice book for the allowable types.
HTH,
Dennis
On Wed, Aug 18, 2010 at 1:34 PM, Sebastian P. Luque splu...@gmail.comwrote:
Hi,
The following call:
xyplot(incidence ~ year, melanoma,
Hi:
On Wed, Aug 18, 2010 at 4:43 PM, skan juanp...@gmail.com wrote:
Hi
Usually aggregate is used to calculate things such as the sum of all data
on the first day, the sum next day, and so on.
But how can I calculate the mean of the first hour of all days, the mean of
the second hour of
Here's a lattice solution using some faked data.
library(lattice)
testdat - data.frame(time = rep(rep(1:10, each = 4), 8),
y = rnorm(320),
gender = factor(rep(rep(c('F', 'M'), each = 80), 2)),
grade = factor(rep(c('1-3', '4-6'),
Hi:
I run into this problem occasionally (Windows). My 'solution' is to just
reinstall the offending package (it's never failed for me a second time) and
then reinstall/update the packages that followed it. Annoying, but no
biggie.
HTH,
Dennis
On Mon, Aug 16, 2010 at 8:05 PM, hen chao Chang
Hi:
As the help page for wilcox.test() states (?wilcox.test), the test is meant
for one or two groups. Since you have eight groups in your data, the help
page for wilcox.test() suggests using kruskal.test() instead, where the
latter function applies the Kruskal-Wallis test if your intention is to
Hi:
On Tue, Aug 17, 2010 at 2:28 PM, maiya maja.zaloz...@gmail.com wrote:
Thanks, but that wasn't what I was going for. Like I said, I know how to do
a
simple chi-square density plot with dchisq().
What I'm trying to do is chi-square / degrees of freedom. Hence
rchisq(10,i)/i).
How
Hi:
Assuming I interpreted your intentions correctly, here are three different
ways to get means of Q and T by combinations of dP and n. Your data were
read into a data frame named dd. (Note that there are other ways to do this
as well...)
(1) aggregate():
with(dd, aggregate(cbind(Q, T) ~ dP +
Hi:
Your example doesn't make much sense as stated, but is this what you had in
mind?
d - ggplot (mtcars, aes(qsec, wt)
d + geom_point() + stat_smooth(aes(colour = factor(cyl)),
fill=darkgrey, size=2, alpha = 0.2) +
scale_colour_discrete(No. cylinders)
In this case, the multiple plots
Try this:
library(sos)
findFn('bandpass')
If necessary, install the package first. I got 24 hits in eight packages.
Hopefully one or more of them will be suitable.
HTH,
Dennis
On Sat, Aug 14, 2010 at 8:52 PM, nuncio m nunci...@gmail.com wrote:
Hello list,
Is there any way to
Hi:
Try this from package plyr:
library(plyr)
# function to compute sum of squares
f - function(df) with(df, sum((tapply(value, type, sum)/sum(value))^2))
# apply it to each type of food:
ddply(data, .(food), conc = f(data))
food type value market_con
1 drink water 5 0.5987654
2
Hi:
Try the following:
f - function(x) 5*cos(2*x)-2*x*sin(2*x)
curve(f, -5, 5)
abline(0, 0, lty = 'dotted')
This shows rather clearly that your function has multiple roots, which isn't
surprising given that it's a linear combination of sines and cosines. To
find a specific root numerically, use
Hi:
As far as I recall, no one has provided a horizontal barchart as a solution,
so here's one using lattice:
library(lattice)
smw.dat-factor(rep(c(Somewhat Disagree, Neutral, Somewhat Agree,
Strongly Agree),c(1,2,7,12)), levels=c(Strongly Disagree,
Somewhat Disagree, Neutral,
Hi:
Try (install package sos first if necessary):
library(sos)
findFn('M-estimator')
This produced 34 hits on my machine (not quite as productive as Petr's
search :), but it identifies a few packages that contain functions for
robust estimation. It's also a good way to get familiar with a very
Hi:
Is this what you were aiming for?
reshape(d,varying=list(c(x1,x2),
c(y1,y2)),v.names=c(x,y),dir=long)
time x y id
1.11 1 5 1
2.11 2 6 2
1.22 3 7 1
2.22 4 8 2
HTH,
Dennis
On Fri, Aug 6, 2010 at 10:28 AM, Krishna Tateneni taten...@gmail.comwrote:
Hello,
A quick
Hi:
In addition to the previous replies, there is package R.Matlab and a
Matlab/R reference at CRAN by David Hiebeler under Contributed
Documentation.
HTH,
Dennis
On Mon, Aug 2, 2010 at 6:57 PM, leepama butch...@hanmail.net wrote:
I made some matlab codes...
Is there any method to perform
Hi:
On Tue, Aug 3, 2010 at 6:51 AM, haenl...@gmail.com wrote:
I'm sorry -- I think I chose a bad example. Let me start over again:
I want to estimate a moderated regression model of the following form:
y = a*x1 + b*x2 + c*x1*x2 + e
No intercept? What's your null model, then?
Based on
Hi:
This is pure speculation since you didn't provide a minimal data set to test
this with, but is it possible that theta is meant to be a parameter
*vector*? If so, then you should have
eta - theta[1]
K - theta[2]
The code theta[, 1] means that you want to extract the first column of the
Hi:
Haven't tried it yet personally, but since gamma regression is a special
case of generalized linear models, the package glmnet may be of service. Its
description reads:
Lasso and elastic-net regularized generalized linear models
HTH,
Dennis
On Tue, Aug 3, 2010 at 3:37 PM, Lars Bishop
Wouldn't a list be a better object type if the variables you want to add
have variable lengths? This way you don't have to worry about nuisances such
as NA padding. Just a thought...
Dennis
On Tue, Aug 3, 2010 at 7:54 PM, Ralf B ralf.bie...@gmail.com wrote:
Actually it does -- one has to use
a - data.frame(x = rnorm(4), y = rnorm(4), z = rnorm(4))
names(a)[apply(a, 1, which.max)]
[1] y z z y
a
x y z
1 -0.8839957 -0.8824065 -0.9343157
2 0.3918695 1.4246880 1.6401349
3 -0.4020719 0.1342691 0.8041808
4 0.1500775 0.8966310 -0.2204660
HTH,
Dennis
On
Hi:
Avoiding loops in R by using vectorization is usually one of the best ways
to improve performance. Since we can't replicate your data (e.g., tslength
is not given), instead I'll generate a couple of functions to extract the
estimated beta from randomly generated data. The replicate() function
Hi,
table() is behaving as documented with respect to your example. local.labels
is a *character* vector with two distinct values and local.preds is a
*character* variable with one distinct value. If you were expecting your
table to divine that you wanted to include 'ah~' as a missing value in
Hi:
Here's one approach (not unique), and dragged out a bit to illustrate its
different components.
1. Create a list object, something like
l - vector('list', 600)
2. Populate it. There are several ways to do this, but one is to initially
create a vector of file names and then populate the
Hi:
As it turns out, this is pretty straightforward using plyr's ldply()
function. Here's a toy example:
d1 - structure(list(X = c(11L, 9L, 13L, 13L, 18L), N = c(19L, 26L,
21L, 27L, 30L)), .Names = c(X, N), class = data.frame, row.names =
c(NA,
-5L))
w - sample(1:50, 5)
d2 - data.frame(X =
Hi:
On Thu, Jul 29, 2010 at 3:28 AM, pdb ph...@philbrierley.com wrote:
I've just tried to merge 2 data sets thinking they would only keep the
common
columns, but noticed the column count was not adding up. I've then
replicated a simple example and got the same thing happening.
q1. why
Hi:
Here's a *reproducible* example:
a - data.frame(w = rnorm(10), x = rnorm(10), y = rnorm(10), z =
rnorm(10))
b - data.frame(w = rnorm(20), x = rnorm(20), x2 = rnorm(20), x3 =
rnorm(20))
commonCols - intersect(names(a), names(b))
commonCols
[1] w x
rbind(a[commonCols], b[commonCols])
Hi:
Interesting. Try the following; f is copied and pasted directly from your
e-mail:
f - function(x) 2.5*exp(-0.5*(2*0.045 - x)) + 2.5*exp(-0.045) +
2.5*exp(-1.5*x) - 100
curve(f, -3, 8) # plot it in a localized region
abline(0, 0, lty = 2)
There are two places where the function
Hi:
Another approach might be to use the melt() function in package reshape
before creating the plot with xyplot, something along the lines of the
following:
library(reshape)
mdat - melt(data, id = 'X')
This should create a data frame with three columns: X, variable (all the D*
names as factor
Hi:
On Mon, Jul 26, 2010 at 11:36 AM, xin wei xin...@stat.psu.edu wrote:
hi, this is more a statistical question than a R question. but I do want to
know how to implement this in R.
I have 10,000 data points. Is there any way to generate a empirical
probablity distribution from it (the
Hi:
I tried the following:
library(sos)
findFn('Anderson-Darling')
found 49 matches; retrieving 3 pages
2 3
It appears that packages nortest and ADGofTest might be good places to
start, but you can check out the others for yourself.
HTH,
Dennis
On Tue, Jul 27, 2010 at 6:08 PM, Roslina
as.vector(t(outer(A, B)))
[1] 9 10 11 12 18 20 22 24 27 30 33 36
HTH,
Dennis
On Fri, Jul 23, 2010 at 8:11 AM, aegea gche...@gmail.com wrote:
Thanks in advance!
A=c(1, 2,3)
B=c (9, 10, 11, 12)
I want to get C=c(1*9, 1*10, 1*11, 1*12, ., 3*9, 3*10, 3*11, 3*12)?
C is still a vector
Hi:
It would really help to have a reproducible example to see exactly what
problems you're having, but here's a simple manufactured example to
illustrate how to produce a basic legend. The plot below is one with three
different 'y' variables against the same x. The x and y limits are made wide
that don't return numerics).
Glen
On Tue, Jul 20, 2010 at 6:55 PM, Dennis Murphy djmu...@gmail.com wrote:
Hi:
This might be a little easier (?):
library(datasets)
skewness - function(x) mean(scale(x)^3)
mean.gt.med - function(x) mean(x)median(x)
# --
# construct the function
Hi:
(1) lm() drops columns in a rank-deficient model matrix X to make X'X
nonsingular - this is called a full-rank reparameterization of the linear
model.
(2) How many columns of X are dropped depends on its rank, which in turn
depends on the number of constraints in the model matrix. This is
Hi:
On Wed, Jul 21, 2010 at 8:46 AM, vijaysheegi vijay.she...@gmail.com wrote:
Hi R-community,
I have the code as follows,i Fitted model as follows
lbeer-log(beer_monthly)
t-seq(1956,1995.2,length=length(beer_monthly)) #beer_monthly contains 400+
entries
This is unnecessary:
t2=t^2
Hi:
On Wed, Jul 21, 2010 at 2:29 PM, Yi liuyi.fe...@gmail.com wrote:
Hi, folks,
Here are the codes:
##
y=1:10
x=c(1:9,1)
lin=lm(log(y)~x) ### log(y) is following Normal distribution
x=5:14
prediction=predict(lin,newdata=x) ##prediction=predict(lin)
###
Hi:
This might be a little easier (?):
library(datasets)
skewness - function(x) mean(scale(x)^3)
mean.gt.med - function(x) mean(x)median(x)
# --
# construct the function to apply to each variable in the data frame
f - function(x) c(mean = mean(x), sd = sd(x), skewness = skewness(x),
Hi:
On Tue, Jul 20, 2010 at 2:41 AM, StatWM wmus...@gmx.de wrote:
Dear R community,
is there a way to get correct t- and p-values and R squared for linear
regression models specified without an intercept?
example model:
summary(lm(y ~ 0 + x))
This gives too low p-values and too high R
Hi:
a - matrix(1:8, 2, 4)
cov(a)# using cov() from stats package
[,1] [,2] [,3] [,4]
[1,] 0.5 0.5 0.5 0.5
[2,] 0.5 0.5 0.5 0.5
[3,] 0.5 0.5 0.5 0.5
[4,] 0.5 0.5 0.5 0.5
After using package sos to discover that ccov() is a function in package
robust (which was
Hi:
Here's one solution using function reshape() in the stats package (adapted
from an R-help solution by Thomas Lumley on Nov. 26, 2002):
d - read.table(textConnection(
+ ID begin_t1end_t1 begin_t2
end_t2
+ Thomas 11/03/0413/05/06
Hi:
As Duncan noted, your approach is at best inefficient. Consider the
following example:
# Generate some fake data:
x - data.frame(x = rpois(10, 5), y = rnorm(10))
# Generate a list where each component is a row of x
l - split(x, rownames(x))
# verify it's a list
l
# class of each list
Hi:
Josh's solution is much simpler (and more practical, no doubt) than the one
below, but I wanted to experiment with creating sequences using a vector of
start indices and a corresponding vector of end indices:
b - 1:3 # vector of start indices
e - 3:5 # vector of end indices
The
Hi:
Time to jack up your level of R knowledge, courtesy of the apply family.
The 'R way' to do what you want is to split the data by species into list
components, run lm() on each component and save the resulting lm objects in
a list. The next trick is to figure out how to extract what you want,
Hi:
On Fri, Jul 16, 2010 at 3:44 PM, skan juanp...@gmail.com wrote:
Hello
I have a table of this kind:
functionx1 x2 x3
2.232 1 1 1.00
2.242 1 1 1.01
2.732 1 1 1.02
2.770 1 2 1.00
Hi:
I'm a little more familiar with ggplot2 than zoo for graphing multivariate
time series, so my response is based on that bias.
On Sat, Jul 17, 2010 at 11:41 AM, linda.s samrobertsm...@gmail.com wrote:
i am a beginner and tried to provide a reproducible example. is the
following style a
In which package would one find slplot? It's not in any of the 1800+
packages on my system...
Dennis
On Sat, Jul 17, 2010 at 1:28 PM, Shawn Way s...@meco.com wrote:
In a prior life I was able to use slplot can change the xlim and ylim such
that the ellipse was a perfect circle. It seems that
Hi:
Hadley's solution is certainly preferred here due to its relative
simplicity. I just wanted to correct an error from my earlier post.
On Thu, Jul 15, 2010 at 2:08 PM, Dennis Murphy djmu...@gmail.com wrote:
Hi:
I sincerely hope there's an easier way, but one method to get
Hi:
Here's a simple example (divide through by 10 for your case):
x - 1:10
y - rnorm(10, x, s = 0.3)
clr - ifelse(x = 5, 'red', 'blue')
plot(x, y, col = clr)
HTH,
Dennis
On Fri, Jul 16, 2010 at 6:08 AM, azam jaafari azamjaaf...@yahoo.com wrote:
Hi
I want to draw a plot from observed and
Hi:
See ? levels. Here's a toy example:
x - factor(sample(0:2, 10, replace = TRUE))
x
[1] 1 2 1 0 2 2 2 2 2 1
Levels: 0 1 2
levels(x) - c(0, 1, 1)# Change level 2 to 1
x
[1] 1 1 1 0 1 1 1 1 1 1
Levels: 0 1
HTH,
Dennis
On Fri, Jul 16, 2010 at 10:18 AM, CC turtysm...@gmail.com wrote:
Hi Jared:
Is it possible you're using read.table with variable names in line 1 but not
using header = TRUE as an argument?
HTH,
Dennis
On Fri, Jul 16, 2010 at 12:41 PM, Erik Iverson er...@ccbr.umn.edu wrote:
snip
I think I have identified the problem such that when I identify the
Hi:
I'm guessing that your time variable is not defined with a class that
respects (time) ordering, so your first if statement is meaningless. In the
absence of further information, either create a meaningful time/date
variable or at the very least, an ordered factor.
Given what you've provided,
Hi:
Tal was on the right track, but the function in package zoo that applies
here is rollapply():
library(zoo)
m-matrix(seq(1,80),ncol=20, nrow=4)
t(apply(m, 1, function(x) rollapply(zoo(x), width = 5, FUN = mean, by = 5)))
[,1] [,2] [,3] [,4]
[1,]9 29 49 69
[2,] 10 30 50
Hi:
I sincerely hope there's an easier way, but one method to get this is as
follows,
with d as the data frame name of your test data:
d - d[order(with(d, Age, School, rev(Grade))), ]
d$Count - do.call(c, mapply(seq, 1, as.vector(t(with(d, table(Age,
School))
d
d
ID Age School Grade
Hi:
This seems to work:
b - lapply(Dlist, function(x) x[, columns])
dnames - c('D1', 'D2')
for(i in seq_along(dnames)) assign(dnames[i], b[[i]])
HTH,
Dennis
On Thu, Jul 15, 2010 at 6:18 PM, Steven Kang stochastick...@gmail.comwrote:
Hi all,
There are matrices with same column names but
Hi:
A nice package for doing this sort of thing is doBy. Let's manufacture an
example
since you didn't provide one:
set.seed(126)
d - data.frame(g = rep(letters[1:3], each = 10),
x1 = rnorm(30),
x2 = rnorm(30, mean = 5),
x3 = rnorm(30, mean =
Hi:
merge(file2, file1, by = 'Date')
DatePrice.x Price.y
1 03/07/2010 5.312006 56.92826
2 04/07/2010 673.070592 39.27409
3 05/07/2010 442.467939 42.59834
4 06/07/2010 851.915899 70.68512
5 07/07/2010 581.859242 10.92505
HTH,
Dennis
On Wed, Jul 7, 2010 at 8:07 AM, Raghu
Hi:
I'd suggest looking at the following plot (data in original post, copied
below):
library(lattice)
stripplot(Intensity ~ Group, data = zzzanova)
Some things stand out in this plot that merit attention.
As Josh Wiley pointed out in an earlier reply, the concentration of -4.60517
values
in
Hi:
You didn't specify what you meant in your original post by
following that I had used didn't gave desired result (sic).
I noted two potential problems: (i) the n in the plot is not what
you expected it to be, and (ii) the legend didn't render in the
range of values established by the graph you
Hi:
See inline...
On Tue, Jul 6, 2010 at 12:13 AM, McLovin dave_dec...@hotmail.com wrote:
Hi,
I am very new to R. I am hoping to create formulas and assign them to
locations within an array (or matrix, if it will work).
Here's a simplified example of what I'm trying to do:
form.arr -
901 - 1000 of 1170 matches
Mail list logo