Re: [R] Two conditions selection

2015-08-04 Thread Pete Brecknock
Pete -- View this message in context: http://r.789695.n4.nabble.com/Two-conditions-selection-tp4710762p4710763.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

[R] Latest Xorg updates broke R x11()

2015-07-27 Thread Boyd, Leslie (Pete)
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

Re: [R] sapply function and poisson distribution

2015-01-04 Thread Pete Brecknock
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 Brecknock [via R] ml-node

Re: [R] sapply function and poisson distribution

2015-01-03 Thread Pete Brecknock
, 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-distribution-tp4701353p4701358.html Sent from the R help mailing list archive

[R] help with xts

2014-05-18 Thread Pete
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 objective

Re: [R] Selecting a maximum value in same ID

2014-03-08 Thread Pete Brecknock
30 36 2 9 9 21 35 2 HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Selecting-a-maximum-value-in-same-ID-tp4686492p4686500.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] multiple plots

2014-03-08 Thread Pete Brecknock
, 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 context: http://r.789695.n4.nabble.com/multiple-plots-tp4686489p4686501.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Lattice Barchart

2014-02-16 Thread Pete Brecknock
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, I would like to see a point at 200 (-1000

Re: [R] Dataset to single column matrix

2014-01-07 Thread Pete Brecknock
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 - c(t(m)) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Dataset-to-single-column

Re: [R] midpoint between two dates

2013-11-17 Thread Pete Brecknock
-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 in context: http://r.789695.n4.nabble.com/midpoint-between-two-dates-tp4680649p4680654.html Sent from the R help mailing list archive at Nabble.com

Re: [R] plot time series data in wide format

2013-11-01 Thread Pete Brecknock
[,-1]) ind - as.yearqtr(names(df)[-1]) z - zoo(d,ind) # Plot plot(z, plot.type=single, col=1:5, lwd=2) legend(topleft,legend=c(City1,City2,City3,City4,City5),lty=1, lwd=2, col=1:5) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/plot-time-series-data-in-wide-format

[R] Adding List Elements To A Data Frame

2013-07-19 Thread Pete Brecknock
string holding the contents of the different elements of the list. Any thoughts greatly appreciated. Pete -- View this message in context: http://r.789695.n4.nabble.com/Adding-List-Elements-To-A-Data-Frame-tp4671932.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Adding List Elements To A Data Frame

2013-07-19 Thread Pete Brecknock
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 myList - list(c(A1,B1), c(A2,B2,C2), c(A3,B3)) myDataframe - data.frame(x=c(1,2,3), y=c(R,S,T

Re: [R] Ordering a matrix by row value in R2.15

2013-03-24 Thread Pete Brecknock
,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,]123 HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Ordering-a-matrix-by-row-value-in-R2-15-tp4662337p4662340

Re: [R] Integrate with vectors and varying upper limit

2013-03-24 Thread Pete Brecknock
2.798235e-05 9.17413e-05 9.209191e-05 subdivisions 32 208 91 message OK OKOK call Expression Expression Expression HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Integrate-with-vectors-and-varying

[R] data.frame with NA

2013-03-18 Thread Pete
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

[R] Find NA in xts object

2013-03-16 Thread Pete
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

Re: [R] Ordering Table Columns

2013-03-02 Thread Pete Brecknock
tbl[tbl$ShirtSize,] # Reorder Factor tbl$ShirtSize = factor(tbl$ShirtSize, levels=c(S,M,L,XL,XXL)) # ShirtSize Order by Size tbl[tbl$ShirtSize,] Pete -- View this message in context: http://r.789695.n4.nabble.com/Ordering-Table-Columns-tp4660110p4660129.html Sent from the R help mailing list

Re: [R] Merging value labels into indicator variable.

2013-02-26 Thread Pete Brecknock
... 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 from the R help mailing list archive at Nabble.com

Re: [R] Quantiles of a subset of data

2013-02-19 Thread Pete Brecknock
)) 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 ?aggregate or ?by should be of help HTH Pete -- View this message

