ce | 21 Dec 06:09 2014

How to create a time series object with time only (no date)

Dear all,

I want to create a time series object from 00:00:00 to 23:59:00 without dates ?
I can't figure it out with xts ?


varin sacha | 20 Dec 21:36 2014

Bca confidence intervals for Pearson coefficient, thanks.

Hi to everyone,
I am trying to calculate the Bca bootstrap confidence intervals for the Pearson coefficient.
x=Dataset$math.testy=Dataset$geo.testcor(x,y,method="pearson")[1] 0.6983799
boot.ci(cor, conf=0.95, type=bca)Erreur dans boot.out$t0 : objet de type 'closure' non indiçable

I have tried as well to calculate the Pearson coefficient using bootstrap and then to calculate the Bca
bootstrap CIs of the Pearson. It doesn't work either. 
boot(data = cbind(x, y), statistic = cor, R = 200)


boot(data = cbind(x, y), statistic = cor, R = 200)

Bootstrap Statistics :
      original    bias    std. error
t1* -0.6243713 0.6295142   0.2506267
t2* -0.1366533 0.1565392   0.2579134
> boot.ci(cor, conf=0.95, type=bca)
Erreur dans boot.out$t0 : objet de type 'closure' non indiçable
Many thanks to tell me how to correct my R script to get the Bca CIs for my Pearson coefficient. Best regards,
looking forward to reading you,

	[[alternative HTML version deleted]]

R-help <at> r-project.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
(Continue reading)

Ryan Derickson | 20 Dec 16:29 2014

Specifying plot area in dotchart2


I'm producing multiple dotcharts and I want each plotting area (the area
containing the dots only- not the labels) to be the same width. Currently,
the width of the area depends on the length of the labels. I've tried
different margin arguments but they change the parameter of the whole plot
(dots + labels) rather than just the dot area.

A reproducible example is below; I want the dot area to be the same
physical width across charts regardless of the label width. Any suggestions
would be greatly appreciated!

Ryan Derickson

pdf("dotchart2 demo.pdf")

# This plot width is wider

par(omi=c(0, 2, 0, 0), mar=c(2,4,1,1))

num<-rnorm(40, 0, 1)


dat<-data.frame(num, lab)

(Continue reading)

Ben Marwick | 19 Dec 23:48 2014

where are the NEWS for R <3.0.0?

I'm looking for the NEWS files for versions of R before 3.0.0, does 
anyone know where they are? I'm interested in getting the names of 
people who have been acknowledged when changes are made to R.

At the bottom of http://cran.r-project.org/src/base/NEWS.html it says

"Older news can be found in text format in files NEWS.0, NEWS.1 and 
NEWS.2 in the ‘doc’ directory. News in HTML format for R versions from 
2.10.0 to 2.15.3 is in NEWS.2.html."

The text includes these URLs:


All of these go to 404s, and when src is replaced by doc, as suggested 
by the text, they also go to 404s. There are no NEWS files in here 
either: http://cran.r-project.org/doc/html/ So there are a bunch of 
broken links here.

I found a bunch of PDFs listed here http://cran.r-project.org/doc/Rnews/ 
dating from 2008-2001. Are these only source of the earlier NEWS files?

They're less convenient because the NEWS section is not a single plain 
text file, but a section of the PDF document. I'd be most grateful to 
know where I can find html or txt files of the earlier NEWS files. If 
the PDFs are all there are, it would be good to know that for sure.

(Continue reading)

Esra Ulasan | 20 Dec 05:26 2014

non negativity constraints if else function


