Re: [R] plot discrete time series against time

2013-07-21 Thread Berend Hasselman

On 21-07-2013, at 06:51, shanxiao  wrote:

> Dear all, 
> 
> 
> 
> I try to plot some discrete time series data through time, of course I can
> achieve it by using the combination of some basic R functions, but it is not
> that convenient, does anyone know any R-inbuilt function to do it? Best. 
> 


Look at the examples of ts()

?ts

Berend
__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread Göran Broström

Uwe, thanks!

The switch from "Program" to "Program Files" made it (stupid Windows!).

I tried the "--library=." flag because I got the error message

path[2]="C:/Program/R/R-3.0.1/library": Access denied

without it, and naively thought that I had a permission problem.
This was strange, because I am the administrator of my Windows machines.

BTW, why can't I, as an administrator, install packages in

"C:\Program Files\R\R-3.0.1\library" ?

This is of course a very minor problem, since I never do anything useful 
on Windows machines.


Best,

Göran Broström

Uwe Ligges skrev 2013-07-21 00:51:



On 21.07.2013 00:26, Göran Broström wrote:

I am trying to build a Windows zip file of a private package by

C:/Program/R/R-3.0.1/bin/x64/Rcmd INSTALL --build --library=.
epigen_0.1.tar.gz


Why --library=. ?
Do you have appropriate poermissions to do that? In this case, you need
to start everything with admin priviliges explicitly unless your Windows
is configured differently.




but I get errors like

1: package 'datasets' in options("defaultPackages") was not found

and, finally,

Error in normalsizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/Program/R/R-3.0.1/library/tools": Atkomst nekad
(Access denied)

This is on a Swedish version of Windows 7. I noticed that the R
installer called the installation directory "Program Files" instead of
"Program" (despite my effort to change it), so I tried the same thing


But there is "Program Files", "Program" is just something like a link
shown by the Windows Explorer that actually points to "Program Files".




with an English version of Windows 7 (on another machine), and there
everything went as expected.

I installed R on both machines today so the setups should be identical,
except for the languages. What can be wrong? Can it be a language/path
thing?


Probably not the language but different admin settings.

Best,
Uwe Ligges



Thanks for any insight!

Göran Broström

__
R-help@r-project.org 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-contained, reproducible code.


__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread Rolf Turner

On 21/07/13 20:50, Göran Broström wrote:


Uwe, thanks!

The switch from "Program" to "Program Files" made it (stupid Windows!).




BTW, why can't I, as an administrator, install packages in

"C:\Program Files\R\R-3.0.1\library" ?

This is of course a very minor problem, since I never do anything 
useful on Windows machines.


Fortune candidate?

cheers,

Rolf Turner

__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread Uwe Ligges



On 21.07.2013 10:50, Göran Broström wrote:

Uwe, thanks!

The switch from "Program" to "Program Files" made it (stupid Windows!).

I tried the "--library=." flag because I got the error message

path[2]="C:/Program/R/R-3.0.1/library": Access denied

without it, and naively thought that I had a permission problem.
This was strange, because I am the administrator of my Windows machines.

BTW, why can't I, as an administrator, install packages in

"C:\Program Files\R\R-3.0.1\library" ?



Because you started R with standard privileges? Right click on R and 
then tell Windows to start R as an administrator. That should fix your 
problems.


Best,
Uwe Ligges


This is of course a very minor problem, since I never do anything useful
on Windows machines.

Best,

Göran Broström

Uwe Ligges skrev 2013-07-21 00:51:



On 21.07.2013 00:26, Göran Broström wrote:

I am trying to build a Windows zip file of a private package by

C:/Program/R/R-3.0.1/bin/x64/Rcmd INSTALL --build --library=.
epigen_0.1.tar.gz


Why --library=. ?
Do you have appropriate poermissions to do that? In this case, you need
to start everything with admin priviliges explicitly unless your Windows
is configured differently.




but I get errors like

1: package 'datasets' in options("defaultPackages") was not found

and, finally,

Error in normalsizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/Program/R/R-3.0.1/library/tools": Atkomst nekad
(Access denied)