Re: [R] Quantiles of a subset of data

2013-02-19 Thread Pete Brecknock
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, 0.9))) but this is rejected by Error in FUN(X[[1L

Re: [R] Converting the data in year month day hour and minutes to date

2013-02-19 Thread Pete Brecknock
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. how about as.POSIXlt(2008-01-01 02:30, format=%Y-%m-%d %H:%M) Pete -- View this message in context: http://r.789695.n4.nabble.com/Converting

Re: [R] Quantiles of a subset of data

2013-02-19 Thread Pete Brecknock
,data$year,day,c(0.1,0.9)) * was correct in that it calculated the quantile values as intended, but I don't know how to then calculate the mean TEMP and IBI values encompasses within those quantiles. Thanks again, David have a look at trim argument of the mean function ?mean Pete -- View

Re: [R] Quantiles of a subset of data

2013-02-19 Thread Pete Brecknock
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 occurred in certain years

Re: [R] doubt with function on R software

2013-02-18 Thread Pete Brecknock
(100,200,300,400)) # Ouput Data outputData - do.call(myfun, inputData) print(outputData) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/doubt-with-function-on-R-software-tp4658973p4658990.html Sent from the R help mailing list archive at Nabble.com

Re: [R] R function help!

2013-02-18 Thread Pete Brecknock
? 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 in context: http://r.789695.n4.nabble.com/R-function-help-tp4658998p4659001.html Sent from the R help mailing list archive at Nabble.com

Re: [R] assign estimated values

2013-02-10 Thread Pete Brecknock
, 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 -- View this message in context: http://r.789695.n4.nabble.com/assign-estimated-values-tp4658139p4658141.html Sent from

Re: [R] Converting column of strings to boolean

2013-01-26 Thread Pete Brecknock
,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,red)) model.matrix(~d -1) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Converting

[R] Plot Header

2013-01-15 Thread Pete Brecknock
) 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 from the R help mailing

Re: [R] Plot Header

2013-01-15 Thread Pete Brecknock
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 any other area defined by the oma. The code

Re: [R] Plot Header

2013-01-15 Thread Pete Brecknock
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 strip/box across the plot area in the outer margin? I would like

Re: [R] how to apply two or more functions to each columns in a time?

2012-12-26 Thread Pete Brecknock
) c(mean=mean(x), sd=sd(x # print(a) output Sepal.Length Sepal.Width Petal.Length Petal.Width mean5.843 3.057 3.758000 1.199 sd 0.8280661 0.4358663 1.765298 0.7622377 HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/how

Re: [R] how to add a column from another dataset with merge

2012-12-07 Thread Pete Brecknock
'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,d2,all.x=TRUE) # Reorder d[order(d$id,decreasing=TRUE),] HTH Pete -- View this message in context: http://r.789695.n4

Re: [R] IMPORTANT!!!! PLEASE HELP ME

2012-11-24 Thread Pete Brecknock
do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. maybe ... replicate(1, rnorm(50)) could work for you HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/IMPORTANT-PLEASE-HELP

Re: [R] IMPORTANT!!!! PLEASE HELP ME

2012-11-24 Thread Pete Brecknock
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 mailing list

Re: [R] Summary statistics for matrix columns

2012-11-23 Thread Pete Brecknock
), IQR=IQR(x), Max = max(x))) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Summary-statistics-for-matrix-columns-tp4650489p4650547.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Using cumsum with 'group by' ?

2012-11-23 Thread Pete Brecknock
[,time]),] Or have I misinterpreted your request? HTH Pete (B not D) -- View this message in context: http://r.789695.n4.nabble.com/Using-cumsum-with-group-by-tp4650457p4650556.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r

Re: [R] Summary statistics for matrix columns

