3))
col=c(rep("blue",2),rep("green",2),rep("blue",2),rep("green",2),rep("blue",2),rep("green",2))
values=c(1:12)
df <- data.frame(cycle,col,values)
# Subset data frame df
df[cycle==1 & col=="blue",]
HTH
Pete
--
View this m
Hello,
Have 15 RedHat EL6 workstations patched to current.
Over the weekend the kernel was patched to 6.7 and the xorg-x11-server
and our R-3.1.2 will
not open a xterm window.
It appears to select a portion of the screen and lock onto it. This
section can be moved a
dimnik wrote
> thank you for your answer.Yes,that sounds right.I thought the same thing
> but the problem is how can i generalize the command for every vector of
> numbers not only for the specific example?not only for c(1,2),c(0.1,0.8).
>
> 2015-01-04 0:45 GMT+00:00 Pete B
ng sapply function?
> thank u in advance
How about using mapply, the multivariate version of sapply?
Based on your example ...
mapply(function(x,y) rpois(x,y), c(1,2),c(0.1,0.8))
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/sapply-function-and-poisson-dist
I have 3 xts objects: test, cond1, cond2
You can download here:
https://dl.dropboxusercontent.com/u/102669/obj.rar
My problem is very simple.
test [ cond1 < cond2] = NA THIS WORKS
test [ cond1 < cond2] = -test [ cond1 < cond2] THIS DOESN'T WORKS
Why?
My objecti
5)
d<-c(0.786,0.217,0.538,0.513,0.870,0.326,0.647,0.217)
# Plot
plot(c,a, type="o", col="red", ylim=c(min(a,b,d),max(a,b,d)))
lines(c,b, type="o",col="blue")
lines(c,d, type="o",col="green")
HTH
Pete
--
View this message in cont
<- read.table(textConnection(txt), header = TRUE)
closeAllConnections()
ddply(d,~ID,function(x){x[which.max(x$B),]})
# Returns
ID A B C
1 1 12 36 2
2 2 33 30 2
3 3 83 23 2
4 4 82 36 2
5 5 77 35 2
6 6 76 35 2
7 7 21 30 2
8 8 30 36 2
9 9 21 35 2
HTH
Pete Brecknock wrote
> Hi
>
> The code below plots a stacked barchart.
>
> I would like to overlay on this chart a circular plotting character at the
> sum of the bars for each month. The plotted characters should be joined
> with a line.
>
> So, for "1/1/2014&
1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 11
> 12
> etc.
>
> Any suggestions?
> Thanks in advance
Krishia
Is this what you are looking for?
# Create example matrice
m <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12), nrow=4, byrow=TRUE)
# Create vector
v &l
<- data.frame(id=c(1,2,3),date1,date2)
df$mid <- df$date1 + floor((df$date2-df$date1)/2)
print(df)
id date1 date2 mid
1 1 2013-10-10 2013-10-20 2013-10-15
2 2 2013-11-15 2013-11-20 2013-11-17
3 3 2013-12-25 2013-12-30 2013-12-27
HTH
Pete
--
View this message
6.5925 108.7437 110.5549 111.9343
112.6704 113.6201 115.3020"
df <- read.table(textConnection(text), header=TRUE, check.names=FALSE)
#Create zoo object
d <- t(df[,-1])
ind <- as.yearqtr(names(df)[-1])
z <- zoo(d,ind)
# Plot
plot(z, plot.type="single", col=1:5, lwd=2)
legend(
Thanks Brian. Perfect.
Brian Diggs wrote
> On 7/19/2013 12:54 PM, Pete Brecknock wrote:
>> Hi
>>
>> I am trying to add the contents of the list "myList" to a new column "z"
>> in
>> the data frame "myDataframe"
&
ta.frame(x=c(1,2,3), y=c("R","S","T"))
Would like to produce
x y z
1 R A1,B1
2 S A2,B2,C2
3 T A3,B3
where z is a character string holding the contents of the different elements
of the list.
Any thoughts greatly appreciated.
Pete
--
View this message in
subdivisions=1000))
# Output
[,1] [,2][,3]
value-0.4017303 -0.6249136 -0.9373696
abs.error2.798235e-05 9.17413e-05 9.209191e-05
subdivisions 32 208 91
message "OK" "OK"&quo
to switch with the sort.
Maybe consider the order function
orig <- matrix(c(10,20,30,3,1,2), nrow=2, byrow=TRUE)
new <-t(apply(orig,1,function(x) x[order(orig[2,])]))
> orig
[,1] [,2] [,3]
[1,] 10 20 30
[2,]312
> new
[,1] [,2] [,3]
[1,] 20 30 10
[2
I have this little data.frame
http://dl.dropbox.com/u/102669/nanotna.rdata
Two column contains NA, so the best thing to do is use na.locf function (with
fromLast = T)
But locf function doesn't work because NA in my data.frame are not recognized as
real NA.
Is there a way to substitute fake NA
Hi to all, i'm new to R
I have an xts object.
Can i find:
a) how many NA are in my object ?
b) eventually where (in which line) they are
Thank you
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the pos
nk you want to have a look at factors
Typing ?factor will throw up the relevant help pages
# Your Data
tbl <- read.table(header = TRUE, text = "
ShirtSize Number
L 20
M 20
S 11
XL 7
XXL 2
")
# ShirtSize Alphabetical
tbl[tbl$ShirtSize,]
# Reorde
self-contained, reproducible code.
How about something like ...
NAM = c(1,2,3,4,5,6,7,8,9)
ifelse(NAM>=7,1,0)
# or
ifelse(NAM %in% c(7,8,9),1,0)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Merging-value-labels-into-indicator-variable-tp4659703p4659705.html
Sent fr
bradleyd wrote
> Thanks Pete. The TRIM argument in the MEAN function tells me how to trim
> off decimal points, but I am lost as to how to append the mean values of
> TEMP and IBI between the 10% and 90% quantiles of DAY in each YEAR.
>
> DAY is the julian date that an event occu
ok at trim argument of the mean function
?mean
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Quantiles-of-a-subset-of-data-tp4659063p4659086.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mai
HTML version deleted]]
>
> __
> R-help@
> 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 provide commented, minimal, self-contai
bradleyd wrote
> Thanks for your help Pete. I can almost get it to work with;
>
>> by(day,year,quantile)
>
> but this only gives me 0% 25% 50% 75% 100%, not the ones I'm looking
> for, 10% and 90%.
>
> I have tried;
>
>> by(day,year,quantile(c(0.1,
t;> quantile(DATA$DAY,c(0.1,0.9))
> 10% 90%
> 12 29
>
> But this is for the entire 4000 rows, when I need it to be for each YEAR.
> Is there no way to use a "by" argument in the quantile function?
>
> Thanks for any help you can provide.
> David
check out
>
> Follow up question:
>
> Use urn.model to generate a sample y={y1,...,y25) of n=25 observed sums.
Any good?
ticket.ns<-c(1,1,1,1,2,5,5,10,10,10)
draw=NULL
for (i in 1:25){
draw[i] <- sum(sample(ticket.ns,40,replace=TRUE))
}
print(draw)
HTH
Pete
--
View this message
;)
>
> return(res) }
>
>
>
> Where, for example, the values of the variables are:
> results(1.6, 140, 60, 300, 70, 132, 70, 1.5, 12, 0.5, 2, 22464, 35, 3000,
> 6, 0.6, 0.104, 0.0625, 80, 0.22, 0.31, 0.0625, 0.0625, 2, 6)
>
> I want to take the v
7;t
work for me in the form you posted it.
However, changing ...
arma(epsi, order=c(1,1)) to
mod = arima(epsi, order=c(1,0,1))
You can extract the parameters of interest using
a= mod$coef["ar1"]
b= mod$coef["ma1"]
c= mod$coef["intercept"]
HTH
Pete
to 4 columns: red, blue, green,yellow and then
> either 1 or 0 put in the relevant row.
> Thanks
maybe model.matrix will help
# d is my understanding of your data
d<-factor(c("red","green","red","blue","green","yellow",&qu
David Winsemius wrote
> On Jan 15, 2013, at 3:25 PM, Pete Brecknock wrote:
>
>> David Winsemius wrote
>>> On Jan 15, 2013, at 2:49 PM, Pete Brecknock wrote:
>>>
>>>> Any recommendations for how I can embed my title below in a single red
>>>&
David Winsemius wrote
> On Jan 15, 2013, at 2:49 PM, Pete Brecknock wrote:
>
>> Any recommendations for how I can embed my title below in a single red
>> strip/box across the plot area in the outer margin?
>>
>> I would like to avoid the color appearing in an
)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
plot(rnorm(100),1:100)
# Title
title("MY TITLE", outer = TRUE, cex = 1.5, adj=0, col="blue", font=2)
Thanks for any pointers
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Plot-Header-tp4655654.html
Sent fro
ted, minimal, self-contained, reproducible code.
Or maybe using apply
# data
d <- iris[,-5]
# apply function
a <-data.frame(apply(d, 2, function(x) c(mean=mean(x), sd=sd(x
# print(a) output
Sepal.Length Sepal.Width Petal.Length Petal.Width
mean5.843 3.057 3
A
>
> i did this:
> pa1 <- merge(pa1, an1, by="mergeid")
>
> and it says "'by' must specify uniquely valid column(s)"
how about ...
#Data
d1<-data.frame(id=c(9,8,6,4,4,3,1))
d2<-data.frame(id=c(9,8,6),age=c(46,56,52))
# Left Merge
d<-merge(d1,
les=10
sampsize=5
i=0
y=matrix(rnorm(nsamples*sampsize,50,3),nrow=nsamples)
s=matrix(NA,10,5)
for(i in 1:10){
s[i,]=sample(y,5,replace=T)
}
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/IMPORTANT-PLEASE-HELP-ME-tp4650676p4650692.html
Sent from the R help mailin
that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> __
> R-help@
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-projec
;>>>
>>>>
>>>> If you reply to this email, your message will be added to the
>>>> discussion
>>>> below:
>>>>
>>>> http://r.789695.n4.nabble.com/Using-cumsum-with-group-by-tp4650457p4650
> NAML
Then maybe
x <- matrix(sample(1:8000),nrow=100)
colnames(x)<- paste("Col",1:ncol(x),sep="")
apply(x,2,function(x) c(Min=min(x),
"1st Qu" =quantile(x, 0.25,names=FALSE),
Median = q
Median : 3631 3376
> Mean: 3804 3617
> Sd :
> 3rd Qu.:5772 5544
> IQR:
> Max. :79527779
>
> Is there an easy way?
>
> Thanks
How about ...
x <- matrix(sample(1:8000),nrow=100)
colnames(x)<- paste("
ep2)
d12 <- rbind(part1,part2)
# Approach 2
part1 <- data.frame(d1,rep1)
names(part1)<- c("blk","A","B","C","part")
part2 <- data.frame(d2,rep2)
names(part2)<- c("blk","A","B","C",
orrelation structure, and maximum likelihood
estimation for a class of random effects joint models.
Best wishes, Pete.
Pete Philipson
Lecturer in Statistics
School of Computing, Engineering and Information Sciences
Northumbria University
email: pete.philip...@northumbria.ac.uk
[[alte
;
Error in download.file("http://ir.eia.gov/wpsr/psw09.xls";,
"c:\\temp\\psw09.xls", :
cannot open URL 'http://ir.eia.gov/wpsr/psw09.xls'
In addition: Warning message:
In download.file("http://ir.eia.gov/wpsr/psw09.xls";, "c:\\temp\\psw09.xls
times "0" becomes "1".
> Tried various, of what I thought, methods with built in functions. Didn't
> get any further.
>
> Thank you very much.
>
How about ...
x <- c(0,1,0,1,0,0,0,0)
sum(rle(x)$values)
HTH
Pete
--
View this message in context:
http:
My problem is that I don´t find a way to define the vector subscripts as a
> variable, that I believe is what I need to solve this problem. Is that
> possible?
> Thanks a lot, hope to come back often in this forum,
> G.
>
How about ...
A <- c(368,369,370,371,393,394,395)
which.m
(coeff=c(0.7272727,0.322,0.0500123),
enter=c("Accounts","Time","Poten"))
# Match Function
updates = v[match(u$name,v$enter),"coeff"]
u$coe = ifelse(!is.na(updates), updates, u$coe)
HTH
Pete
valerie wrote
>
> Hi,
>
> I have t
How about using the legend function ...
plot(rnorm(100))
legend(60,2,"100 Random Normal Draws",cex=.8,text.col="blue",
box.col="red",bg="yellow")
You can customize my effort to fit your specific needs
HTH
Pete
Henry wrote
>
> New to R - roo
quot;, sep="")) # 93%
print(paste("Percent of data within 4 SD is ",pData(4),"%", sep="")) # 96%
print(paste("Percent of data within 5 SD is ",pData(5),"%", sep="")) # 97%
print(paste("Percent of data within 6 SD is ",p
. I am not familiar with the diagram package or the examples you describe.
Why the desire to create a data frame? Why not just use a list?
HTH
Pete
dkStevens wrote
>
> Thanks for the reply. Two things - I must have something missing because
> copying and pasting your example gave me
nnect.down
1 1 NULL 2, 3
2 21 4, 5
3 3 NULL 2, 3
4 4 1 4, 5
HTH
Pete
dkStevens wrote
>
> Group
>
> It's unlikely I'
cond= sample(c(0,1), 10, replace= T))
d$cumsum_y.cond1 = cumsum(d$y & d$cond)
# Output
y cond cumsum_y.cond1
1 00 0
2 00 0
3 11 1
4 10 1
5 0 1 1
6 10 1
7 11
> and provide commented, minimal, self-contained, reproducible code.
>
How about ...
x = rnorm(100)
y = rnorm(100)
plot(x,y)
grid()
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/graph-paper-look-tp4308827p4308906.html
Sent from the R help mailing list archive a
0.
Tracking Error 0.7447
Active Premium 0.3694
Information Ratio 0.4960
Treynor Ratio 1.8885
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/problem-with-table-CAPM-in-PerformanceAna
this:
>
> ID age
> 1 Guy1 20
> 2 Guy2 33
>
> I know this must be simple, but I couldn't find the solution by searching.
>
> thanks so much
> Jeremy
>
How about
frame2$age = frame1[match(frame2$ID, frame1$ID),"age"]
print(frame2)
ID
ducible code.
>
One way
myNum=
paste("$",format(myNum, big.mark=","),sep="")
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Display-number-in-currency-notation-with-commas-tp4253582p4253695.html
Sent from the R help mailing li
I am trying to rename column names in a dataframe within a function. I am
seeing an error (listed below) that I don't understand.
Would be grateful of an explanation of what I am doing wrong and how I
should rewrite the function to allow me to be able to rename my variables.
Thanks.
# Test Fun
lp
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
One way would be to use the aggregate function.
# Your Data ...
# Note: I have removed the quotes off the output variable x
comn&
e("2011-01-01 11:30:00","%Y-%m-%d
%H:%M:%S")),
c(strptime("2010-12-01 10:00:00","%Y-%m-%d %H:%M:%S"),
strptime("2010-12-25 06:00:00","%Y-%m-%d
%H:%M:%S")))
lapply(myListStartEnd,function(x) x[2]
4.650 9.081 213
4 LTR_Unknown 9658 10124 0.238 0.117 0.347 466
5 LTR_Unknown 14699 14894 3.545 3.625 2.116 195
6 LTR_Unknown 33201 33474 1.275 1.194 0.591 273
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/column-subtraction-by-ro
>
I am sure others will have cleaner approaches but how about
# Data
temp = data.frame(Day=1:6,Month=1, Year=c(NA,1959,NA,1959,1959,1959),
PW=c(6,7,8,NA,10,11))
# Extract Any Row Containing an NA
myNAs = temp[apply(temp,1,function(x) any(is.na(x))),]
HTH
Pete
--
View this message in
runif(100)
par(mfrow = c(2,1))
hist(d1, ylim=c(0,50))
hist(d2, ylim=c(0,50))
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-change-the-scale-of-the-Y-axis-tp3883843p3884112.html
Sent from the R help mailing list archive at Nabble.com.
_
e
> [1] FALSE FALSE TRUE FALSE
> i.e. not all user A records are found
>
> With unique(df$ID)
> [1] userA userB userC
> Levels: userA userB userC
> i.e. one of each ID is found --]
>
> Erik Svensson
>
How about ...
# All records
ALL_RECORDS <- df[df$ID==df$I
save it as Matrix in Matlab mat format like :
> 0 1 2 3
> 0 1 5 0
> 2 3 4 0
>
>
> can any body help me ? Appreciate your help and thanks in advance.
>
> Reza
>
Not pretty but this works ...
lst1 = list(c(0,1,2,3),c(0,1,5),c(2,3,4))
t(sapply(lst1, function(x) c(x,
Hi!
I need to perform this simple sampling function several hundred times:
x1=as.character(rnorm(1000, 100, 15))
x2=as.character(rnorm(1000, 150, 10))
y1=as.data.frame(x1,x2)
sample1=as.data.frame(sample(y1$x1, 12, replace = FALSE, prob = NULL))
sample1
write.table(sample1, "sample1.txt", sep="
e data
d = data.frame(age=1:20, names=letters[1:20])
# 1. subset using [
d[d$age>10 & d$age<16,]
# 2. subset using subset function
subset(d,d$age>10 & d$age<16)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Basic-vector-logic-not-working-tp3656465p36565
Thanks, Josh!
The index variable (time) was my problem. My R skills are too low! :)
Problem solved!
--
View this message in context:
http://r.789695.n4.nabble.com/Reshape-from-long-to-wide-format-with-date-variable-tp3648833p3650995.html
Sent from the R help mailing list archive at Nabble.com.
Hi,
I need to reshape my dataframe from a long format to a wide format.
Unfortunately, I have a continuous date variable which gives me headaches.
Consider the following example:
> id=c("034","034","016","016","016","340","340")
> date=as.Date(c("1997-09-28", "1997-10-06", "1997-11-04", "2000-09-
Dear R-help,
I am using the chull function to create a convex hull of a series of about
20,000 data points.
A
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
Dear R-help,
I am using the chull function to create a convex
hull of a series of about 20,000 data points.
A
pain is temporary, glory is forever!
Powered by Linux. www.linux.org
Scanned for viruses using ClamAV. www.clamav.net.
[[alternative HTM
t want to use “b” to encode “a” so that “a” looks like
>
> a1<- c(1, 5, 8, 8, 9, 9, 14, 20, 3, 10, 10, 12, 6, 16, 7, 11, 13, 13, 17,
> 18, 2, 4, 15, 19)
>
> Does anyone have a suggestion how to deal with this? Thank you in advance.
>
> Lisa
>
is a1 = b[a] what you are
Gabor Grothendieck wrote:
>
> On Thu, May 26, 2011 at 7:35 PM, Pete Brecknock
> <peter.breckn...@bp.com> wrote:
>> I have a zoo object that contains 2 time series named "A-B" and "V1".
>>
>> When I create a third series "V2", the nam
quot;)
d.z = zoo(d,1:3)
# Create new variable "V2"
# col name changes from "A-B" to "A.B"
d.z$V2 = d.z[,"V1"] *100
# recreate col names
names(d.z) = c(names(d),"V2")
#-
Thanks
Pete
--
View this
quot;intercept" is the "intercept"
ar(d,aic=FALSE, order.max=1,method="ols",intercept=TRUE, demean=FALSE)
> 1
> -0.1057
> Intercept: -0.07054 (0.1731)
There is a nice document on CRAN that you may find useful.
http://cran.r-project.org/doc/contrib/Ricci
lConnections()
# 1. using the aggregate function
aggregate(d$wage_accepted, list(period=d$period, stage=d$stage), FUN=mean)
# 2. using the by function
by(d$wage_accepted,list(d$period,d$stage),FUN=mean)
As for tutorial resources, I would recommend visiting CRAN at
http://cran.r-project.org/ .
Gabor Grothendieck wrote:
>
> On Tue, Dec 7, 2010 at 11:30 AM, Pete Pete <noxyp...@gmail.com>
> wrote:
>>
>> Hi,
>> consider the following two dataframes:
>> x1=c("232","3454","3455","342","13")
>>
... is the apply function what you are looking for?
A=matrix(1,2,4)
apply(A,1,sum)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Element-by-Element-addition-of-the-columns-of-a-Matrix-tp3483545p3483628.html
Sent from the R help mailing list archive at Nabble.com
You could try the "urca" package
Also, I would maybe have a look a the CRAN Task View on computational
econometrics at http://cran.r-project.org/web/views/Econometrics.html
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Cointegration-test-of-
x,is.na(x),FUN=cumsum)))
print(res)
x1 x2 x3 x4 x5 x6
[1,] NA NA 3 7 NA NA
[2,] 5 8 12 NA NA NA
[3,] 7 10 14 18 NA NA
[4,] 11 14 18 23 NA NA
[5,] 67 71 75 NA NA NA
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/cumsum-while-maintaining-NA-tp3421513p3422619.ht
p1,b=temp2)
d.f = do.call("rbind",L)
d.f$tableName = substring(rownames(x),1,1)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/List-extraction-tp3413374p3413564.html
Sent from the R help mailing list archive at Nabble.com.
___
Thanks Gabor. I owe you again.
Kind regards
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Reference-Lines-Using-Grid-Graphics-tp3349185p3349259.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r
Apologies
I forgot to include that the reference lines should be for the y axis only.
Thanks.
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Reference-Lines-Using-Grid-Graphics-tp3349185p3349206.html
Sent from the R help mailing list archive at Nabble.com
generate them on the fly.
Any help would be gratefully received.
Kind regards
Pete
###
# FUNCTION MYPLOT
###
myplot=function(i,j){
pushViewport(viewport
Hi,
I am getting the following error when I try to run import rpy from the the
python IDE:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/dist-packages/rpy.py", line 134, in
""" % RVERSION)
RuntimeError: No module named _rpy2122
RPy module can not
For 5 years
set.seed = 1
d=data.frame(year=rep(2007:2011,each=12), month=rep(1:12,5), meanTemp =
rnorm(60,10,5))
meanByMonth = ave(d$meanTemp, d$month, FUN = mean)[7:9]
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Calculate-a-mean-for-several-months-for
You might want to take a look at Bob Muenchen's book "R for SAS and SPSS
Users"
There is an 80 page preview at .. http://rforsasandspssusers.com/
Additionally, there is lots of documentation for getting started with R on
the CRAN website http://cran.r-project.
an 1950")
,compression = "m", quote = "Close")
There will be many other approaches.
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Downloading-S-P-monthly-data-into-R-tp3302339p3302395.html
Sent from the R help mailing list archive at Nabble.c
ombs,function(x) d[x[2]])
ret = mapply(cbind,one,two)
colnames(ret) = paste("C",1:length(combs),sep="")
You will need to change seq_len(4) to seq_len(269) in the second line.
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/expression-for-index-of-pair
--
View this message in context:
http://r.789695.n4.nabble.com/no-subject-tp3262024p3262024.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.
After ordering the table of membership degrees , i must get the difference
between the first and second coloumns , between the first and second largest
membership degree of object i. This for K=2,K=3,to K.max=6.
This difference is multiplyed by the Crisp silhouette index vector (si). Too
it d
After ordering the table of membership degrees , i must get the difference
between the first and second coloumns , between the first and second largest
membership degree of object i. This for K=2,K=3,to K.max=6.
This difference is multiplyed by the Crisp silhouette index vector (si). Too
it d
try
subset(D, D$x < 5|D$y < 5)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/problem-subsetting-a-data-frame-tp3258981p3259360.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org m
ums = apply(d[,sapply(d,is.numeric)],1,sum)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Select-just-numeric-values-from-rows-tp3256237p3256670.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-projec
After ordering the table of membership degrees , i must get the difference
between the first and second coloumns , between the first and second largest
membership degree of object i. This for K=2,K=3,to K.max=6.
This difference is multiplyed by the Crisp silhouette index vector (si). Too
it d
# Clean up
counts[is.na(counts)]=0
colnames(counts) = "Counts"
print(counts)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/time-bin-sum-tp3252376p3253400.html
Sent from the R help mailing list archive at Nabble.com.
__
After ordering the table of membership degrees , i must get the difference
between the first and second coloumns , between the first and second largest
membership degree of object i. This for K=2,K=3,to K.max=6.
This difference is multiplyed by the Crisp silhouette index vector (si). Too
it de
I believe there are two reasons why your code doesn't work
1. You should replace
sd(Close[i]:Close[(i-3)])
with
sd(Close[(i-3):i]).
This will ensure you select the appropriate obsevations to feed in the sd
function.
2. Per Ray's point above, you need to output the calculated value of sd fo
how about ...
j=NULL
for(i in 4: length(xyz$Close)) {
j[i] = sd(xyz$Close[i-3:i])
}
print(j)
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-do-a-moving-window-on-standard-deviation-tp3247566p3247634.html
Sent from the R help mailing list archive at Nabble.com.
_
object
d.z=zoo(d[,-1],order.by=as.Date(d$Date))
# generate rolling std devs
sd.z = rollapply(d.z,5,sd,align="right")
# you wanted a data frame
df = as.data.frame(merge(d.z,sd.z,all=TRUE))
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-do-a-movin
Typing "?" (no quotes) followed by a topic of interest will throw up the R
Help documentation.
1. Have a look at ?runif
2. Try ?subset and ?cumsum
3. Look at ?rle. Use in conjunction with cumsum and maybe ifelse.
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabbl
Dieter is correct, the lengths of the 2 series are different
Try
s = merge(s1,s2)
corr = cor(s[,"Close.s1"],s[,"Close.s2"],use="pairwise.complete.obs")
print(corr)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Finding-the-
icely.
nums = 1:10
nums +c(1,2)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/sapply-puzzlement-tp3243520p3243583.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
od process, .). Making things easy for myself (it's
late), if you wish to simply ignore an NA the following would work
# sample data
y2=c(NA,1,2,3,4,5)
# ignore NA
ave(y2,is.na(y2),FUN=cumprod)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Ho
1 - 100 of 153 matches
Mail list logo