This is on a Swedish version of Windows 7. I noticed that the R
installer called the installation directory "Program Files" instead of
"Program" (despite my effort to change it), so I tried the same thing


But there is "Program Files", "Program" is just something like a link
shown by the Windows Explorer that actually points to "Program Files".




with an English version of Windows 7 (on another machine), and there
everything went as expected.

I installed R on both machines today so the setups should be identical,
except for the languages. What can be wrong? Can it be a language/path
thing?


Probably not the language but different admin settings.

Best,
Uwe Ligges



Thanks for any insight!

Göran Broström

__
R-help@r-project.org 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-contained, reproducible code.


__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] BH correction with p.adjust

2013-07-21 Thread Scott Robinson
My understanding was that the vector was ranked, the adjusted p vector was 
calculated and then the vector is returned to the original order - I came 
across a stack overflow answer saying this:

http://stackoverflow.com/questions/10323817/r-unexpected-results-from-p-adjust-fdr

Although the code there does not appear to be the same as when I type 
"p.adjust" into the command line. The order shouldn't matter anyway since my 
data was ordered by p.

Yesterday I tried a short example of 5 numbers and it seemed to work out though 
today I tried to do another short example to demonstrate that the order in the 
p vector you input doesn't matter but didn't quite get a working example this 
time. Maybe due to a rounding to first significant figure or something?

> smallP <- c(0.01, 0.5, 0.0001)
> names(smallP) <- c("first", "second", "last")
> 
> p.adjust(smallP)
 first second   last 
 2e-02  5e-01  3e-04 
> 
> 0.01*3/2
[1] 0.015
> 0.5*3/3
[1] 0.5
> 0.0001*3/1
[1] 3e-04

In any case I reconstructed a large example which can be run without real data 
where the figure is way off and definitely not the result of a rounding error:

> exampleP <- seq(from=0.001, to=0.1, by=0.0001)
> length(exampleP)
[1] 991
> 
> examplePBH <- p.adjust(exampleP, method="BH")
> 
> exampleP[1]
[1] 1e-07
> 
> examplePBH[1]
[1] 0.1
> 
> exampleP[1]*length(exampleP)/1
[1] 0.991

Any help with this would be very much appreciated. It seems like it ought to be 
such a simple and commonly used method and yet I am struggling and not sure 
what to do about it.

Thanks,

Scott


From: David Winsemius [dwinsem...@comcast.net]
Sent: 21 July 2013 03:33
To: Scott Robinson
Cc: r-help@r-project.org
Subject: Re: [R] BH correction with p.adjust

On Jul 20, 2013, at 10:37 AM, Scott Robinson wrote:

> Dear List,
>
> I have been trying to use p.adjust() to do BH multiple test correction and 
> have gotten some unexpected results. I thought that the equation for this was:
>
> pBH = p*n/i

Looking at the code for `p.adjust`, you see that the method is picked from a 
switch function

lp <- length(p)
BH = {
i <- lp:1L
o <- order(p, decreasing = TRUE)
ro <- order(o)
pmin(1, cummin(n/i * p[o]))[ro]
}

You may not have sorted the p-values in pList.


>
> where p is the original p value, n is the number of tests and i is the rank 
> of the p value. However when I try and recreate the corrected p from my most 
> significant value it does not match up to the one computed by the method 
> p.adjust:
>
>> setwd("C:/work/Methylation/IMA/GM/siteLists")
>>
>> hypTable <- read.delim("hypernormal vs others.txt")
>> pList <- hypTable$p
>> names(pList) <- hypTable$site
>>
>> adjusted <- p.adjust(pList, method="BH")
>> adjusted[1]
> cg27433479
> 0.05030589
>>
>> pList[1]*nrow(hypTable)/1
> cg27433479
> 0.09269194
>

No data provided, so unable to pursue this further.

> I tried to recreate this is a small example of a vector of 5 p values but 
> everything worked as expected there. I was wondering if there is some subtle 
> difference about how p.adjust operates? Is there something more complicated 
> about how to calculate 'n' or 'i' - perhaps due to identical p values being 
> assigned the same rank or something? Does anyone have an idea what might be 
> going on here?