2012-11-22 Thread Pete Brecknock
: Max. :79527779 Is there an easy way? Thanks How about ... x - matrix(sample(1:8000),nrow=100) colnames(x)- paste(Col,1:ncol(x),sep=) apply(x,2,function(x) c(summary(x), sd=sd(x), IQR=IQR(x))) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com

Re: [R] Merging two data frames with different columns names

2012-04-14 Thread Pete Brecknock
- rbind(part1, part2) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Merging-two-data-frames-with-different-columns-names-tp4556400p4557974.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] [R-pkgs] New package joineR

2012-04-02 Thread Pete Philipson
, 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 [[alternative HTML version

[R] Problems downloading file

2012-03-01 Thread Pete Brecknock
:\\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, : InternetOpenUrl failed: 'The operation timed out' Thanks for any insights. Pete Brecknock -- View this message

Re: [R] Counting value changes

2012-02-18 Thread Pete Brecknock
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://r.789695.n4.nabble.com/Counting-value-changes-tp4400267p4400348.html Sent from the R help

Re: [R] finding the subscript of a vector fulfiiling a given condition

2012-02-14 Thread Pete Brecknock
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.max(diff(A)) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/finding

Re: [R] How to Calculate Percentage of Data within certain SD of Mean

2012-02-05 Thread Pete Brecknock
(paste(Percent of data within 5 SD is ,pData(5),%, sep=)) # 97% print(paste(Percent of data within 6 SD is ,pData(6),%, sep=)) # 98% HTH Pete Ajata Paul wrote How do you calculate the percentage of data within 2SD, 3SD, 4SD, 5SD, and 6SD of the mean? I used the following link as the data

Re: [R] text command - how to get a white background to cover grid lines

2012-02-05 Thread Pete Brecknock
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 - rookie question. I'm a mechanical engineer and enjoying using

Re: [R] replace some values of a column with diffrent values

2012-02-05 Thread Pete Brecknock
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 two data frames (u and v). u coe nam 1 0 Time 2 0Poten 3 0 AdvExp 4 0Share 5 0 Change 6 0 Accounts 7 0 Work 8

Re: [R] combining data structures

2012-02-04 Thread Pete Brecknock
. 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 an error

Re: [R] combining data structures

2012-02-03 Thread Pete Brecknock
2, 3 2 21 4, 5 3 3 NULL 2, 3 4 41 4, 5 HTH Pete dkStevens wrote Group It's unlikely I'm trying this the best way, but I'm trying to create a data structure from

Re: [R] Conditional cumulative sum

2012-01-26 Thread Pete Brecknock
4 10 1 5 01 1 6 10 1 7 11 2 8 11 3 9 10 3 10 01 3 HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Conditional-cumulative-sum-tp4332254p4332344.html

Re: [R] graph paper look

2012-01-18 Thread Pete Brecknock
) 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 at Nabble.com. __ R-help@r-project.org mailing list https

Re: [R] problem with table.CAPM in PerformanceAnalytics

2012-01-15 Thread Pete Brecknock
0.1934 Correlation p-value 0. Tracking Error 0.7447 Active Premium 0.3694 Information Ratio 0.4960 Treynor Ratio 1.8885 HTH Pete -- View this message

Re: [R] add column with values found in another data frame

2012-01-14 Thread Pete Brecknock
the solution by searching. thanks so much Jeremy How about frame2$age = frame1[match(frame2$ID, frame1$ID),age] print(frame2) ID age 1 Guy1 20 2 Guy2 33 HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/add-column-with-values-found-in-another-data

Re: [R] Display number in currency notation with commas

2012-01-02 Thread Pete Brecknock
(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 list archive at Nabble.com. __ R-help@r-project.org

[R] Renaming Within A Function

2011-12-22 Thread Pete Brecknock
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

Re: [R] Group several variables and apply a function to the group

2011-12-04 Thread Pete Brecknock
x comn-c(abc, abc, abc, abc, abc, abc, xyz, xyz,xyz, xyz) mi- c(1, 1,1, 2, 2, 2, 1, 1, 3, 3) x- c(-0.0031, 0.0009, -0.007, 0.1929,0.0087, 0.099,-0.089, 0.005, -0.0078, 0.67) df- data.frame(comn=comn, mi=mi, x=x) # Aggregate Function aggregate(df$x, by=list(df$comn,df$mi),FUN=sd) HTH Pete -- View

Re: [R] lapply and Two TimeStamps as input

2011-10-31 Thread Pete Brecknock
), strptime(2010-12-25 06:00:00,%Y-%m-%d %H:%M:%S))) lapply(myListStartEnd,function(x) x[2]-x[1]) # Output [[1]] Time difference of 365.1042 days [[2]] Time difference of 23.8 days HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/lapply-and-Two-TimeStamps-as-input

