[R] POSIXct: subtle difference in representation leads to error for +

2014-05-21 Thread Jens Scheidtmann
Dear all, I have had a weird problem in R 3.0.2: x [1] 2006-03-14 12:48:01 CET 2006-05-02 11:09:48 CEST str(x) POSIXct[1:2], format: 2006-03-14 12:48:01 2006-05-02 11:09:48 x + 6 Error in unclass(e1) + unclass(e2) : non-numeric argument to binary operator as.POSIXct(x) + 6 Error in

[R] How to create a time series from a data set where some days are skipped

2014-05-21 Thread Charles Thuo
I have a data set with daily claim numbers. I group with monthly totals and create a time series as follows v.ts- ts(v, start=2008,frequency=12) How can the daily data be converted into a time series where there is no claim number for sundays and public holidays. Charles.

Re: [R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-21 Thread Jim Lemon
On Tue, 20 May 2014 02:39:17 PM Shane Carey wrote: Hi, I amtrying to plot a cfd with a histogram on one plot. The problem is the scale (y-axis) of the plots are hugely different and as a result the histogram plot is hard to read. Are there any examples of plots like this done in R:

Re: [R] POSIXct: subtle difference in representation leads to error for +

2014-05-21 Thread Jeff Newmiller
You did not show us how x was created, so we cannot tell whether this indicates a bug or not. My bet would be that x' was created in some way that bypassed the standard POSIXct creation code. Note that your timezone specification is not atypical for output shorthand but may not yield

Re: [R] POSIXct: subtle difference in representation leads to error for +

2014-05-21 Thread Prof Brian Ripley
On 21/05/2014 08:33, Jeff Newmiller wrote: You did not show us how x was created, so we cannot tell whether this indicates a bug or not. My bet would be that x' was created in some way that bypassed the standard POSIXct creation code. Note that your timezone specification is not atypical for

Re: [R] cumulative frequency distribution combined with histogram in one plot at two different scales

2014-05-21 Thread Shane Carey
Hi all, I ended up using twoord.plot from library(plotrix) It worked great. Thanks for all the help. Cheers On Wed, May 21, 2014 at 8:15 AM, Jim Lemon j...@bitwrit.com.au wrote: On Tue, 20 May 2014 02:39:17 PM Shane Carey wrote: Hi, I amtrying to plot a cfd with a histogram on one plot.

[R] create line chart from data.frame

2014-05-21 Thread Mat
Hello together, i want to create a line graph, from a data.frame like this one: Categorie Y10_11 Y11_12Y12_13 Y13_14 AService 1 2 3 4 BSupport 2 55 0 C

Re: [R] create line chart from data.frame

2014-05-21 Thread Jim Lemon
On Wed, 21 May 2014 01:20:52 AM Mat wrote: Hello together, i want to create a line graph, from a data.frame like this one: Categorie Y10_11 Y11_12Y12_13 Y13_14 AService 1 2 3 4 BSupport 2

[R] Waldtest and different sample sizes

2014-05-21 Thread Katharina Mersmann
Hey R Users! I´m trying to run a waldtest comparing an restricted and unrestricted model. But sample size is different (because of NA´s), so I get an error message: caus2-plm(CSmean~ lag(CSmean,1)+ lag(numfull_FCRlong,1)+ +

Re: [R] Summary to data frame in R!!

2014-05-21 Thread peter dalgaard
On 07 May 2014, at 17:55 , Marc Schwartz marc_schwa...@me.com wrote: as.data.frame(sapply(mtcars[, c(mpg, disp)], summary)) I'd use lapply() rather than sapply() here. That goes directly from a list to a data frame, avoiding the detour via a matrix. -- Peter Dalgaard, Professor Center for

[R] Splitting vector elements

2014-05-21 Thread Katherine Gobin
Dear R forum I have a vector as  dat = c(ABC 1, ABC 2, ABC 3, DEF 10, DEF 20) dat [1] ABC 1  ABC 2  ABC 3  DEF 10 DEF 20 I need to split the names into two parts say    p1      p2  ABC    1  ABC    2  ABC    3  DEF     10  DEF     20 Kindly guide Katherine [[alternative HTML

Re: [R] Splitting vector elements

2014-05-21 Thread Luca Cerone
Hi Katherin, the following code does the trick: x - strsplit(dat, ) df - data.frame(p1=sapply(x, function(x) x[1]), p2 = sapply(x, function(x) x[2])) Hope it helps, Luca 2014-05-21 11:29 GMT+02:00 Katherine Gobin katherine_go...@yahoo.com: Dear R forum I have a vector as dat = c(ABC 1, ABC

Re: [R] Splitting vector elements

2014-05-21 Thread arun
Hi Katherine, #or you can use: read.table(text=dat,sep=,header=FALSE,stringsAsFactors=FALSE) #   V1 V2 #1 ABC  1 #2 ABC  2 #3 ABC  3 #4 DEF 10 #5 DEF 20 A.K. On Wednesday, May 21, 2014 5:38 AM, Luca Cerone luca.cer...@gmail.com wrote: Hi Katherin, the following code does the trick: x -

Re: [R] Splitting vector elements

2014-05-21 Thread Luca Cerone
Thanks Arun, I agree using read.table is probably easier :) 2014-05-21 12:08 GMT+02:00 arun smartpink...@yahoo.com: Hi Katherine, #or you can use: read.table(text=dat,sep=,header=FALSE,stringsAsFactors=FALSE) # V1 V2 #1 ABC 1 #2 ABC 2 #3 ABC 3 #4 DEF 10 #5 DEF 20 A.K. On

Re: [R] Second axis on bottom of graph

2014-05-21 Thread Hurr
Next I want to move the x axis labels up towards the axis to make the gap smaller. The mgp= was suggested to me. The staxlab function to be standard soon was sent to me by the author to make staxlab work on the second x axis. Runnable code to help demonstrate what I want to do: Hurr #trying

Re: [R] How to create a time series from a data set where some days are skipped

2014-05-21 Thread arun
Hi, You may check ?isWeekday, ?isBizday, from library(timeDate) library(timeDate) tS - timeSequence(as.Date(2008/1/1), as.Date(2014/4/21)) tWd - tS[isWeekday(tS)] length(tWd) #[1] 1645  pubHolUS - holiday(2008:2014,listHolidays(US)) tS1 - tS[isBizday(tS, holidays = holidayNYSE(2008:2014),

Re: [R] Voronoi-Diagrams in R

2014-05-21 Thread Raphael Päbst
I believe you are right. A night of sleep has done wonders for my understanding of the problem. Thank you for your patience and help! Raphael On 5/21/14, Rolf Turner r.tur...@auckland.ac.nz wrote: It sounds to me as though you are simply getting yourself flummoxed by the fact that the

Re: [R] \ escape sequence and windows path

2014-05-21 Thread Michael Friendly
An easy non-R solution is to use a clipboard utility like PathCopy. Most have the capability to configure how a windows path is copied to the clipboard. On 5/20/2014 6:37 AM, Knut Krueger wrote: Is there any function to change the windows path to linux path? especially I would like to have

Re: [R] bootstrapping for maxium data

2014-05-21 Thread David Winsemius
Run the examples in the ?boot help page. Notice that boot needs a function that accepts a dataframe and an index vector. Sent from my iPhone On May 21, 2014, at 1:49 AM, 张以春 yczh...@nigpas.ac.cn wrote: Dear friends, I have a numeric vector composed of 320 numbers. Now, I want to

Re: [R] \ escape sequence and windows path

2014-05-21 Thread Knut Krueger
Am 20.05.2014 19:00, schrieb David L Carlson: Now I understand. Not really a solution, but you can instruct students to use only forward slashes in their paths since R will convert to backslash on Windows systems automatically. After a couple of broken commands, they should get the hang of

Re: [R] bootstrapping for maxium data

2014-05-21 Thread Bert Gunter
Perhaps it should be mentioned that resampling does not produce a correct CI for extreme quantiles, so the whole exercise may be pointless. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is

Re: [R] \ escape sequence and windows path

2014-05-21 Thread Jeff Newmiller
I tend to view this as enforced training in string escaping. One option i have not seen mentioned is the file.choose function, which is GUI but a little tedious for deep directories. --- Jeff Newmiller

Re: [R] \ escape sequence and windows path

2014-05-21 Thread Gabor Grothendieck
On Wed, May 21, 2014 at 9:25 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: I tend to view this as enforced training in string escaping. One option i have not seen mentioned is the file.choose function, which is GUI but a little tedious for deep directories. I also was thinking about

[R] stop subscribing mailing list

2014-05-21 Thread han...@purdue.edu
Dear, I would like to stop to receive any email from R-help mailing list for this email address. Thank you. Mingxuan Han __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] stop subscribing mailing list

2014-05-21 Thread Steve Friedman
Then unsubscribe. On May 21, 2014 10:00 AM, han...@purdue.edu han...@purdue.edu wrote: Dear, I would like to stop to receive any email from R-help mailing list for this email address. Thank you. Mingxuan Han __ R-help@r-project.org mailing

[R] How to draw a transparent polygon

2014-05-21 Thread Jun Shen
Hi everyone, How do I draw a transparent ploygon overlaying with a scatter plot? Let's say, we call plot() to have a scatter plot, then call polygon() to add a polygon. I was hoping the polygon can be transparent so the scatter plot is still visible. I can't find any argument in polygon() for

Re: [R] How to draw a transparent polygon

2014-05-21 Thread David L Carlson
The standard colors in R are opaque, but you can add an alpha value to make them semi-transparent. In this example we set alpha halfway between 0 and 255 to define a semi-transparent red: set.seed(42) x - runif(10)*10 y - runif(10)*10 plot(x, y, pch=16) col2rgb(red, alpha=TRUE) [,1]

Re: [R] How to draw a transparent polygon

2014-05-21 Thread William Dunlap
You can use adjustcolor() to do some of the arithmetic for you. E.g., the following draws red squares with 10 opacities ('alpha's) from 5% to 95%: plot(1:10) square - 0.45 * cbind(c(-1,1,1,-1),c(-1,-1,1,1)) for(i in 1:10) polygon(square+i, col=adjustcolor(red, alpha=(i-.5)/10)) Bill

Re: [R] stop subscribing mailing list

2014-05-21 Thread Frede Aakmann Tøgersen
Yes and you do that by going to https://stat.ethz.ch/mailman/listinfo/r-help and fill in the required information. Sorry to loose you on this list. Best regards Frede Sendt fra Samsung mobil Oprindelig meddelelse Fra: Steve Friedman Dato:21/05/2014 16.03 (GMT+01:00)

Re: [R] How to draw a transparent polygon

2014-05-21 Thread Boris Steipe
... I just specify alpha values directly in the hex-code for a color: set.seed(112352) plot(runif(20),runif(20), pch=16) polygon(runif(3), runif(3), col=#FF22) polygon(runif(3), runif(3), col=#00FF0022) polygon(runif(3), runif(3), col=#FF22) B. On 2014-05-21, at 12:05 PM, William

Re: [R] How to draw a transparent polygon

2014-05-21 Thread Jun Shen
Thanks everyone who replied. Boris, could you explain a bit more how to obtain this hex-code for a specific color? Thanks. Jun On Wed, May 21, 2014 at 1:37 PM, Boris Steipe boris.ste...@utoronto.cawrote: ... I just specify alpha values directly in the hex-code for a color: set.seed(112352)

Re: [R] Subset, period of days like one after another in a group

2014-05-21 Thread jim holtman
try this: x - structure(list(date = structure(c(15765, 15766, 15767, 15768, + 15769, 15770, 15771, 15772, 15773, 15780, 15781, 15782, 15788, + 15789, 15790, 15791, 15792, 15795), class = Date), mon = c(Mrz, + Mrz, Mrz, Mrz, Mrz, Mrz, Mrz, Mrz, Mrz, Mrz, + Mrz, Mrz, Mrz, Mrz, Mrz, Mrz, Mrz, Mrz),

Re: [R] How to draw a transparent polygon

2014-05-21 Thread Boris Steipe
Hex-codes are ubiquitously used on the Web - they are a short-hand version of specifying rgb triplets. The first two digits specify the red value, the second two are for green, then blue. R accepts a fourth pair of digits to optionally specify the transparency, the semantics of the code is thus

[R] Mean of colMeans

2014-05-21 Thread Kate Ignatius
Hi All, I've successfully gotten out the colMeans for 60 columns using: col - colMeans(x, na.rm = TRUE, dims = 1) My next question is: is there a way of getting a mean of all the column means (ie a mean of a mean)? Thanks! __ R-help@r-project.org

Re: [R] How to draw a transparent polygon

2014-05-21 Thread Bert Gunter
Inline. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. H. Gilbert Welch On Wed, May 21, 2014 at 11:26 AM, Boris Steipe boris.ste...@utoronto.ca wrote: Hex-codes are

Re: [R] Mean of colMeans

2014-05-21 Thread Sarah Goslee
That would be because col is a function in base R, and thus a poor choice of names for user objects. Nonetheless, it worked when I ran it, but you didn't provide reproducible example so who knows. R set.seed(1) R x - data.frame(matrix(runif(150), ncol=10)) R # col is a function, so not a good

Re: [R] Mean of colMeans

2014-05-21 Thread Kate Ignatius
Thanks for the explanation. And tip... this was a quick a dirty code so didn't really think about naming something that is already a function in R. Data was generic - just a bunch of columns with numbers so didn't bother including that as I know that wasn't the problem. Same goes with replying -

Re: [R] Mean of colMeans

2014-05-21 Thread Frede Aakmann Tøgersen
Hhhhmmhhhm, but is that not the same as mean(as.matrix(x)) ? Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.com http://www.vestas.com Company

[R] Groupwise sum

2014-05-21 Thread Anna Carter
Dear R forum, I have following data.frame - my_dat = data.frame(sr = c(0,0,0,0, 1, 1, 1, 1, 2, 2, 2, 2), bond = c(A, B, B, B, A, B, B, B, A, B, B, B), cashflow = c(1000, 2000, 2000, 4000, 10, 200, 300, 100, 80, 40, 60, 120)) my_dat    sr   bond  cashflow 1   0    A     1000 2   0    B    

Re: [R] Waldtest and different sample sizes

2014-05-21 Thread Millo Giovanni
Dear Katharina, if I get it right, you just want to assess the significance of 'lag(numfull_FCRlong,1)'. For this purpose, you can simply look at the relevant t-statistic in the model summary. BTW, the latter is the square root of the (F-version of the) Wald test for the restriction you are

Re: [R] POSIXct: subtle difference in representation leads to error for +

2014-05-21 Thread Jens Scheidtmann
Dear Jeff, 2014-05-21 9:33 GMT+02:00 Jeff Newmiller jdnew...@dcn.davis.ca.us: You did not show us how x was created, so we cannot tell whether this indicates a bug or not. My bet would be that x' was created in some way that bypassed the standard POSIXct creation code. I debugged it, this

Re: [R] Mean of colMeans

2014-05-21 Thread Igor Sosa Mayor
Kate Ignatius kate.ignat...@gmail.com writes: Hi All, I've successfully gotten out the colMeans for 60 columns using: col - colMeans(x, na.rm = TRUE, dims = 1) My next question is: is there a way of getting a mean of all the column means (ie a mean of a mean)? maybe mean(x) ? -- :: Igor

Re: [R] NppToR / RMySQL / loadNamespace() Error

2014-05-21 Thread Peter Meissner
Thanks a lot for the input (and thanks for R), but nope, both R versions are the same ... and I really do not think that NppToR is actually causing the problem. Since RMySQL has problems (as I understand the errors/warnings) to find what it expects to find I thought that maybe there is a

[R] using asList with lme4 object

2014-05-21 Thread John.Morrongiello
Hi list This doesn't particularly concern the interpretation of a mixed model, so I thought it best to post here. I assume it has something to do with using the asList call for an S4 object or some form of grouping done by lme, but I might be way off. I'd like to extract the residuals of a lmer

[R] syntax for MANOVA ( factor labeling)

2014-05-21 Thread Sara Scharf
Self-taught R newbie (and stats newbie) here. I'd like to run a MANOVA test to see whether self- and peer ratings differ within teams. There are 3 peer ratings per person on a team. My data is in a tab-delimited text file, structured as follows: *Team* *Person**Rating

[R] Questions in R about optim( ) and optimize( )

2014-05-21 Thread Gao, Vicky
Hello, I would be really thankful if I could bother you with two questions. 1. I ran into some problems when I used the code optim() in my work. I used it to optimize a function-fn(x,y), where x is a two-dimensional parameter. For y I want to pass the value later when I use optim(), because

Re: [R] bootstrapping for maxium data

2014-05-21 Thread Angelo Canty
Yichun, 1. You are doing this wrong! 2. It is the wrong thing to do! In more detail: 1. To use boot, it helps to read the help file which clearly says the statistic must be a function of two arguments, the original dataset and the indices saying which of the original datapoints are in the

[R] program

2014-05-21 Thread kafi dano
Please help me to find the reason when applied this program gave me the same result for b1,b2,b3 for all (BS,BIAS, RMSE , and SE)  I want to compare between these beta's tq. ## Ridge MM  ##   rm(list=ls())   library(MASS)   library(mvoutlier)  

[R] approxfun question

2014-05-21 Thread Helio Camargo
Sorry for the naive question, but is it actually possible do SEE the approximation function y=f(x) in any of the output options of approxfun? Cheers, -- Helio [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] SQL vs R

2014-05-21 Thread Dr Eberhard Lisse
So, some feedback. Have installed MariaDB 10.0.10 on the Linux box. That speeded things up. Changed from InnoDB/XtraDb to Aria. That speeded loading of the data up. Have installed MariaDB on the iMac. That speeded things up more. Tried to tune MariadDB's config. Didn't speed things up much, but

Re: [R] The Future of R | API to Public Databases

2014-05-21 Thread antagomir
Just a note on this earlier thread: R package collections for public APIs seem to be now emerging and thriving in various disciplines: - Bioinformatics the Bioconductor collection contains many API packages - rOpenSci: R tools for open science-related APIs - rOpenHealth: R tools for open

Re: [R] Mean of colMeans

2014-05-21 Thread Boris Steipe
Not necessarily. Missing values may base the means on unequal numbers of observation: x - c(1,1,1,2,NA,2) dim(x) - c(3,2) cM - colMeans(x, na.rm = TRUE, dims = 1) mean(cM) mean(x, na.rm = TRUE) B. On 2014-05-21, at 3:38 PM, Frede Aakmann Tøgersen wrote: Hhhhmmhhhm, but is that not the

Re: [R] Voronoi-Diagrams in R

2014-05-21 Thread Rolf Turner
On 21/05/14 23:34, Raphael Päbst wrote: I believe you are right. A night of sleep has done wonders for my understanding of the problem. Oh sleep it is a gentle thing Beloved from pole to pole! Thank you for your patience and help! Patience? Moi? This must be some new use of the word

Re: [R] approxfun question

2014-05-21 Thread peter dalgaard
On 21 May 2014, at 22:31 , Helio Camargo heliocama...@gmail.com wrote: Sorry for the naive question, but is it actually possible do SEE the approximation function y=f(x) in any of the output options of approxfun? Yes and no... a - approxfun(x, y, rule = 2:1) a function (v) .approxfun(x,

Re: [R] Groupwise sum

2014-05-21 Thread Jim Lemon
On Wed, 21 May 2014 03:59:26 PM Anna Carter wrote: Dear R forum, I have following data.frame - my_dat = data.frame(sr = c(0,0,0,0, 1, 1, 1, 1, 2, 2, 2, 2), bond = c(A, B, B, B, A, B, B, B, A, B, B, B), cashflow = c(1000, 2000, 2000, 4000, 10, 200, 300, 100, 80, 40, 60, 120)) my_dat

Re: [R] Second axis on bottom of graph

2014-05-21 Thread Hurr
On the page listing all of the post topics and time last post it says that this topic has a post at 6:05 am today, but that post doesn't show up when I view this topic. There must be some kind of programming error. Hurr -- View this message in context:

[R] Sizeplot Legend

2014-05-21 Thread Liz Duermit
I'm using the sizeplot() function from the plotrix package to plot binomial data in which there are a number of repeated values. a portion of my data look like this: mortality = c(1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0) ww.max = c(4.0, 5.0,

Re: [R] Sizeplot Legend

2014-05-21 Thread Jim Lemon
On Wed, 21 May 2014 06:34:58 PM Liz Duermit wrote: I'm using the sizeplot() function from the plotrix package to plot binomial data in which there are a number of repeated values. a portion of my data look like this: mortality = c(1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0,

Re: [R] Second axis on bottom of graph

2014-05-21 Thread Sarah Goslee
Well, yes, and also a user error. On Wed, May 21, 2014 at 6:50 PM, Hurr hill0...@umn.edu wrote: On the page listing all of the post topics and time last post it says that this topic has a post at 6:05 am today, but that post doesn't show up when I view this topic. There must be some kind of

Re: [R] Groupwise sum

2014-05-21 Thread arun
Hi Anna, In addition, you may also try: library(data.table) dt1 - data.table(my_dat, key=c('sr', 'bond')) dt2 - dt1[,list(cashflow_total=sum(cashflow)), by=c('sr','bond')] A.K. On Wednesday, May 21, 2014 6:46 PM, Jim Lemon j...@bitwrit.com.au wrote: On Wed, 21 May 2014 03:59:26 PM Anna

Re: [R] Sizeplot Legend

2014-05-21 Thread Liz Duermit
Thanks Jim, that was a great help! On Wed, May 21, 2014 at 7:49 PM, Jim Lemon j...@bitwrit.com.au wrote: On Wed, 21 May 2014 06:34:58 PM Liz Duermit wrote: I'm using the sizeplot() function from the plotrix package to plot binomial data in which there are a number of repeated values.

Re: [R] Large matrices and pairs/ggpairs

2014-05-21 Thread Greg Snow
You can specify whatever plotting size you want for graphics devices, so for example you could send the plot to a pdf device set up as A0 or other poster size. Then you just have the challenge of finding a place to print it. The pairs2 function in the TeachingDemos package will create pairs like

Re: [R] approxfun question

2014-05-21 Thread Frede Aakmann Tøgersen
Like this: x - 1:10 y - rnorm(10) f - approxfun(x, y) f function (v) .approxfun(x, y, v, method, yleft, yright, f) bytecode: 0x0cd7a340 environment: 0x0cd79a38 Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling

[R-es] reshape2

2014-05-21 Thread Manuel Máquez
Hace tiempo tenía la intención de convertir la salida de sink() en formato ancho; ya Javier Marcuzzi me hizo favor de sugerir el paquete reshape2, pero no lo había hecho, y ahora, no encuentro lo que me falta o lo que hice mal. Antecedentes a) uso R 3.0.3 en W7 b) para entrenarme tome como