--

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread Göran Broström



On 07/21/2013 12:27 PM, Uwe Ligges wrote:



On 21.07.2013 10:50, Göran Broström wrote:

Uwe, thanks!

The switch from "Program" to "Program Files" made it (stupid Windows!).

I tried the "--library=." flag because I got the error message

path[2]="C:/Program/R/R-3.0.1/library": Access denied

without it, and naively thought that I had a permission problem.
This was strange, because I am the administrator of my Windows machines.

BTW, why can't I, as an administrator, install packages in

"C:\Program Files\R\R-3.0.1\library" ?



Because you started R with standard privileges? Right click on R and
then tell Windows to start R as an administrator. That should fix your
problems.


Thanks again; didn't know that either! Always fun to learn new things.

Best,

Göran Broström



Best,
Uwe Ligges


This is of course a very minor problem, since I never do anything useful
on Windows machines.

Best,

Göran Broström

Uwe Ligges skrev 2013-07-21 00:51:



On 21.07.2013 00:26, Göran Broström wrote:

I am trying to build a Windows zip file of a private package by

C:/Program/R/R-3.0.1/bin/x64/Rcmd INSTALL --build --library=.
epigen_0.1.tar.gz


Why --library=. ?
Do you have appropriate poermissions to do that? In this case, you need
to start everything with admin priviliges explicitly unless your Windows
is configured differently.




but I get errors like

1: package 'datasets' in options("defaultPackages") was not found

and, finally,

Error in normalsizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/Program/R/R-3.0.1/library/tools": Atkomst nekad
(Access denied)

This is on a Swedish version of Windows 7. I noticed that the R
installer called the installation directory "Program Files" instead of
"Program" (despite my effort to change it), so I tried the same thing


But there is "Program Files", "Program" is just something like a link
shown by the Windows Explorer that actually points to "Program Files".




with an English version of Windows 7 (on another machine), and there
everything went as expected.

I installed R on both machines today so the setups should be identical,
except for the languages. What can be wrong? Can it be a language/path
thing?


Probably not the language but different admin settings.

Best,
Uwe Ligges



Thanks for any insight!

Göran Broström

__
R-help@r-project.org 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-contained, reproducible code.


__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] BH correction with p.adjust

2013-07-21 Thread peter dalgaard

On Jul 21, 2013, at 15:02 , Scott Robinson wrote:

> My understanding was that the vector was ranked, the adjusted p vector was 
> calculated and then the vector is returned to the original order - I came 
> across a stack overflow answer saying this:
> 
> http://stackoverflow.com/questions/10323817/r-unexpected-results-from-p-adjust-fdr
> 
> Although the code there does not appear to be the same as when I type 
> "p.adjust" into the command line. The order shouldn't matter anyway since my 
> data was ordered by p.
> 
> Yesterday I tried a short example of 5 numbers and it seemed to work out 
> though today I tried to do another short example to demonstrate that the 
> order in the p vector you input doesn't matter but didn't quite get a working 
> example this time. Maybe due to a rounding to first significant figure or 
> something?
> 
>> smallP <- c(0.01, 0.5, 0.0001)
>> names(smallP) <- c("first", "second", "last")
>> 
>> p.adjust(smallP)
> first second   last 
> 2e-02  5e-01  3e-04 
>> 
>> 0.01*3/2
> [1] 0.015
>> 0.5*3/3
> [1] 0.5
>> 0.0001*3/1
> [1] 3e-04

Comparing the same method might help!

> p.adjust(smallP, method="BH")
[1] 0.0150 0.5000 0.0003


> 
> In any case I reconstructed a large example which can be run without real 
> data where the figure is way off and definitely not the result of a rounding 
> error:
> 
>> exampleP <- seq(from=0.001, to=0.1, by=0.0001)
>> length(exampleP)
> [1] 991
>> 
>> examplePBH <- p.adjust(exampleP, method="BH")
>> 
>> exampleP[1]
> [1] 1e-07
>> 
>> examplePBH[1]
> [1] 0.1
>> 
>> exampleP[1]*length(exampleP)/1
> [1] 0.991
> 
> Any help with this would be very much appreciated. It seems like it ought to 
> be such a simple and commonly used method and yet I am struggling and not 
> sure what to do about it.

