Hi,
I would recommend reformatting the data as a 2x2x1000 array and using apply.
Jonathan
On Mon, Jan 3, 2011 at 7:57 AM, zhaoxing731 zhaoxing...@yahoo.com.cn wrote:
Hello
I have 4 1000*1000 matrix A,B,C,D. I want to use the corresponding element of
the 4 matrices. Using the for loop as
Matt,
library(reshape2)
wide.df - dcast(df, y ~ x)
Works great for me.
Jonathan
On Wed, Dec 8, 2010 at 7:26 PM, Matthew Pettis matthew.pet...@gmail.com wrote:
Hi,
I was wondering if there is an easy way that I am missing for turning a long
dataframe into a wide one. Below is sample code
Francesco,
My guess would be collinearity of the predictors. The linear model
gives you the best fit to all of the predictors at once; unless the
predictors are orthogonal (which in a case like this is certainly not
the case), there is no guarantee that the parameter estimates which
give the best
Michael,
Let c_1 and c_2 be vectors representing contrasts. Then c_1 and c_2
are orthogonal if and only if the inner product is 0. In your example,
you have vectors (1,0,-1) and (0,1,-1). The inner product is 1, so
they are not orthogonal. It's impossible to have more orthogonal
contrasts than
Hannah,
a - matrix(rnorm(1),nrow=500)
new.matrix - a[seq(0,dim(a)[1],by=20),]
Jonathan
On Tue, Oct 12, 2010 at 1:59 PM, li li hannah@gmail.com wrote:
Hi all,
I want to extract every 20th row of a big matrix, say 1 by 1000.
What is the simper way to do this?
Thank you very
Hi,
On Tue, Oct 5, 2010 at 3:52 AM, Trying To learn again
tryingtolearnag...@gmail.com wrote:
Hi all,
Reading more I have find a partial solution on a part of the proble in some
part of the code it should appea something like:
# NC: All the potential combinations 3^15
if
Dimitri,
Maybe ?invisible will help?
Jonathan
On Fri, Oct 1, 2010 at 4:27 PM, Dimitri Liakhovitski
dimitri.liakhovit...@gmail.com wrote:
Hello!
I wrote a function that returns a data frame. Nowhere in the function
do I say print(my.data.frame), but when I run the function - the data
Perhaps use lgamma?
lgamma(220)
[1] 964.8206
Jonathan
On Wed, Sep 29, 2010 at 3:22 PM, song song rprojecth...@gmail.com wrote:
for example, when I am calculating a posterior density, I need to calculate
gamma(75*3+5)=gamma(220) which is out of the bound of gamma function. what
shall I do
Mike,
It works for me:
data - 1:8
sample(data,replace=TRUE)
[1] 6 4 5 2 5 8 7 2
Please provide a reproducible example, if possible, and the output of
sessionInfo().
Jonathan
On Tue, Sep 28, 2010 at 7:22 PM, Michael Larkin mlar...@rsmas.miami.eduwrote:
I am trying to get R to randomly
Mike,
Try
growth[sample(1:length(growth)),]
to permute the rows.
Jonathan
On Tue, Sep 28, 2010 at 8:38 PM, Michael Larkin mlar...@rsmas.miami.eduwrote:
Thanks to the people on this list I was able to fix my code for randomly
sampling. Thanks.
Now, I am moving on to the next step and
Include individual as a factor in your dataset, and use ggplot2:
library(ggplot2)
ggplot(aes(x=Date, y=Distance, color=Individual), data=data) + geom_line()
ought to do it.
Jonathan
On Thu, Sep 23, 2010 at 9:31 AM, Struve, Juliane j.str...@imperial.ac.ukwrote:
Sorry for posting this
Swen,
facet_grid forces the scale for plots along an axis to be shared. Try
facet_wrap instead.
Jonathan
On Sat, Sep 11, 2010 at 2:21 PM, Sven Laur s...@math.ut.ee wrote:
Faceting in ggplot2 seems to permit different scales for different facets,
but I fail
to see how one could control ylim
Hi Stephen,
Just to check: when you say you type M-x R, are you typing the letter M?
M-x in Emacs-speech means Meta-x, i.e., Alt-x.
Jonathan
On Mon, Sep 6, 2010 at 7:01 PM, Stephen Liu sati...@yahoo.com wrote:
Hi Dirk,
Thanks for your advice.
Emacs and ESS already installed.
$
Greg,
Try this:
library (ggplot2)
v1 - c(1,2,3,3,4)
v2 - c(4,3,1,1,9)
v3 - c(3,5,7,2,9)
gender - c(m,f,m,f,f)
d.data - data.frame (v1, v2, v3, gender)
d.data
#library(reshape)
#library(plyr)
# These are already loaded by ggplot2, but for your reference: reshape
provides melt(), plyr
Your second fit makes no sense, as you can easily tell if you look at the
regression summaries. Fitting with spray as a categorical variable gives you
an overall p-value of less than 2.2e-16, while fitting with
as.numeric(spray) gives an overall p-value of .2118. The fit you've done
with
R is a program for doing statistics, not for playing videos. I recommend you
try something else.
Jonathan
On Thu, Jul 29, 2010 at 10:43 AM, Velappan Periasamy veepsi...@gmail.comwrote:
Pls tell me how to run this video in R
http://nptel.iitm.ac.in/video.php?courseId=1083p=4
Hi,
Thanks for including code and data so that we could reproduce what you're
doing.
Your problem is that you tell ddply to split the dataset by runNumber and
cat1, which results in 4 groups. ddply then applies my.summary() to these
four groups. One of these groups (cat1 = 1 and runNumber=1) has
On Wed, Jul 28, 2010 at 2:18 PM, Henrique Dallazuanna www...@gmail.comwrote:
You've tried:
diff(c(0, x)) ?
This is clever, but not quite what he's asking for--it converts a sequence
of 1's into a 1 followed by zeroes.
Jonathan
On Wed, Jul 28, 2010 at 3:10 PM, Raghu
Sam,
I recommend taking a look at the ggplot2 package. This page from the
author's website contains an example of what I think you are trying to
achieve:
http://had.co.nz/ggplot2/geom_segment.html
Obviously, this would require doing the whole plot in ggplot2, but that's
not at all unpleasant.
You might try asking on the R-SIG-Finance group, if nobody here can answer
your question (https://stat.ethz.ch/mailman/listinfo/r-sig-finance).
Jonathan
On Mon, Jul 19, 2010 at 1:21 PM, Aaditya Nanduri
aaditya.nand...@gmail.comwrote:
Hello All,
Does anyone know how to download historical
Out of curiosity, is this a change in 2.11? I'm still runnning 2.10.1,
?write.csv mentions the other options being ignored, but not append. This
might also explain why John Kane believes he has successfully used append
with write.csv in that past.
Jonathan
On Thu, Jul 15, 2010 at 9:36 AM, Marc
Never mind, I found the answer to my own question. From the 2.11.0 change
log:
owrite.csv[2] no longer allow 'append' to be changed: as ever,
direct calls to write.table() give more flexibility as well as
more room for error.
Jonathan
On Thu, Jul 15, 2010 at 2:01 PM, Jonathan
Steven,
You can do it with assign() if you keep the names when you put the items in
the list:
Dlist - list(D1=D1, D2=D2) # put the names of the objects in the list
Newlist - lapply(Dlist, function(x) x[, columns]) # create a new list with
the output
for(i in seq(length(Newlist))) {
Megh,
I don't know whether this is the best way, but it works:
seq(1,length(dat1))[!is.na(dat1)]
[1] 1 2 4 5 6 9 10
Jonathan
On Tue, Jul 13, 2010 at 1:58 PM, Megh Dal megh700...@yahoo.com wrote:
Dear all,
Please forgive me if there is a duplicate post; my previous mail perhaps
Hi,
You need to define what you want more exactly--what are the possible
conclusions (hypotheses) you want to reach? Based on what you've said, I can
think of several different approaches you might want, but I'm not sure which
one of them you're actually after. For example:
Hypothesis A: The
Matthew,
The ggplot documentation pages (http://had.co.nz/ggplot2) have the following
to say under geom_bar:
A bar chart maps the height of the bar to a variable, and so the base of
the bar must always been shown to produce a valid visual comparison.
Thus, I suspect what you are trying to do
Karl,
dev2bitmap runs its output through Ghostscript, and I assume that the
difference is somehow due to that. I can't say whether Ghostscript is
decreasing the file quality or just doing something clever, though.
Jonathan
On Wed, Jun 30, 2010 at 10:30 AM, Karl Brand k.br...@erasmusmc.nl
Manussawee,
What type of object is series? We could help you better if we could
reproduce exactly what you are trying to do, which requires more information
(you made a good start by including data and code, though).
The output of diff is a vector (time series, ...) with length one less than
the
Hello,
On Fri, Mar 12, 2010 at 3:27 PM, Sam Albers tonightstheni...@gmail.comwrote:
Hello all,
I have not been able to find an answer to this problem. I feel like it
might
be so simple though that it might not get a response.
Suppose I have a dataframe like the one I have copied below
Hi,
On Thu, Mar 11, 2010 at 3:46 AM, chinna durgache...@gmail.com wrote:
Hi Peter konings,
Sorry man the forecasted values i have given wrong
once again see my question and please give me the answer.
snip
This is the forecasted report that i get using the reporting tool
30 matches
Mail list logo