Re: [R] Extracting dataframe rows containing NAs in one column

2011-10-25 Thread Pete Brecknock
), 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 context: http://r.789695.n4.nabble.com/Extracting-dataframe-rows-containing-NAs-in-one-column-tp3937361p3937523.html Sent from the R help mailing

Re: [R] column subtraction by row

2011-10-25 Thread Pete Brecknock
263 3 LTR_Unknown 6210 6423 6.080 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

Re: [R] How to change the scale of the Y axis?

2011-10-07 Thread Pete Brecknock
=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. __ R-help@r-project.org

Re: [R] Keep ALL duplicate records

2011-10-02 Thread Pete Brecknock
)],] print(ALL_RECORDS) # Logical Records TRUE_FALSE - df$ID==df$ID[duplicated(df$ID)] print(TRUE_FALSE) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Keep-ALL-duplicate-records-tp3865136p3865573.html Sent from the R help mailing list archive at Nabble.com

[R] Loop with random sampling and write.table

2011-09-03 Thread Pete Pete
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=

Re: [R] Saving a list as a Matrix

2011-09-03 Thread Pete Brecknock
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,rep(0,4-length(x) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Saving-a-list

Re: [R] Basic vector logic not working

2011-07-09 Thread Pete Brecknock
region. This is a simple problem, but I can't find anything wrong. How could I fix it? Maybe something like ... # example data d = data.frame(age=1:20, names=letters[1:20]) # 1. subset using [ d[d$age10 d$age16,] # 2. subset using subset function subset(d,d$age10 d$age16) HTH Pete

Re: [R] Reshape from long to wide format with date variable

2011-07-07 Thread Pete Pete
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.

[R] Reshape from long to wide format with date variable

2011-07-06 Thread Pete Pete
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-27, 2003-07-20,

[R] chull increase number of points

2011-06-28 Thread pete
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

[R] chull increase number of points

2011-06-28 Thread pete
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

Re: [R] Recode numbers

2011-06-01 Thread Pete Brecknock
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 looking for? HTH Pete -- View this message in context: http://r.789695.n4.nabble.com

[R] zoo column names

2011-05-26 Thread Pete Brecknock
d.z$V2 = d.z[,V1] *100 # recreate col names names(d.z) = c(names(d),V2) #- Thanks Pete -- View this message in context: http://r.789695.n4.nabble.com/zoo-column-names-tp3553939p3553939.html Sent from the R help mailing list archive at Nabble.com

Re: [R] zoo column names

2011-05-26 Thread Pete Brecknock
Gabor Grothendieck wrote: On Thu, May 26, 2011 at 7:35 PM, Pete Brecknock lt;peter.breckn...@bp.comgt; wrote: I have a zoo object that contains 2 time series named A-B and V1. When I create a third series V2, the name of the A-B series is changed to A.B. Although I could recreate

Re: [R] ARMA

2011-05-08 Thread Pete Brecknock
) There is a nice document on CRAN that you may find useful. http://cran.r-project.org/doc/contrib/Ricci-refcard-ts.pdf HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/ARMA-tp3507846p3507963.html Sent from the R help mailing list archive at Nabble.com

Re: [R] how to calculate the mean of a group in a table