I have tried the solve the non-negativity constraint "if else function" in R. But I have done something
wrong because it still gives the same solution. I want that, if weight element is negative set it to zero,
else recalculate the weights again. These are the codes:

 for(i in 1:M){ w[,i] = f+r[i]*g              #portfolio weights 
    for(i in 1:M){
      if (w <0){w=0}else{w=w}
If you help me I would be happy
Thank you
	[[alternative HTML version deleted]]

Esra Ulasan | 20 Dec 04:21 2014

short-sale constraint with nonpositive-definite matrix in portfolio optimization


I want to ask about portfolio optimization in R. I have a nonpositive-definite matrix. I have handled with
the singularity. Unfortunately, quadprog etc. optimization packages fail to solve the optimization
problem under the constraints. Because these packages takes the covariance matrix as an input. But I have
inverted matrix and I want to use it as an input under the non-negativity constraint (short sale
prohibited). It is hard to solve with lagrange because of non-negativity constraint. Which method
should I use? If you help me, I would be very happy..

Thank you.
Jane Synnergren | 19 Dec 22:56 2014

how update to latest version of R on mac

I get following error when trying to update the affy package to latest

Error: cannot remove prior installation of package Œaffy¹

I think it is because affy requires R 3.1.1 and I have 3.0.2

I try to find a guide how I do to upgrade from 3.0.2 to latest version on
mac, but cannot find any good description. Can anyone guide me?

Do I just download R for mac (R-3.1.2-snowleopard.pkg) from
<http://ftp.sunet.se/pub/lang/CRAN/bin/macosx/R-3.1.2-snowleopard.pkg> and

What will happen with all installed packages?
I have OS X Lion 10.7.5
Which version number is stable and reliable?

I also need a guide of how to update to latest version of  bioconductor on

Descriptions for windows is available everywhere.


Jane Synnergren, PhD
Systems Biology Research Center
(Continue reading)

Ragia Ibrahim | 20 Dec 16:58 2014

list of lists, is this element empty

Kindly I have a list of lists as follow
[1] 7

[1] 3 4 5

as showen x[[3]] does not have a value and it has NULL, how can I check on this 
how to test if x[[3]] is empty.

thanks in advance
	[[alternative HTML version deleted]]

Chel Hee Lee | 20 Dec 15:41 2014

Re: How to make Pivot table with two variables in R?

You are welcome, I am glad that I was able to help.

Chel Hee Lee, PhD
Biostatistician and Manager
Clinical Research Support Unit
College of Medicine
University of Saskatchewan

On 12/20/2014 03:53 AM, Kristi Glover wrote:
> Thank you Prof. Lee for your code. I am sorry that I noticed that I sent the email in Httml format and realized
that it was almost impossible to read it. However, you gave an effort to help me. Now I changed the format.
> I really appreciated for your help. It seems the code you wrote works for me.
> Sincerely,
> KG
> ----------------------------------------
>> Date: Sat, 20 Dec 2014 00:09:21 -0600
>> From: chl948 <at> mail.usask.ca
>> Subject: Re: [R] How to make Pivot table with two variables in R?
>> To: kristi.glover <at> hotmail.com; r-help <at> r-project.org
>>> x <- dat
>>> x$time <- as.factor(as.Date(x$time, format="%Y-%B%d"))
>>> tmp <- split(x, x$tag)
>>> tmp1 <- do.call(rbind, lapply(tmp, function(x){
>> + tb <- table(x$time)
>> + idx <- which(tb>0)
>> + tb1 <- replace(tb, idx, as.character(x$states))
(Continue reading)

Kristi Glover | 20 Dec 05:45 2014

How to make Pivot table with two variables in R?

Hi R User, Would you suggest me on how I can build a pivot table using two variables? I want to put "text" in the
table instead of value.  I have attached an example data and the type of table (FinalTable) I was looking
for. I am looking for your suggestions. ThanksKG=====dat<-structure(list(tag = structure(c(1L, 1L,
1L, 2L, 3L, 4L, 5L, 6L, 6L, 7L, 7L, 8L), .Label = c("x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8"), class =
"factor"), time = structure(c(1L, 2L, 3L, 1L, 4L, 5L, 5L, 5L, 8L, 4L, 7L, 6L), .Label = c("2010-May 27",
"2011-June 27", "2011-June 28", "2012-June 25", "2013-June 21", "2014-Jan 05", "2014-July 27",
"2015-April 07"), class = "factor"),     states = structure(c(1L, 2L, 2L, 1L, 4L, 3L, 2L, 5L, 1L,     3L, 5L, 2L),
.Label = c("A", "B", "C", "D", "Out"), class = "factor"))
 , .Names = c("tag", "time", "states"), class = "data.frame", row.names = c(NA, -12L))
dat###table(dat$tag,dat$time)# it gives value but I want the name of the states in the table instead of
value.#For examplefinalTable<-structure(list(tag = structure(1:8, .Label = c("x1", "x2", "x3",
"x4", "x5", "x6", "x7", "x8"), class = "factor"), X2010.May.27 = structure(c(2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("0", "A"), class = "factor"),     X2011.June.27 = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L    ),
.Label = c("0", "B"), class = "factor"), X2011.June.28 = structure(c(2L,     1L, 1L, 1L, 1L, 1L, 1L, 1L),
.Label = c("0", "B"), class = "factor"),     X2012.June.25 = structure(c(1L, 1L, 3L, 1L, 1L, 1L, 2L, 1L    ),
.Label = c("0", "C", "D"), class = "factor"), X2013.June.21 = structure(c(1L,     1L, 1L, 3L, 2L, 4L, 1L, 1L),
.Label = c("0", "B", "C", "Out"    ), class = "factor"
 ), X2014.Jan.05 = structure(c(1L, 1L,     1L, 1L, 1L, 1L, 1L, 2L), .Label = c("0", "B"), class = "factor"),    
X2014.July.27 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L    ), .Label = c("!
 0", "Out"), class = "factor"), X2015.April.07 = c(0L,     0L, 0L, 0L, 0L, 1L, 0L, 0L)), .Names = c("tag",
"X2010.May.27", "X2011.June.27", "X2011.June.28", "X2012.June.25", "X2013.June.21",
"X2014.Jan.05", "X2014.July.27", "X2015.April.07"), class = "data.frame", row.names = c(NA,-8L))
#How is it possible to get the finalTable as shown above?Any suggestions? 		 	   		  
	[[alternative HTML version deleted]]

John Kane | 19 Dec 17:48 2014

Re: Calculating mean, median, minimum, and maximum

It looks like you are replying to some phantom. Is your correspondent actully on R-help?

John Kane
Kingston ON Canada

> -----Original Message-----
> From: mtrang <at> buffalo.edu
> Sent: Fri, 19 Dec 2014 08:08:29 -0800 (PST)
> To: r-help <at> r-project.org
> Subject: Re: [R] Calculating mean, median, minimum, and maximum
> You can use the apply function which "applies" a function of your choice,
> and
> MARGIN = 2 means you want to do it columnwise:
>> apply(X = df, MARGIN=2, FUN = mean, na.rm = TRUE)
>  Latitude Longitude   January  February     March     April       May
> June
>   26.9380 -109.8125  159.8454  156.4489  153.6911  150.1719  148.0885
> 149.2365
>> apply(X = df, MARGIN=2, FUN = min, na.rm = TRUE)
>  Latitude Longitude   January  February     March     April       May
> June
>    26.938  -110.688   121.204   118.713   117.293   114.398   112.357
> 113.910
>> apply(X = df, MARGIN=2, FUN = max, na.rm = TRUE)
>  Latitude Longitude   January  February     March     April       May
> June
>    26.938  -108.938   252.890   248.991   244.870   241.194   239.615
(Continue reading)