You have the source code, how about reading it?

}, BH = {
i <- lp:1L
o <- order(p, decreasing = TRUE)
ro <- order(o)
pmin(1, cummin(n/i * p[o]))[ro]
}

Notice the cumulative minimum. The first element in n/i*p[o] is going to be 
p[n] == 0.1 (since your p is in ascending order). So no element of the result 
is going to be bigger than 0.1. (I presume this is because p-adjustments must 
be order-preserving.) 

> Thanks,
> 
> Scott
> 
> 
> From: David Winsemius [dwinsem...@comcast.net]
> Sent: 21 July 2013 03:33
> To: Scott Robinson
> Cc: r-help@r-project.org
> Subject: Re: [R] BH correction with p.adjust
> 
> On Jul 20, 2013, at 10:37 AM, Scott Robinson wrote:
> 
>> Dear List,
>> 
>> I have been trying to use p.adjust() to do BH multiple test correction and 
>> have gotten some unexpected results. I thought that the equation for this 
>> was:
>> 
>> pBH = p*n/i
> 
> Looking at the code for `p.adjust`, you see that the method is picked from a 
> switch function
> 
> lp <- length(p)
> BH = {
>i <- lp:1L
>o <- order(p, decreasing = TRUE)
>ro <- order(o)
>pmin(1, cummin(n/i * p[o]))[ro]
>}
> 
> You may not have sorted the p-values in pList.
> 
> 
>> 
>> where p is the original p value, n is the number of tests and i is the rank 
>> of the p value. However when I try and recreate the corrected p from my most 
>> significant value it does not match up to the one computed by the method 
>> p.adjust:
>> 
>>> setwd("C:/work/Methylation/IMA/GM/siteLists")
>>> 
>>> hypTable <- read.delim("hypernormal vs others.txt")
>>> pList <- hypTable$p
>>> names(pList) <- hypTable$site
>>> 
>>> adjusted <- p.adjust(pList, method="BH")
>>> adjusted[1]
>> cg27433479
>> 0.05030589
>>> 
>>> pList[1]*nrow(hypTable)/1
>> cg27433479
>> 0.09269194
>> 
> 
> No data provided, so unable to pursue this further.
> 
>> I tried to recreate this is a small example of a vector of 5 p values but 
>> everything worked as expected there. I was wondering if there is some subtle 
>> difference about how p.adjust operates? Is there something more complicated 
>> about how to calculate 'n' or 'i' - perhaps due to identical p values being 
>> assigned the same rank or something? Does anyone have an idea what might be 
>> going on here?
> 
> 
> --
> 
> David Winsemius
> Alameda, CA, USA
> 
> __
> R-help@r-project.org 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-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org 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-contained, reproducible code.


[R] Is there a limit on the number of code line in .Rhistory

2013-07-21 Thread Jun Shen
Dear list,

Just wonder if there is a limit on the number of code line in .Rhistory.
When I check the .Rhistory, some code I enter at earlier time disappeared.
If there is limit, how do I change it? Thanks.

Jun

[[alternative HTML version deleted]]

__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Is there a limit on the number of code line in .Rhistory

2013-07-21 Thread Berend Hasselman

On 21-07-2013, at 21:49, Jun Shen  wrote:

> Dear list,
> 
> Just wonder if there is a limit on the number of code line in .Rhistory.
> When I check the .Rhistory, some code I enter at earlier time disappeared.
> If there is limit, how do I change it? Thanks.
> 

?history

Read section details.

Berend

> Jun
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org 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-contained, reproducible code.

__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Different x-axis scales using c() in latticeExtra

2013-07-21 Thread Jeff Stevens
Many thanks, Felix.  Though, it seems like the x.same option should
allow this: "if TRUE, set the x scale relation to "same" and
recalculate panel limits using data from all panels. Otherwise, the x
scales in each panel will be as they were in the original objects (so
in general not the same), the default behaviour."  Or does this just
refer to different axis ranges on the same type of scale?