2011-05-07 Thread Pete Brecknock
, 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/ ... follow the Manuals link on the left hand side of the page. HTH Pete -- View this message

Re: [R] Creating binary variable depending on strings of two dataframes

2011-05-06 Thread Pete Pete
Gabor Grothendieck wrote: On Tue, Dec 7, 2010 at 11:30 AM, Pete Pete lt;noxyp...@gmail.comgt; wrote: Hi, consider the following two dataframes: x1=c(232,3454,3455,342,13) x2=c(1,1,1,0,0) data1=data.frame(x1,x2) y1=c(232,232,3454,3454,3455,342,13,13,13,13) y2=c(E1,F3,F5,E1,E2,H4,F8,G3

Re: [R] Element by Element addition of the columns of a Matrix

2011-04-29 Thread Pete Brecknock
... 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

Re: [R] Cointegration test of panel data

2011-04-09 Thread Pete Brecknock
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-panel-data

Re: [R] cumsum while maintaining NA

2011-04-02 Thread Pete Brecknock
) 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.html Sent from the R help mailing list

Re: [R] List extraction

2011-03-28 Thread Pete Brecknock
) 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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Reference Lines Using Grid Graphics

2011-03-11 Thread Pete Brecknock
to generate them on the fly. Any help would be gratefully received. Kind regards Pete ### # FUNCTION MYPLOT ### myplot=function(i,j){ pushViewport(viewport

Re: [R] Reference Lines Using Grid Graphics

2011-03-11 Thread Pete Brecknock
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

Re: [R] Reference Lines Using Grid Graphics

2011-03-11 Thread Pete Brecknock
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

[R] does rpy support R 2.12.2

2011-03-01 Thread Pete Shepard
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 stdin, line 1, in module File /usr/lib/python2.6/dist-packages/rpy.py, line 134, in module % RVERSION) RuntimeError: No module named _rpy2122 RPy

Re: [R] Calculate a mean for several months for several years

2011-02-21 Thread Pete Brecknock
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

Re: [R] From SPSS Syntax to R code

2011-02-12 Thread Pete Brecknock
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.org/ HTH Pete

Re: [R] Downloading SP monthly data into R

2011-02-11 Thread Pete Brecknock
) 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.com. __ R-help@r-project.org mailing

Re: [R] expression for index of pairwise combinations

2011-02-09 Thread Pete Brecknock
]]) 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-pairwise-combinations-tp3263025p3298495.html Sent

Re: [R] clustering fuzzy

2011-02-05 Thread pete
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

[R] clustering fuzzy

2011-02-05 Thread pete
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

[R] (no subject)

2011-02-05 Thread pete
-- 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

Re: [R] problem subsetting a data frame

2011-02-03 Thread Pete Brecknock
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 mailing

Re: [R] clustering fuzzy

2011-02-02 Thread pete
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

Re: [R] Select just numeric values from rows

2011-02-02 Thread Pete Brecknock
[,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-project.org mailing

Re: [R] time bin sum

2011-02-01 Thread Pete Brecknock
) = 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. __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] silhouette fuzzy

2011-01-31 Thread pete
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

Re: [R] Finding the correlation coefficient of two stocks

2011-01-30 Thread Pete Brecknock
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-correlation-coefficient-of-two-stocks

Re: [R] Help plz

2011-01-30 Thread Pete Brecknock
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.nabble.com/Help

Re: [R] How to do a moving window on standard deviation

2011-01-30 Thread Pete Brecknock
=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-moving-window-on-standard-deviation

Re: [R] How to do a moving window on standard deviation

2011-01-30 Thread Pete Brecknock
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.

Re: [R] How to do a moving window on standard deviation

2011-01-30 Thread Pete Brecknock
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

Re: [R] sapply puzzlement

2011-01-27 Thread Pete Brecknock
. 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 https

Re: [R] How do I fix this ?

2011-01-26 Thread Pete Brecknock
, .). 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/How-do-I-fix

  1   2   >