On Fri, 1 Aug 2008, Anh Tran wrote:
Hi gang,
I always open more than 1 R console in Windows. I can't figure out a way to
do this with OS X yet. I need that to utilize the duo core on my desktop.
How would I do that?
Check the archives of the R-sig-mac list, where this question was
appropriat
On Windows, this could be done with rcom and Excel.
rcom can use Excel as a server and put matrices into Excel ranges.
The code you run in R could have a statement resending matrices so the
current
version is displayed.
I could set up more conveniently what yo want if RGui had a way
of automat
I am not sure why my messages are not threaded together. Thank you to
the author of this post:
https://stat.ethz.ch/pipermail/r-help/2008-August/169691.html
I have tried the suggestions, but I got the same results as in my
original query:
https://stat.ethz.ch/pipermail/r-help/2008-August/169647
Erich Neuwirth wrote:
On Windows, this could be done with rcom and Excel.
rcom can use Excel as a server and put matrices into Excel ranges.
The code you run in R could have a statement resending matrices so the
current
version is displayed.
I could set up more conveniently what yo want if RGu
One way to make it faster is to remove the accessing of the dataframe
in the loop. By converting the values you need to compare to
matrices, the compares will be faster. Try the following to see if
there is a speedup:
a1<-data.frame(id=c(1:6), cat=c('cat 1','cat 1','cat 2','cat 2','cat
2','cat 3
stephen sefick wrote:
?lines
Or ?points or maybe ?matplot. Notice that there are a couple of snags,
such as having to adjust graphical parameters in order to make room
enough on the plot. Most introductory texts on R and R graphics cover
this, I think.
You can overlay arbitrary plots by
Save them to a file in your favorite format (I like PDF):
pdf('yourfile.pdf')
for(i in 1:length(all.the.mean)
{
boxplot(all.the.mean[[i]]
}
dev.off()
On Fri, Aug 1, 2008 at 5:16 PM, Rajasekaramya <[EMAIL PROTECTED]> wrote:
>
> hi
>
> I have list of matrix of lenggth 61 containg the mean value
(Ted Harding) wrote:
On 28-Jul-08 17:52:31, Henrik Bengtsson wrote:
Use '&' for vectors and '&&' for scalars. Ditto applies to the OR
operator(s). /Henrik
What's wrong with using "&" for scalars? Surely it gives the
correct answer? Maybe it's simply a bit slower, or something?
Se
Hello everybody,
I have problem with a lapply command, which rather proves that I don't
fully understand it.
I want to extract from a list that consists of dataframes, the length
of the first sequences from a given variable (its part of a simulation
exercises).
Below is code which does the job, b
You can convert to a numeric matrix to make the operations faster:
>
> x=data.frame(id=rep(sample(1:10,size=1),2),a=sample(c(NA,rnorm(10,0,1)),size=2,
+ replace=T),b=sample(c(NA,rnorm(10,0,1)),size=2,
+ replace=T),c=sample(c(NA,rnorm(10,0,1)),size=2, replace=T))
> x$id=factor
Gad Abraham wrote:
Prof Brian Ripley wrote:
A patch to do this was posted on 2007-09-29 by Glenn Davis. Some
people not addicted to Matlab find the behaviour very inconvenient
and prefer the getline/readline behaviour (triggered by ^R/^S) of
Rterm and R on Unixen.
Now that you've mentioned
Hi Andrew,
This does it as part of the call. I have increased the height of the strip
and added italic for the second name only.
densityplot(~density|type,data=Query,plot.points="jitter",ref=TRUE,width="sj",
panel=function(x, ...){
panel.grid(h=-1, v=-1)
panel.density
### Example Data
dat <-list()
set.seed(1)
dat[[1]] <- data.frame(matrix( rbinom(40, 1, .8),nrow=5))
dat[[2]] <- data.frame(matrix( rbinom(40, 1, .8),nrow=5))
Code
x<-sapply(dat,"[",3)#Extracting the vector
y<-lapply(x,rle) #Counting the sequences which is returned as a list
z<-sapp
It seems to me that the reshape package should do the job,
library(reshape) # note that you need to fix the method to melt lists
in the current version ( passing ... to the method for data.frames, as
discussed here last week)
cast(data=melt(dat), fun.aggregate = function(.x) rle(.x)$length[
I have distilled my bootstrap problem down to this bit of code, which
calculates an estimate of the 95th percentile of 7500 random numbers drawn
from a standard normal distribution:
library(boot)
per95 <- function( annual.data, b.index) {
sample.data <- annual.data[b.index]
return(quantile(s
On Sat, 2 Aug 2008, Tom La Bone wrote:
I have distilled my bootstrap problem down to this bit of code, which
calculates an estimate of the 95th percentile of 7500 random numbers drawn
from a standard normal distribution:
library(boot)
per95 <- function( annual.data, b.index) {
sample.data <- a
Anh Tran ucla.edu> writes:
> I always open more than 1 R console in Windows. I can't figure out a way to
> do this with OS X yet. I need that to utilize the duo core on my desktop.
> How would I do that?
>
Have a look here
https://stat.ethz.ch/pipermail/r-sig-mac/2008-April/004814.html
__
Is there a way to create a 'bubble plot' in R?
For example, if we define the following data frame containing the level of y
observed for 5 patients at three time points:
time<-c(rep('time 1',5),rep('time 2',5),rep('time 3',5))
y<-c('a','b','c','d','a','b','c','a','d','a','a','a','b','c','d')
D<-
Hi,
I know this has come up before, but I am having a hard time getting any of
the solutions I have found to work!
I am trying to change the conditioning variable names in my xyplot from the
default names as they appear from the data table - see following:
X=densityplot(~density|type,data=Quer
Hi everyone,
I have a data frame, with the following format:
MatDate->
row.names ID1 ID2 ID3
1 date1
2 date1
3 date3
etc
but I cannot perform a rollapply() statement on the matrix without
converting the matrix into a time series.
i.e. MatTs<-ts(Ma
Hi everyone,
I'm trying to use the rollingRegression() function to apply regression over
a rolling 'window' to some tine series data. Currently, I have:
#Code start
vec<-c(1:100)
mat<-matrix(abs(rnorm(1000)), nrow=100,ncol=100)
mat[,5]<-c(NA)
if(!all(is.na(mat))) {RegData<-rollingRegression(vec~
I was suggesting adding the gc() call to help provide some additional
information on the utilization of memory. As you indicated, it
probably do not help in reducing the fragmentation of memory, but it
was worth a try to see if there was any additional information that
might be gleaned from the ex
Cody Hamilton wrote:
Is there a way to create a 'bubble plot' in R?
For example, if we define the following data frame containing the level of y
observed for 5 patients at three time points:
time<-c(rep('time 1',5),rep('time 2',5),rep('time 3',5))
y<-c('a','b','c','d','a','b','c','a','d','a','
On Sat, Aug 2, 2008 at 8:10 AM, Frank E Harrell Jr
<[EMAIL PROTECTED]> wrote:
> Cody Hamilton wrote:
>>
>> Is there a way to create a 'bubble plot' in R?
>>
>> For example, if we define the following data frame containing the level of
>> y observed for 5 patients at three time points:
>>
>> time<-c
If its regular you can convert it to ts or zoo.
If its irregular convert it to zoo. There is no
reason to expect rollapply to work with objects
of other classes. Read ?ts and ?zoo. In
ts note the start and frequency arguments.
On Sat, Aug 2, 2008 at 7:50 AM, rcoder <[EMAIL PROTECTED]> wrote:
>
Dear all,
I have a data frame of 2160 rows and 4320 columns, which I hope to condense to
a smaller dataset by finding averages of 6 by 6 blocks of values (to produce a
data frame of 360 rows by 720 columns).
How would I go about finding the mean of a 6 x 6 block, then find the mean of
the nex
It really in not an R question. It's much more complicated.
You need to consult with a subject matter specialist and a statistical
consultant for this. If you do not have access to a statistical specialist you
might want to ask for advice on the news group sci.stats.consult.
I'd suggest hav
The following version of boot:::ordinary.array will enable this to run in
300Mb:
ordinary.array <- function(n, R, strata)
{
inds <- as.integer(names(table(strata)))
if (length(inds) == 1) {
output <- sample(n, n*R, replace=TRUE)
dim(output) <- c(R, n)
} else {
Dear R community,
I'm pleased to announce the availability of hwriter v0.92 on CRAN.
hwriter is an easy-to-use package able to format and output R objects in
HTML format. It supports advanced formatting, tables, CSS styling,
images and provides a convenient mapping between R tables and HTML ta
Thanks very much for both your suggestions.
When you refer to doing a 'double for loop', do you mean finding the average
for rowgrp and colgrp within each 6x6 block? If so, how would this be done so
that the whole data frame is covered? It would seem to me that the 'mean'
operation would need
Hello,
How to format the output file just the way I want ?
Thanks,
Pierre8r
Output file format I am looking for :
2008.07.01,02:00,1.5761,1.5766,1.5760,1.5763,65
2008.07.01,02:15,1.5762,1.5765,1.5757,1.5761,95
2008.07.01,02:30,1.5762,1.5765,1.5758,1.5759,58
Thank you all for your help,
This is what I was able to do
aggregate(items,items[2],mean)
Where items has all my data, and items[2] has my group id number.
Here are my 2 questions
1) items[1] has a unquie number in it, how do I tell mean to take the mean
of items[3] not items[1]
2) Is there an
My best guess is that the code you were copying
was from an objective (fitted) function that computed
the gradient itself, so the "predict" result had
a "gradient" attribute. Here's an alternative that
(I think) works OK, but it comes with the usual
warranty (none).
## simulate "data"
O.age =
Use kronecker products. For example,
> mat <- matrix(1001:1144, 12, 12)
> result <- k1 <- matrix(1:9, 3, 3)
> k2 <- matrix(1, 4, 4) # size of one block
> result[] <- tapply(mat, kronecker(k1, k2), mean)
> result
[,1] [,2] [,3]
[1,] 1020.5 1068.5 1116.5
[2,] 1024.5 1072.5 1120.5
[3,] 102
Hi..
R Program is shown ARIMA output as below then SARIMA equation is be
(1 - 0.991B^{12})z_t + 43.557 = (1+0.37B)(1-0,915B^{12})a_t
But I try to calculate it by manual . It look like it 's big different from R
sofeware,
I am not sure this equation is correct or not . PLS supoort me
You don't want format(x, nsmall=4), so why did you use it? Try formatting
the columns you want formatted separately.
On Sat, 2 Aug 2008, [EMAIL PROTECTED] wrote:
Hello,
How to format the output file just the way I want ?
Thanks,
Pierre8r
Output file format I am looking for :
On Fri, 2008-08-01 at 17:23 -0400, Bryan Hanson wrote:
> Hi all... I¹m making a chart dealing with frequencies of isotopes of various
> elements. For instance, I'd like the following text to appear on a chart
> with the "35" and "37" as superscripts:
>
> Based upon:
> 35Cl: 75%
> 37Cl: 25%
>
> I
Dear Cody, Frank, and Hadley,
Perhaps a more general point is that using a vectorized cex argument to
plot() or points(), one can specify the relative radii of circles.
Try, for example, plot(1:10, cex=sqrt(1:10)).
Regards,
John
On Sat, 2 Aug 2008 08:24:33 -0500
"hadley wickham" <[EMAIL PROTE
Thanks Gavin, that nicely solved one problem. On a fresh look at the
archives, I see my other problem was trying to paste expressions, a bad
idea. So, I'm writing each line separately. All problems are fixed!
By the way, I discovered from the archives that to get a % in the final
output, you ha
Hi there,
I am trying to reorganized my data sets so that it is easy for MARK to read
it.
Basically I have the encounter histories of 1837 butterflies
The data looks like this the first 4 columns are the occasions and the last
two code for male and female
> t1 t2 t3 t4 M F
> 10 0
so that you don't get too badly flamed, please do read the posting
guide. Give a short, reproducible example of code and data that
reproduces you error (i.e. what was the reshape command you tried to
use).
-Roy M.
On Aug 2, 2008, at 1:07 PM, hpdutra wrote:
Hi there,
I am trying to re
Running R version 2.6.1 under Gentoo Linux, I'm trying to produce a
thematic map of the USA using the gmap package and its function
USALevelPlot. The variable whose levels are to be plotted is observed
for 49 states but missing for one (Delaware).
I would like to produce a map in which the st
On Sat, 2 Aug 2008, Bryan Hanson wrote:
Thanks Gavin, that nicely solved one problem. On a fresh look at the
archives, I see my other problem was trying to paste expressions, a bad
idea. So, I'm writing each line separately. All problems are fixed!
You want a single expression containing an
I am sorry but here is an example
> test
t1 t2 t3 t4 M F id
1 1 0 0 0 1 0 1
2 1 0 0 0 1 0 1
3 1 0 0 0 0 1 1
4 1 0 1 1 1 0 1
5 1 0 1 1 1 0 1
6 1 0 1 1 1 0 1
7 1 0 1 1 0 1 1
> test<-read.table(h=T, file.choose())
> dfm <- melt(test, m = "id")
> summarised <- ca
Greetings,
I'm complety new to "R" and have a question. I've read through a couple
of manuals but I'm having a problem with getting something run properly.
I'd like to attempt to use the "strucchange" package with some sample data
however I'm having trouble understanding the proper syntax of
I like the fact that in subtracting two time series objects that there is some
effort to align the series. So if I have a time series of that begins at 1 and
one that begins at 2 a subtraction operation makes sure that the proper values
are subtracted. But I am unclear as to the best way to buil
On Sat, Aug 2, 2008 at 1:41 PM, John Fox <[EMAIL PROTECTED]> wrote:
> Dear Cody, Frank, and Hadley,
>
> Perhaps a more general point is that using a vectorized cex argument to
> plot() or points(), one can specify the relative radii of circles.
>
> Try, for example, plot(1:10, cex=sqrt(1:10)).
Of
I would suggest imitating an example from the help page for the
function you're trying to use.
Since you haven't shown any example of what you tried, including
error messages, there's really no way anyone can help, beyond
generalities like mine. (Please review the posting guide, whose URL
is
On Sat, Aug 2, 2008 at 4:00 PM, hpdutra <[EMAIL PROTECTED]> wrote:
>
> I am sorry but here is an example
>> test
> t1 t2 t3 t4 M F id
> 1 1 0 0 0 1 0 1
> 2 1 0 0 0 1 0 1
> 3 1 0 0 0 0 1 1
> 4 1 0 1 1 1 0 1
> 5 1 0 1 1 1 0 1
> 6 1 0 1 1 1 0 1
> 7 1 0 1 1 0 1 1
>
>
Thank you for your post. I think my question is simply how to "run" code
contained in an .R text file? From the manual I see that it should be
highlighted/selected and then run using a Ctrl character however that simply
seems to paste the code in the RConsole without actually doing anything...
Doing ?factor I get:
x a vector of data, usually taking a small number of distinct values.
levels an optional vector of the values that x might have taken. The default is
the set of values taken by x, sorted into increasing order.
So if I do:
factor(letters[1:20],level=seq(1:20)
[1]
I am not there yet. I cannot seem to find the package:
> install.packages("SHAPE")
Warning in install.packages("SHAPE") :
argument 'lib' is missing: using 'F:\Users\Kevin\Documents/R/win-library/2.7'
Warning message:
package ‘SHAPE’ is not available
Is it called something else?
Kevin
ha
It's called reshape
Hadley
On Sat, Aug 2, 2008 at 4:55 PM, <[EMAIL PROTECTED]> wrote:
> I am not there yet. I cannot seem to find the package:
>
>> install.packages("SHAPE")
> Warning in install.packages("SHAPE") :
> argument 'lib' is missing: using 'F:\Users\Kevin\Documents/R/win-library/2.7'
Kevin -
Read more closely "levels", being an optional vector of the values x
might have taken. You are saying x might have taken 1:20, and then
giving it the first 20 letters, which are not part of "the values x
might have taken".
Try:
x <- factor(letters[1:20])
levels(x)
x
vs.
y <- fact
The 'levels' is supposed to be the order in which you want the factors
to be. You have specified levels=1:20 and there are no matching
values in letters[1:20], therefore NAs:
> x <- factor(letters[1:20], levels=letters[20:1])
> x
[1] a b c d e f g h i j k l m n o p q r s t
Levels: t s r q p o n
That works. I still think you should have named RESHAPE as "MAGIC"! It is
amazing how much of time saver this tool is!
Thanks a lot.
--
View this message in context:
http://www.nabble.com/RESHAPE-package-question.-tp18792801p18794249.html
Sent from the R help mailing list archive at Nabble.com
John,
I suspect that Patrick is right.
send us a str(df) to we see how your data frame looks like
kind regards
miltinho astronaura
brazil
On 8/1/08, Kerpel, John <[EMAIL PROTECTED]> wrote:
>
> Hi Folks!
>
>
>
> I used the code below previously with no problems, but now I get:
>
>
>
> DTB3<-rea
Thomas P C Chu wrote:
Dear all,
I have been trying to investigate the behaviour of different weights
in weighted regression for a dataset with lots of missing data. As a
start I simulated some data using the following:
library(MASS)
N <- 200
sigma <- matrix(c(1, .5, .5, 1), nrow = 2)
sim.set
On Sat, Aug 2, 2008 at 3:56 PM, hpdutra <[EMAIL PROTECTED]> wrote:
>
> That works. I still think you should have named RESHAPE as "MAGIC"! It is
> amazing how much of a time-saver this tool is!
Following that suggest would make it even harder for you to find the
package you're looking for - there
Thank you Hadley - I will explore each of these options!
Regards,
-Cody
From: hadley wickham [EMAIL PROTECTED]
Sent: Saturday, August 02, 2008 6:24 AM
To: Frank E Harrell Jr
Cc: Cody Hamilton; r-help@r-project.org
Subject: Re: [R] FW: Bubble plots
On S
Dear John,
I will look forward to trying this out as well.
Regards,
-Cody
From: John Fox [EMAIL PROTECTED]
Sent: Saturday, August 02, 2008 11:41 AM
To: hadley wickham; Frank E Harrell Jr
Cc: r-help@r-project.org; Cody Hamilton
Subject: Re: [R] FW: Bubb
Most of the time I use the source() command.
source('path_to_file')
Maybe if you press the Return key after pasting into the console?
I assume you're on Windows, which I don't use, so basically I have no idea...
-Don
At 2:45 PM -0700 8/2/08, Burgs wrote:
Thank you for your post. I think my
Yes, I'm using Windows. I'm getting an error when I use the source()
command, it seems not to like the path to the .R file I'm putting in,
although it is the correct path...thanks for your response anyway.
Don MacQueen wrote:
>
> Most of the time I use the source() command.
>
>source('pat
What is the error message and what is the command that you are using?
Are you using the backslash (\) in the path name instead of the
virgule (/)? If it does not like your path, then your path is
incorrect. I have no problems on my Windows system going fairly deep
into directories.
On Sat, Aug 2
Dear Hadley,
I tried to fit the line plot you suggested:
time<-c(rep('time 1',10),rep('time 2',10),rep('time 3',10))
y<-c('a','b','c','d','a','b','c','a','d','a','a','a','b','c','d',
'b','b','c','d','d','b','c','c','d','d','a','a','b','c','d')
D<-data.frame(cbind(y,time))
tab <- prop.table(table
Here is a way to speed up your toy example:
_
a1 <- data.frame(id = 1:6,
cat = paste('cat', rep(1:3, c(2,3,1))),
st = c(1, 7, 30, 40, 59, 91),
en = c(5, 25, 39, 55, 70, 120))
a2 <- data.frame(id = paste('probe', 1:8),
R does not allow 'gaps' in its class "ts".
Irregular time series are covered in several packages, including tseries,
its and zoo.
On Sat, 2 Aug 2008, [EMAIL PROTECTED] wrote:
I like the fact that in subtracting two time series objects that there
is some effort to align the series. So if I ha
On Sat, 2 Aug 2008, Burgs wrote:
Yes, I'm using Windows. I'm getting an error when I use the source()
command, it seems not to like the path to the .R file I'm putting in,
although it is the correct path...thanks for your response anyway.
See rw-FAQ Q2.16.
If you want to send code to the R
68 matches
Mail list logo