By the way, the grid.arrange feature from gridExtra seems to produce
the same output as plot.trellis using the split option.  Is there an
advantage to using grid.arrange over plot.trellis?  Also, do you have
pointers to documentation that would help me alter the plot.trellis
output to look more like the c() output (e.g., remove horizontal space
between plots and make sure plots have consistent widths?

Thanks,
Jeff

On Sat, Jul 20, 2013 at 6:45 PM, Felix Andrews  wrote:
> latticeExtra's c() can not combine logarithmic with linear x scales,
> I'm afraid.  I would recommend displaying each separate plot on one
> page using plot.trellis() or the gridExtra function that John Kane
> mentioned.
>
> Cheers
> Felix
>
>
> On 21 July 2013 02:50, David Winsemius  wrote:
>>
>> On Jul 19, 2013, at 8:18 PM, Jeff Stevens wrote:
>>
>>> Hi,
>>>
>>> I would like to combine multiple xyplots into a single, multipanel
>>> display.  Using R 3.0.1 in Ubuntu, I have used c() from latticeExtra
>>> to combine three plots, but the x-axis for two plots are on a log
>>> scale and the other is on a normal scale.  I also have included
>>> equispace.log=FALSE to clean up the tick labels.  However, when I try
>>> all of these, the x-axis scale of the first panel is used for all
>>> three.  How do I keep different scales for the different panels?
>>>
>>> Here is an example:
>>> library(lattice)
>>> library(latticeExtra)
>>> response <- c(76, 14, 15, 44, 26, 19, 74, 123, 49, 8, 56, 17, 18)
>>> predictor1 <- c(107, 7, 25, 501, 64, 88, 344, 367, 379, 10, 66, 31, 32)
>>> predictor2 <- c(10, 9, 8, 10, 29, 27, 55, 48, 2, 6, 14, 10, 5)
>>> predictor3 <- c(67, 22, 66, 41, 72, 64, 69, 63, 64, 70, 60, 75, 78)
>>>
>>> pred1_plot <- xyplot(response ~ predictor1, scales = list(log = TRUE,
>>> equispaced.log = FALSE),
>>>  panel = function(x, y, ...) {
>>>panel.xyplot(x, y, type = c("p", "r"), cex = 2)
>>>panel.text(x = log10(8), y = log10(120), labels = "(a)")
>>>  }
>>> )
>>>
>>> pred2_plot <- xyplot(response ~ predictor2, scales = list(log = TRUE,
>>> equispaced.log = FALSE),
>>>  panel = function(x, y, ...) {
>>>panel.xyplot(x, y, type = c("p", "r"), cex = 2)
>>>panel.text(x = log10(2), y = log10(120), labels = "(b)")
>>>  }
>>> )
>>>
>>> pred3_plot <- xyplot(response ~ predictor3, scales = list(y = list(log
>>> = TRUE, equispaced.log = FALSE)),
>>>  panel = function(x, y, ...) {
>>>panel.xyplot(x, y, type = c("p", "r"), cex = 2)
>>>panel.text(x = 22, y = log10(120), labels = "(c)")
>>>  }
>>> )
>>>
>>> all_plots <- c(pred1_plot, pred2_plot, pred3_plot, layout = c(3, 1), x.same 
>>> = F)
>>> update(all_plots, xlab=c("Predictor 1","Predictor 2", "Predictor 3"),
>>> scales = list(y=list(log=T, equispaced.log=FALSE), x = c(list(log=T,
>>> equispaced.log=FALSE), list(log=T, equispaced.log=FALSE),
>>> list(log=F
>>>
>>> update(all_plots, xlab=c("Predictor 1","Predictor 2", "Predictor 3"),
>>> scales = c(list(log = TRUE, equispaced.log = FALSE), list(log = TRUE,
>>> equispaced.log = FALSE), list(y=list(log=T, equispaced.log = FALSE
>>>
>>> Any help is appreciated!
>>
>> I assume there was a notice o your console that there were warnings, right? 
>> You should offer the full texts of warnings and error messages. Here the 
>> full text of the first and second warnings:
>>
>>> warnings()[1:2]
>> $`log scales cannot be changed via 'update'`
>> update.trellis(all_plots, xlab = c("Predictor 1", "Predictor 2",
>> "Predictor 3"), scales = c(list(log = TRUE, equispaced.log = FALSE),
>> list(log = TRUE, equispaced.log = FALSE), list(y = list(log = T,
>> equispaced.log = FALSE
>> $`'x' is NULL so the result will be NULL`
>> rep(scales[[nm]], length.out = 2)
>>
>> The first one is telling you why the results should be different than you 
>> expect. I'm not entirely sure what the second one is telling you, but it 
>> doesn't sound good.
>>
>> --
>> David Winsemius
>> Alameda, CA, USA
>>
>> __
>> R-help@r-project.org 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-contained, reproducible code.
>
>
>
> --
> Felix Andrews / 安福立
> http://www.neurofractal.org/felix/

__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Different x-axis scales using c() in latticeExtra

2013-07-21 Thread Jeff Stevens
Thanks, David.  The warnings occur after the true problem of trying to
plot the three graphs with different scales.  I should have stopped
the example after assigning all_plots <- c(...), then plotted it (and
left out the update statements).  If you do this, the x-axes do not
maintain their scales.

But I take your point that I should have paid more attention to the warnings!

Thanks,
Jeff



On Sat, Jul 20, 2013 at 11:50 AM, David Winsemius
 wrote:
>
> On Jul 19, 2013, at 8:18 PM, Jeff Stevens wrote:
>
>> Hi,
>>
>> I would like to combine multiple xyplots into a single, multipanel
>> display.  Using R 3.0.1 in Ubuntu, I have used c() from latticeExtra
>> to combine three plots, but the x-axis for two plots are on a log
>> scale and the other is on a normal scale.  I also have included
>> equispace.log=FALSE to clean up the tick labels.  However, when I try
>> all of these, the x-axis scale of the first panel is used for all
>> three.  How do I keep different scales for the different panels?
>>
>> Here is an example:
>> library(lattice)
>> library(latticeExtra)
>> response <- c(76, 14, 15, 44, 26, 19, 74, 123, 49, 8, 56, 17, 18)
>> predictor1 <- c(107, 7, 25, 501, 64, 88, 344, 367, 379, 10, 66, 31, 32)
>> predictor2 <- c(10, 9, 8, 10, 29, 27, 55, 48, 2, 6, 14, 10, 5)
>> predictor3 <- c(67, 22, 66, 41, 72, 64, 69, 63, 64, 70, 60, 75, 78)
>>
>> pred1_plot <- xyplot(response ~ predictor1, scales = list(log = TRUE,
>> equispaced.log = FALSE),
>>  panel = function(x, y, ...) {
>>panel.xyplot(x, y, type = c("p", "r"), cex = 2)
>>panel.text(x = log10(8), y = log10(120), labels = "(a)")
>>  }
>> )
>>
>> pred2_plot <- xyplot(response ~ predictor2, scales = list(log = TRUE,
>> equispaced.log = FALSE),
>>  panel = function(x, y, ...) {
>>panel.xyplot(x, y, type = c("p", "r"), cex = 2)
>>panel.text(x = log10(2), y = log10(120), labels = "(b)")
>>  }
>> )
>>
>> pred3_plot <- xyplot(response ~ predictor3, scales = list(y = list(log
>> = TRUE, equispaced.log = FALSE)),
>>  panel = function(x, y, ...) {
>>panel.xyplot(x, y, type = c("p", "r"), cex = 2)
>>panel.text(x = 22, y = log10(120), labels = "(c)")
>>  }
>> )
>>
>> all_plots <- c(pred1_plot, pred2_plot, pred3_plot, layout = c(3, 1), x.same 
>> = F)
>> update(all_plots, xlab=c("Predictor 1","Predictor 2", "Predictor 3"),
>> scales = list(y=list(log=T, equispaced.log=FALSE), x = c(list(log=T,
>> equispaced.log=FALSE), list(log=T, equispaced.log=FALSE),
>> list(log=F
>>
>> update(all_plots, xlab=c("Predictor 1","Predictor 2", "Predictor 3"),
>> scales = c(list(log = TRUE, equispaced.log = FALSE), list(log = TRUE,
>> equispaced.log = FALSE), list(y=list(log=T, equispaced.log = FALSE
>>
>> Any help is appreciated!
>
> I assume there was a notice o your console that there were warnings, right? 
> You should offer the full texts of warnings and error messages. Here the full 
> text of the first and second warnings:
>
>> warnings()[1:2]
> $`log scales cannot be changed via 'update'`
> update.trellis(all_plots, xlab = c("Predictor 1", "Predictor 2",
> "Predictor 3"), scales = c(list(log = TRUE, equispaced.log = FALSE),
> list(log = TRUE, equispaced.log = FALSE), list(y = list(log = T,
> equispaced.log = FALSE
> $`'x' is NULL so the result will be NULL`
> rep(scales[[nm]], length.out = 2)
>
> The first one is telling you why the results should be different than you 
> expect. I'm not entirely sure what the second one is telling you, but it 
> doesn't sound good.
>
> --
> David Winsemius
> Alameda, CA, USA
>

__
R-help@r-project.org 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-contained, reproducible code.


Re: [R] Windows 7 (Swedish): 'Rcmd INSTALL' fails (SOLVED)

2013-07-21 Thread jwd
On Sun, 21 Jul 2013 21:16:54 +1200
Rolf Turner  wrote:

...
> > "C:\Program Files\R\R-3.0.1\library" ?
> >
> > This is of course a very minor problem, since I never do anything 
> > useful on Windows machines.
> 
> Fortune candidate?
> 
Seconded.

JWDougherty

__
R-help@r-project.org 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-contained, reproducible code.


[R] problem loading large xlsx file into r

2013-07-21 Thread S N V Krishna
Hi,

I am facing trouble when trying to read large xlsx file into R. please find the 
code and error below. The file I was trying to read has 36,500 rows X 188 col, 
~ 37 MB size.

> options( java.parameters = "-Xmx4g" )

> library(xlsx)
Loading required package: xlsxjars
Loading required package: rJava

> cftc = read.xlsx("d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx", 1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  java.lang.OutOfMemoryError: Java heap space

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] xlsx_0.5.1 xlsxjars_0.5.0 rJava_0.9-5

Many thanks for the help and guidance.

Regards,

Krishna

[[alternative HTML version deleted]]

__
R-help@r-project.org 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-contained, reproducible code.


[R] clust algorithm for interval-typed data

2013-07-21 Thread Cheng, Yi
Hi:

I am looking for clust algorithms for interval-typed data. (for example, the 
session data with start time and end time).

I can't find it.

Please help to point me to any existing.

Cheng Yi

[[alternative HTML version deleted]]

__
R-help@r-project.org 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-contained, reproducible code.


[R] Some doubts on the application of RHadoop

2013-07-21 Thread xl Liang
Hi everyone, I am new to R , I have some doubts about RHadoop. Can  the
classification algorithms or data mining algorithms be used in the Rhadoop
as well as it used in R? If so, are there some different usages in
the achitecture of code? Are there some reference books or website listed
some examples for me to learn how to use such kind of algorithms on RHadoop?

[[alternative HTML version deleted]]

__
R-help@r-project.org 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-contained, reproducible code.


[R] about mix type clust algorithm

2013-07-21 Thread Cheng, Yi
Hi:
I have tried to find the appropriate clust algorithm for mixed type of data.
The suggested way I see is:

1.   use daisy to get the dissimilarity matrix

2.   use PAM/hclust by providing the dissimilarity matrix, to get the 
clusters
but by following this, when the data set grows bigger say 10,000 rows of data, 
the dissimilarity matrix will be O(n^2), and out of memory will occur.
I am wondering is there any better ways to do the mixed type cluster?

Cheng Yi


[[alternative HTML version deleted]]

__
R-help@r-project.org 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-contained, reproducible code.