Re: [R] make hyperlink in R

2013-05-08 Thread David Winsemius

On May 7, 2013, at 11:15 PM, Bill Hyman wrote:

> Dear all,
> 
> Does anybody know how to make hyperlink in R? If I want to output 
> "http://www.r-project.org/"; with hyperlink, how can I do with plain text 
> 'http://www.r-project.org/'? 

I don't see any characters that need escaping. What are you really asking? What 
sort of "output" are you expecting? Maybe you should be looking at:

?connections

-- 

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] How can I find negative items from a vector with a short command?

2013-05-08 Thread jpm miao
Thanks, but why does  f[f=4] yield 16 instead of 4?

> f
[1]   -24   -8   16  -32   64 -128
> f[f<0]
[1]   -2   -8  -32 -128
> f[f>0]
[1]  4 16 64
> f[f=4]
[1] 16


2013/5/8 Jorge I Velez 

> f [ f < 0 ]
>
>
> On Wed, May 8, 2013 at 11:54 AM, jpm miao  wrote:
>
>> Hi,
>>
>>I have a vector f with some negative columns. I remember that there is
>> an easy expression that can find out negative items. Can someone tell me
>> how I can do it?
>>
>>It seems to be
>>f[i such that f[i]<0 ...]
>>
>>Thanks,
>>
>> Miao
>>
>> > d<-1:7
>> > f<-(-2)^d
>> > f
>> [1]   -24   -8   16  -32   64 -128
>>
>> [[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.
>>
>
>

[[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] How can I find negative items from a vector with a short command?

2013-05-08 Thread jpm miao
Sorry. I just got it

> f[f==4]
[1] 4


2013/5/8 jpm miao 

> Thanks, but why does  f[f=4] yield 16 instead of 4?
>
> > f
> [1]   -24   -8   16  -32   64 -128
> > f[f<0]
> [1]   -2   -8  -32 -128
> > f[f>0]
> [1]  4 16 64
> > f[f=4]
> [1] 16
>
>
> 2013/5/8 Jorge I Velez 
>
>> f [ f < 0 ]
>>
>>
>> On Wed, May 8, 2013 at 11:54 AM, jpm miao  wrote:
>>
>>> Hi,
>>>
>>>I have a vector f with some negative columns. I remember that there is
>>> an easy expression that can find out negative items. Can someone tell me
>>> how I can do it?
>>>
>>>It seems to be
>>>f[i such that f[i]<0 ...]
>>>
>>>Thanks,
>>>
>>> Miao
>>>
>>> > d<-1:7
>>> > f<-(-2)^d
>>> > f
>>> [1]   -24   -8   16  -32   64 -128
>>>
>>> [[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.
>>>
>>
>>
>

[[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] How can I find negative items from a vector with a short command?

2013-05-08 Thread Jorge I Velez
Check

?"=="

and try

f[f == 4]

More in section 2.4 at http://cran.r-project.org/doc/manuals/R-intro.pdf


On Wed, May 8, 2013 at 5:14 PM, jpm miao  wrote:

> Thanks, but why does  f[f=4] yield 16 instead of 4?
>
> > f
> [1]   -24   -8   16  -32   64 -128
> > f[f<0]
> [1]   -2   -8  -32 -128
> > f[f>0]
> [1]  4 16 64
> > f[f=4]
> [1] 16
>
>
> 2013/5/8 Jorge I Velez 
>
>> f [ f < 0 ]
>>
>>
>> On Wed, May 8, 2013 at 11:54 AM, jpm miao  wrote:
>>
>>> Hi,
>>>
>>>I have a vector f with some negative columns. I remember that there is
>>> an easy expression that can find out negative items. Can someone tell me
>>> how I can do it?
>>>
>>>It seems to be
>>>f[i such that f[i]<0 ...]
>>>
>>>Thanks,
>>>
>>> Miao
>>>
>>> > d<-1:7
>>> > f<-(-2)^d
>>> > f
>>> [1]   -24   -8   16  -32   64 -128
>>>
>>> [[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.
>>>
>>
>>
>

[[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] Calculates the mean/median from grouped data in R?

2013-05-08 Thread Nuri Jazairi


see if this helps:

library(actuar)
data(gdental)# grouped data
quantile(gdental)
mean(gdental)

Nuri

On Wed, 8 May 2013, jpm miao wrote:


Is there a function in R that calculate the mean and median for a grouped
data?
For example, a survey shows the oil price outlook in the future. How can I
calculate the mean/median?
(Of course, I understand that the groups "below 80" and "above 110" must be
defined more specifically)

 below 80 4  80-90 5  90-100 8  100-110 7  above 110 3

[[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.


[R] Parsing XML to tree.

2013-05-08 Thread avinash sahu
Hi All,

I am struggling to parse a XML file that describes a tree. The XML file is
present here:
http://www.emouseatlas.org/emap/ema/theiler_stages/StageDefinition/Stage_xml/TS23.xml
I want is simple list of parents id of each component. The output will look
like
Component = [7148  7149   7150   7151. 7177..]
Parents=[NA   7148   7149  7150  7148..]
I meant if components are arranged from 7148 to 8419, I need their parents
id.

I hope this is clear.
thanks
avi

[[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] Fitting AR(p) model

2013-05-08 Thread Preetam Pal
Hi all,

I am trying to fit an AR(p) model to my variable res

ar=ar(res, method="yule-walker")

The output is :

Order selected 0  sigma^2 estimated as  5.87e-06

Does this mean that the optimum value of p is 0?

But when I go for  summary(ar),

I get the following:

order   1 -none- numeric
ar   0 -none- numeric
var.pred1 -none- numeric
x.mean  1 -none- numeric
aic13 -none- numeric
n.used  1 -none- numeric
order.max   1 -none- numeric
partialacf 12 -none- numeric
resid  17 -none- numeric
method  1 -none- character
series  1 -none- character
frequency   1 -none- numeric
call2 -none- call


The confusion is : in the 1st line, order=1 is being shown, and ar is being
shown as 0 in the 2nd line.
This means that the variable res is AR with order 1 , but coefficient of
the lag variable is 0. I am confused!
In this context, how do I interpret the initial output  which said "order
selected 0".



Any help is appreciated.


Thanks,
Preetam







-- 
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division,   C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.

[[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] Fitting AR(p) model

2013-05-08 Thread Pascal Oettli

Hello,

You forgot the column names. The output is:

  Length Class  Mode
order   1 -none- numeric
ar   0 -none- numeric
var.pred1 -none- numeric
x.mean  1 -none- numeric
aic13 -none- numeric
n.used  1 -none- numeric
order.max   1 -none- numeric
partialacf 12 -none- numeric
resid  17 -none- numeric
method  1 -none- character
series  1 -none- character
frequency   1 -none- numeric
call2 -none- call

So the "1" for "order" is referring to the _length_ of "order", not to 
the _value_ of "order".


Hope this helps,
Pascal


On 05/08/2013 04:49 PM, Preetam Pal wrote:

Hi all,

I am trying to fit an AR(p) model to my variable res

ar=ar(res, method="yule-walker")

The output is :

Order selected 0  sigma^2 estimated as  5.87e-06

Does this mean that the optimum value of p is 0?

But when I go for  summary(ar),

I get the following:

order   1 -none- numeric
ar   0 -none- numeric
var.pred1 -none- numeric
x.mean  1 -none- numeric
aic13 -none- numeric
n.used  1 -none- numeric
order.max   1 -none- numeric
partialacf 12 -none- numeric
resid  17 -none- numeric
method  1 -none- character
series  1 -none- character
frequency   1 -none- numeric
call2 -none- call


The confusion is : in the 1st line, order=1 is being shown, and ar is being
shown as 0 in the 2nd line.
This means that the variable res is AR with order 1 , but coefficient of
the lag variable is 0. I am confused!
In this context, how do I interpret the initial output  which said "order
selected 0".



Any help is appreciated.


Thanks,
Preetam









__
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] R prints empty group on my figure!!

2013-05-08 Thread Adel ESSAFI
Hello list
I am trying to solve a problem when drawing a figure related to the
dataframe below.
I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2.
I use this commande to make it:

xyplot(cm[,6]~cm[,3],type="b",group=interaction(cm[,1],cm[,2],sep="/"),
auto.key =list( title="Makespan en fonction de beta", points = FALSE,
columns=2, lines = TRUE)
,data=cm,xlab=expression(beta),ylab="Ratio")

The problem is that, R puts (for example) the entry C/D in the legend,
however, I have no such entry. Note that R it does not draw a line for that
entry.

So, the question : how to do to remove the empty groups from the legend.

Cordially




> cm
   V1 V2  V3V4 V5   V6
1   C  L 0.0  732179.0 686983 1.065789
2   C  L 0.2  900956.4 686983 1.311468
3   C  L 0.4  964725.0 686983 1.404292
4   C  L 0.6 1017984.0 686983 1.481818
5   C  L 0.8 1064745.8 686983 1.549887
6   C  L 1.0 1107269.0 686983 1.611785
7   C  S 0.0  803926.0 686983 1.170227
8   C  S 0.2 1020492.0 686983 1.485469
9   C  S 0.4 1134818.0 686983 1.651887
10  C  S 0.6 1223596.0 686983 1.781115
11  C  S 0.8 1322548.8 686983 1.925155
12  C  S 1.0 1395714.0 686983 2.031657
13  I  L 0.0 2628113.0 686983 3.825587
14  I  L 0.2 2628113.0 686983 3.825587
15  I  L 0.4 2628113.0 686983 3.825587
16  I  L 0.6 2628113.0 686983 3.825587
17  I  L 0.8 2628113.0 686983 3.825587
18  I  L 1.0 2628113.0 686983 3.825587
19  I  S 0.0 2628113.0 686983 3.825587
20  I  S 0.2 2628113.0 686983 3.825587
21  I  S 0.4 2475448.0 686983 3.603361
22  I  S 0.6 2475448.0 686983 3.603361
23  I  S 0.8 2475448.0 686983 3.603361
24  I  S 1.0 2475448.0 686983 3.603361
25  I  F 0.0  871670.0 686983 1.268838
26  I  F 0.2 1066742.0 686983 1.552792
27  I  F 0.4 1136213.0 686983 1.653917
28  I  F 0.6 1210547.0 686983 1.762121
29  I  F 0.8 1256777.0 686983 1.829415
30  I  F 1.0 1304294.0 686983 1.898583
31  I  I 0.0  897718.0 686983 1.306754
32  I  I 0.2 1123968.0 686983 1.636093
33  I  I 0.4 1301097.0 686983 1.893929
34  I  I 0.6 1373663.0 686983 1.999559
35  I  I 0.8 1424121.0 686983 2.073008
36  I  I 1.0 1542813.0 686983 2.245780
37  I  D 0.0  937621.0 686983 1.364839
38  I  D 0.2 1205063.0 686983 1.754138
39  I  D 0.4 1341839.0 686983 1.953235
40  I  D 0.6 1431970.0 686983 2.084433
41  I  D 0.8 1538944.0 686983 2.240149
42  I  D 1.0 1670073.0 686983 2.431025
43  D  L 0.0  731904.0 686983 1.065389
44  D  L 0.2  900183.0 686983 1.310342
45  D  L 0.4  964870.1 686983 1.404504
46  D  L 0.6 1017462.8 686983 1.481060
47  D  L 0.8 1064435.2 686983 1.549435
48  D  L 1.0 1107595.0 686983 1.612260
49  D  S 0.0  798289.0 686983 1.162022
50  D  S 0.2 1014643.2 686983 1.476955
51  D  S 0.4 1125711.8 686983 1.638631
52  D  S 0.6 1220923.0 686983 1.777224
53  D  S 0.8 1306571.2 686983 1.901897
54  D  S 1.0 1399836.0 686983 2.037657
55  D  F 0.0  724924.0 686983 1.055229
56  D  F 0.2  935413.5 686983 1.361625
57  D  F 0.4 1011621.9 686983 1.472557
58  D  F 0.6 1071081.6 686983 1.559109
59  D  F 0.8 1139325.8 686983 1.658448
60  D  F 1.0 1181282.1 686983 1.719522
61  D  I 0.0  755841.0 686983 1.100232
62  D  I 0.2  964335.0 686983 1.403725
63  D  I 0.4 1051233.4 686983 1.530218
64  D  I 0.6 1110842.0 686983 1.616986
65  D  I 0.8 1193509.0 686983 1.737320
66  D  I 1.0 1264249.0 686983 1.840292
67  D  D 0.0  751660.0 686983 1.094146
68  D  D 0.2 1019735.0 686983 1.484367
69  D  D 0.4 1101191.0 686983 1.602938
70  D  D 0.6 1191547.0 686983 1.734464
71  D  D 0.8 1293433.0 686983 1.882773
72  D  D 1.0 1340360.0 686983 1.951082

[[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] R help for creating expression data of Differentially expressed genes

2013-05-08 Thread Vivek Das
Hi Arun,

 I am still facing trouble as I can see the data output is identical for
all rows when I am using this merge function. It seems that since in my
data2 which I have provided I have not given you the exact genes I have.
There are likely to be repeatations of ID in both the files but the problem
now is that when the loop is running for the merge on basis of ID it is
printing on the rows for which the ID's are repeated more than once and
which does not have any repeatations in the data.txt they are being
ignored. Say I had a locus XLOC_002126 which is the ID and its repeated for
10 times in the data1.txt so when my merging is taking place its only
working on those ID's which are repeated more than once in data1.txt and
merging them with their respective attributes. And this is happening for
the number of times it is being repeated in data1.txt and the next data on
which it merges is also the same for which in data1.txt we have more
repeats for ID. Here is an example of the output I am getting below.



  ID test_id gene locus Sample_118p_0 Sample_118rp3_0 Sample_118rz_0
Sample_118z_0 Sample_132p1_0 Sample_132p2_0 Sample_132p3_0 Sample_132rp1_0
Sample_132rp3_0 Sample_132rp4_0 Sample_132rz1_0 Sample_132rz2_0
Sample_132z_0 Sample_141p1_0 Sample_141p2_0 Sample_141p3_0 Sample_141p4_0
Sample_141z_0 Sample_183p1_0 Sample_183p2_0 Sample_183p3_0 Sample_183z_0
Sample_91p_0 Sample_91rp1_0 Sample_91rp3_0 Sample_91rp4_0 Sample_91rz_0
XLOC_002126 XLOC_002126 MPZ chr1:161274524-161279762 0.32181 0.333882
0.174569 0.29143 1.56295 1.67143 1.09774 0 0 0.0238811 0.0456828 0.0171938
0.597619 0.999418 0.675425 0.624723 1.023 0.361899 1.23395 1.80139 1.30457
0.692972 1.42658 1280.78 76.5147 4.67875 468.667  XLOC_002126 XLOC_002126
MPZ chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295
1.67143 1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:161274524-161279762 0.32181 0.333882 0.174569 0.29143 1.56295 1.67143
1.09774 0 0 0.0238811 0.0456828 0.0171938 0.597619 0.999418 0.675425
0.624723 1.023 0.361899 1.23395 1.80139 1.30457 0.692972 1.42658 1280.78
76.5147 4.67875 468.667  XLOC_002126 XLOC_002126 MPZ
chr1:16127

[R] Fuzzy rules definition (package "sets") from data.frame

2013-05-08 Thread Johannes Radinger
Hi,

I just discovered the package "sets" and its ability to perform fuzzy
systems calculations.

The example in the manual of fuzzyinference() gives an overview how to
develop rules.
However my "rules" are already available as data.frame and I'd like to
convert them into the format
that is needed by fuzzy_rules.

Here how the rules would be defined manually:

rules <-
  set(
fuzzy_rule(depth %is% low && velocity %is% medium, suitability %is%
low),
fuzzy_rule(depth %is% medium && velocity %is% medium, suitability %is%
medium),
fuzzy_rule(depth %is% high && velocity %is% low, suitability %is% low)
  )

In my case I have the rules in following dataframe where a combination of
depth and velocity (&&)
result in a certain suitability. So every single row is actually a rule:

df <-
data.frame(depth=c("low","medium","high"),velocity=c("medium","medium","low"),suitability=c("low","medium","low"))

Is there an easy way to combine the columns per row in a way that in the
end I get the same format
as the object "rules"? As a single rule (fuzzy_rule) is not a pure text
string I don't know how to do that resp. to combine
all rules/rows into a set().

Any suggestions?

Best regards,
Johannes

[[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] gsub regex simplification

2013-05-08 Thread Thaler,Thorn,LAUSANNE,Applied Mathematics
Dear all,

I want to use gsub to change a vector of strings. Basically, I want to replace 
any dot by a space, remove the possibly appended ".f" and I want to capitalize 
each word. I did that by chaining multiple gsubs together, but I was wondering 
(for the sake of learning - maybe the current version is more readable) whether 
I could do that with a _single_ gsub call?

Thanks for your help!

txt <- c("example1", "example2.f", "another.example3.f", 
"yet.another.example4.f")
gsub("(^|[[:space:]])([[:alpha:]])", "\\1\\U\\2",
   gsub("\\.", " ", gsub("\\.f", "", txt)),
   perl = TRUE)

Thanks for your input!

Kind Regards,

Thorn Thaler 
NRC Lausanne
Applied Mathematics
+41 21 785 8220

__
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] R prints empty group on my figure!!

2013-05-08 Thread Adel ESSAFI
hello,
I attach the figure generated by R:


2013/5/8 Adel ESSAFI 

> Hello list
> I am trying to solve a problem when drawing a figure related to the
> dataframe below.
> I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2.
> I use this commande to make it:
>
> xyplot(cm[,6]~cm[,3],type="b",group=interaction(cm[,1],cm[,2],sep="/"),
> auto.key =list( title="Makespan en fonction de beta", points = FALSE,
> columns=2, lines = TRUE)
> ,data=cm,xlab=expression(beta),ylab="Ratio")
>
> The problem is that, R puts (for example) the entry C/D in the legend,
> however, I have no such entry. Note that R it does not draw a line for that
> entry.
>
> So, the question : how to do to remove the empty groups from the legend.
>
> Cordially
>
>
>
>
> > cm
>V1 V2  V3V4 V5   V6
> 1   C  L 0.0  732179.0 686983 1.065789
> 2   C  L 0.2  900956.4 686983 1.311468
> 3   C  L 0.4  964725.0 686983 1.404292
> 4   C  L 0.6 1017984.0 686983 1.481818
> 5   C  L 0.8 1064745.8 686983 1.549887
> 6   C  L 1.0 1107269.0 686983 1.611785
> 7   C  S 0.0  803926.0 686983 1.170227
> 8   C  S 0.2 1020492.0 686983 1.485469
> 9   C  S 0.4 1134818.0 686983 1.651887
> 10  C  S 0.6 1223596.0 686983 1.781115
> 11  C  S 0.8 1322548.8 686983 1.925155
> 12  C  S 1.0 1395714.0 686983 2.031657
> 13  I  L 0.0 2628113.0 686983 3.825587
> 14  I  L 0.2 2628113.0 686983 3.825587
> 15  I  L 0.4 2628113.0 686983 3.825587
> 16  I  L 0.6 2628113.0 686983 3.825587
> 17  I  L 0.8 2628113.0 686983 3.825587
> 18  I  L 1.0 2628113.0 686983 3.825587
> 19  I  S 0.0 2628113.0 686983 3.825587
> 20  I  S 0.2 2628113.0 686983 3.825587
> 21  I  S 0.4 2475448.0 686983 3.603361
> 22  I  S 0.6 2475448.0 686983 3.603361
> 23  I  S 0.8 2475448.0 686983 3.603361
> 24  I  S 1.0 2475448.0 686983 3.603361
> 25  I  F 0.0  871670.0 686983 1.268838
> 26  I  F 0.2 1066742.0 686983 1.552792
> 27  I  F 0.4 1136213.0 686983 1.653917
> 28  I  F 0.6 1210547.0 686983 1.762121
> 29  I  F 0.8 1256777.0 686983 1.829415
> 30  I  F 1.0 1304294.0 686983 1.898583
> 31  I  I 0.0  897718.0 686983 1.306754
> 32  I  I 0.2 1123968.0 686983 1.636093
> 33  I  I 0.4 1301097.0 686983 1.893929
> 34  I  I 0.6 1373663.0 686983 1.999559
> 35  I  I 0.8 1424121.0 686983 2.073008
> 36  I  I 1.0 1542813.0 686983 2.245780
> 37  I  D 0.0  937621.0 686983 1.364839
> 38  I  D 0.2 1205063.0 686983 1.754138
> 39  I  D 0.4 1341839.0 686983 1.953235
> 40  I  D 0.6 1431970.0 686983 2.084433
> 41  I  D 0.8 1538944.0 686983 2.240149
> 42  I  D 1.0 1670073.0 686983 2.431025
> 43  D  L 0.0  731904.0 686983 1.065389
> 44  D  L 0.2  900183.0 686983 1.310342
> 45  D  L 0.4  964870.1 686983 1.404504
> 46  D  L 0.6 1017462.8 686983 1.481060
> 47  D  L 0.8 1064435.2 686983 1.549435
> 48  D  L 1.0 1107595.0 686983 1.612260
> 49  D  S 0.0  798289.0 686983 1.162022
> 50  D  S 0.2 1014643.2 686983 1.476955
> 51  D  S 0.4 1125711.8 686983 1.638631
> 52  D  S 0.6 1220923.0 686983 1.777224
> 53  D  S 0.8 1306571.2 686983 1.901897
> 54  D  S 1.0 1399836.0 686983 2.037657
> 55  D  F 0.0  724924.0 686983 1.055229
> 56  D  F 0.2  935413.5 686983 1.361625
> 57  D  F 0.4 1011621.9 686983 1.472557
> 58  D  F 0.6 1071081.6 686983 1.559109
> 59  D  F 0.8 1139325.8 686983 1.658448
> 60  D  F 1.0 1181282.1 686983 1.719522
> 61  D  I 0.0  755841.0 686983 1.100232
> 62  D  I 0.2  964335.0 686983 1.403725
> 63  D  I 0.4 1051233.4 686983 1.530218
> 64  D  I 0.6 1110842.0 686983 1.616986
> 65  D  I 0.8 1193509.0 686983 1.737320
> 66  D  I 1.0 1264249.0 686983 1.840292
> 67  D  D 0.0  751660.0 686983 1.094146
> 68  D  D 0.2 1019735.0 686983 1.484367
> 69  D  D 0.4 1101191.0 686983 1.602938
> 70  D  D 0.6 1191547.0 686983 1.734464
> 71  D  D 0.8 1293433.0 686983 1.882773
> 72  D  D 1.0 1340360.0 686983 1.951082
>
>


-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166


cmax.pdf
Description: Adobe PDF document
__
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] gsub regex simplification

2013-05-08 Thread Gabor Grothendieck
On Wed, May 8, 2013 at 5:08 AM, Thaler,Thorn,LAUSANNE,Applied
Mathematics  wrote:
> Dear all,
>
> I want to use gsub to change a vector of strings. Basically, I want to 
> replace any dot by a space, remove the possibly appended ".f" and I want to 
> capitalize each word. I did that by chaining multiple gsubs together, but I 
> was wondering (for the sake of learning - maybe the current version is more 
> readable) whether I could do that with a _single_ gsub call?
>
> Thanks for your help!
>
> txt <- c("example1", "example2.f", "another.example3.f", 
> "yet.another.example4.f")
> gsub("(^|[[:space:]])([[:alpha:]])", "\\1\\U\\2",
>gsub("\\.", " ", gsub("\\.f", "", txt)),
>perl = TRUE)
>

gsubfn() in the gsubfn package is like gsub except that the
replacement string can be a user function, list or proto object.
Using a function one call to gsubfn could do it:  Note that the user
function's i-th argument captures the i-th back reference and the
function's output is used to replace its input so:

library(gsubfn)
f <- function(x1, x2, x3) {
   if (x1 != "") return("")
   if (x2 != "") return(" ")
   if (x3 != "") return(toupper(x3))
}
gsubfn("(.f$)|(\\.)|(\\b.)", f, txt, perl = TRUE)

The last line gives:

[1] "Example1" "Example2" "Another Example3" "Yet Another Example4"

See http://gsubfn.googlecode.com


--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at 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.


Re: [R] Fuzzy rules definition (package "sets") from data.frame

2013-05-08 Thread Johannes Radinger
Following my last mail, I found a simple solution using eval(parse)):

df <-
data.frame(depth=c("low","medium","high"),velocity=c("medium","medium","low"),suitability=c("low","medium","low"))
df$rule <- paste("fuzzy_rule(depth %is% ",df[,"depth"]," && ","velocity
%is% ",df[,"velocity"],", ","suitability %is%
",df[,"suitability"],")",sep="")
rules <-
eval(parse(text=paste("set(",paste(df[,"rule"],collapse=","),")",sep="")))

which turns the dataframe into the rules definition object similar to:

rules <-
  set(
fuzzy_rule(depth %is% low && velocity %is% medium, suitability %is%
low),
fuzzy_rule(depth %is% medium && velocity %is% medium, suitability %is%
medium),
fuzzy_rule(depth %is% high && velocity %is% low, suitability %is% low)
  )

/johannes

[[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.numeric () FALSE

2013-05-08 Thread Alannah
Jeff,
The dataset are 3D landmarks taken from a skull (Homo being the dataset of 3
species of the genus Homo) I am trying to perform Generalised Procrustes
Distance and superimposition and as you can see,  I am told x is not True.
If I also perform is.numeric(Homo) I am told that it is FALSE. I hope that
is enough context for you. I also hope you know what's going wrong in my
dataset.

> Homo=read.table("D:/Homo.txt", sep="")
> Homo
 X1x   X1y  X1z  X2X   X2Y  X2Z  X3X  
X3Y
SK  125.2288 -207.2243 95.13449 94.08087 -184.7764 98.85405 159.1837
-189.3104
GIB 121.4254 -228.1540 33.61633 84.07050 -209.2446 52.82806 159.5556
-205.1629
KBW 128.5904 -232.1195 47.11266 92.96498 -215.2787 48.39832 164.3043
-213.7220
 X3Z  X4X   X4Y   X4Z   X5X   X5Y  X5Z 
X6x
SK  94.84497 129.3257 -192.9469 120.64075 102.09383 -167.0360 140.4830
161.4940
GIB 48.10354 123.3033 -235.6632  68.96723  82.34183 -220.0837 104.7756
164.1860
KBW 51.10052 126.2948 -223.1627  81.66055  75.98707 -201.2843 108.0087
177.3304
  X6y  X6z  X7x   X7y  X7z  X8x   X8y 
X8z
SK  -169.4289 136.2563 56.07269 -156.3827 89.49998 195.9156 -165.8967
79.33151
GIB -221.0951 101.2779 57.06448 -194.0515 61.04704 188.6181 -184.5234
57.21327
KBW -199.6966 110.2110 55.50871 -172.5727 55.57302 201.8666 -173.5339
57.47801
 X9x   X9y   X9z X10x  X10y  X10z
SK  71.01711 -158.7208 126.92698 192.5974 -158.2639 116.59634
GIB 57.25282 -198.6531  93.25098 186.9386 -195.8407  88.64017
KBW 55.54756 -180.8983  92.43064 197.7266 -180.1343  96.22781
> Homo=arrayspecs(Homo, 10, 3, byLand=F)
> Homo
, , SK

  [,1] [,2]  [,3]
 [1,] 125.2288 -207.2243 95.13449
 [2,] 94.08087 -184.7764 98.85405
 [3,] 159.1837 -189.3104 94.84497
 [4,] 129.3257 -192.9469 120.6407
 [5,] 102.0938 -167.036  140.483 
 [6,] 161.494  -169.4289 136.2563
 [7,] 56.07269 -156.3827 89.49998
 [8,] 195.9156 -165.8967 79.33151
 [9,] 71.01711 -158.7208 126.927 
[10,] 192.5974 -158.2639 116.5963

, , GIB

  [,1] [,2]  [,3]
 [1,] 121.4254 -228.154  33.61633
 [2,] 84.0705  -209.2446 52.82806
 [3,] 159.5556 -205.1629 48.10354
 [4,] 123.3033 -235.6632 68.96723
 [5,] 82.34183 -220.0837 104.7756
 [6,] 164.186  -221.0951 101.2779
 [7,] 57.06448 -194.0515 61.04704
 [8,] 188.6181 -184.5234 57.21327
 [9,] 57.25282 -198.6531 93.25098
[10,] 186.9386 -195.8407 88.64017

, , KBW

  [,1] [,2]  [,3]
 [1,] 128.5904 -232.1195 47.11266
 [2,] 92.96498 -215.2787 48.39832
 [3,] 164.3043 -213.722  51.10052
 [4,] 126.2948 -223.1627 81.66055
 [5,] 75.98707 -201.2843 108.0087
 [6,] 177.3304 -199.6966 110.211 
 [7,] 55.50871 -172.5727 55.57302
 [8,] 201.8666 -173.5339 57.47801
 [9,] 55.54756 -180.8983 92.43064
[10,] 197.7266 -180.1343 96.22781

> Homo=gpagen(Homo, Proj=T, ProcD=T,ShowPlot=T,curves=NULL, surfaces=NULL,
> pointscale=1)
Error: is.atomic(x) is not TRUE
> 




--
View this message in context: 
http://r.789695.n4.nabble.com/is-numeric-FALSE-tp4666530p4666564.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
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vector allocation problem while trying to plot 6 MB data file

2013-05-08 Thread Ramon Hofer
Thanks for your answer Uwe


On Fri, 03 May 2013 23:36:24 +0200
Uwe Ligges  wrote:
 
> On 02.05.2013 14:37, Ramon Hofer wrote:
> >
> > I'm trying to analyse the network speed and used iperf to create a
> > csv file containing the link test data. It's only about 6 MB big but
> > contains about 40'000 samples.
> >
> > I can do boxplots (apart from printing the number of samples but I
> > ask separately for that).
> >
> > To find the behaviour over time I wanted to plot the throuphput. So
> > I have this command:
> >
> > plot(A$Timestamp, A$Bandwidth.bit.sec., xlab = "Timestamp", ylab =
> > "Bandwidth [bit/s]", ylim = quantile(A$Bandwidth.bit.sec.,
> > c(0, .99), na.rm = TRUE))
> >
> > Unfortunately I get this:
> > Error: cannot allocate vector of size 12.5 Gb
> 
> 4 samples and 6MB can't be the issue unless this is not a regular 
> plot but the classes of A$Timestamp or A$Bandwidth.bit.sec are rather 
> special.

This should be a standard plot. I can't tell exactly as I'm new to R...


> What do
> str(A$Timestamp)

Factor w/ 40886 levels "2013-04-29_10:31:47.189194629",..: 1 2 3 4 5 6
7 8 9 10 ...


> str(A$Bandwidth.bit.sec.)

int [1:40886] NA 79106 86086 49918 96353 97268 98027 99369 98049
97280 ...


> Can you make a reprducible examples available?

You can find the data here:
http://people.ee.ethz.ch/~hoferr/download/data.csv

The script I have so far:
http://people.ee.ethz.ch/~hoferr/download/draw_graph.R

The same error occurs if I start a new R session and enter these two
commands:

 A <- read.csv('data.csv')
 plot(A$Timestamp, A$Bandwidth.bit.sec., xlab = "Timestamp", ylab =
 "Bandwidth [bit/s]", ylim = quantile(A$Bandwidth.bit.sec., c(0, .99),
 na.rm = TRUE))


Best regards
Ramon

__
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] R prints empty group on my figure!!

2013-05-08 Thread jim holtman
try using:

group = factor(paste(cm[, 1], cm[, 2], sep = '/'))

instead of

group=interaction(cm[,1],cm[,2],sep="/")


On Wed, May 8, 2013 at 4:25 AM, Adel ESSAFI  wrote:

> Hello list
> I am trying to solve a problem when drawing a figure related to the
> dataframe below.
> I draw V6 in Y axes and V3 as X axes. The data are grouped by V1 AND V2.
> I use this commande to make it:
>
> xyplot(cm[,6]~cm[,3],type="b",group=interaction(cm[,1],cm[,2],sep="/"),
> auto.key =list( title="Makespan en fonction de beta", points = FALSE,
> columns=2, lines = TRUE)
> ,data=cm,xlab=expression(beta),ylab="Ratio")
>
> The problem is that, R puts (for example) the entry C/D in the legend,
> however, I have no such entry. Note that R it does not draw a line for that
> entry.
>
> So, the question : how to do to remove the empty groups from the legend.
>
> Cordially
>
>
>
>
> > cm
>V1 V2  V3V4 V5   V6
> 1   C  L 0.0  732179.0 686983 1.065789
> 2   C  L 0.2  900956.4 686983 1.311468
> 3   C  L 0.4  964725.0 686983 1.404292
> 4   C  L 0.6 1017984.0 686983 1.481818
> 5   C  L 0.8 1064745.8 686983 1.549887
> 6   C  L 1.0 1107269.0 686983 1.611785
> 7   C  S 0.0  803926.0 686983 1.170227
> 8   C  S 0.2 1020492.0 686983 1.485469
> 9   C  S 0.4 1134818.0 686983 1.651887
> 10  C  S 0.6 1223596.0 686983 1.781115
> 11  C  S 0.8 1322548.8 686983 1.925155
> 12  C  S 1.0 1395714.0 686983 2.031657
> 13  I  L 0.0 2628113.0 686983 3.825587
> 14  I  L 0.2 2628113.0 686983 3.825587
> 15  I  L 0.4 2628113.0 686983 3.825587
> 16  I  L 0.6 2628113.0 686983 3.825587
> 17  I  L 0.8 2628113.0 686983 3.825587
> 18  I  L 1.0 2628113.0 686983 3.825587
> 19  I  S 0.0 2628113.0 686983 3.825587
> 20  I  S 0.2 2628113.0 686983 3.825587
> 21  I  S 0.4 2475448.0 686983 3.603361
> 22  I  S 0.6 2475448.0 686983 3.603361
> 23  I  S 0.8 2475448.0 686983 3.603361
> 24  I  S 1.0 2475448.0 686983 3.603361
> 25  I  F 0.0  871670.0 686983 1.268838
> 26  I  F 0.2 1066742.0 686983 1.552792
> 27  I  F 0.4 1136213.0 686983 1.653917
> 28  I  F 0.6 1210547.0 686983 1.762121
> 29  I  F 0.8 1256777.0 686983 1.829415
> 30  I  F 1.0 1304294.0 686983 1.898583
> 31  I  I 0.0  897718.0 686983 1.306754
> 32  I  I 0.2 1123968.0 686983 1.636093
> 33  I  I 0.4 1301097.0 686983 1.893929
> 34  I  I 0.6 1373663.0 686983 1.999559
> 35  I  I 0.8 1424121.0 686983 2.073008
> 36  I  I 1.0 1542813.0 686983 2.245780
> 37  I  D 0.0  937621.0 686983 1.364839
> 38  I  D 0.2 1205063.0 686983 1.754138
> 39  I  D 0.4 1341839.0 686983 1.953235
> 40  I  D 0.6 1431970.0 686983 2.084433
> 41  I  D 0.8 1538944.0 686983 2.240149
> 42  I  D 1.0 1670073.0 686983 2.431025
> 43  D  L 0.0  731904.0 686983 1.065389
> 44  D  L 0.2  900183.0 686983 1.310342
> 45  D  L 0.4  964870.1 686983 1.404504
> 46  D  L 0.6 1017462.8 686983 1.481060
> 47  D  L 0.8 1064435.2 686983 1.549435
> 48  D  L 1.0 1107595.0 686983 1.612260
> 49  D  S 0.0  798289.0 686983 1.162022
> 50  D  S 0.2 1014643.2 686983 1.476955
> 51  D  S 0.4 1125711.8 686983 1.638631
> 52  D  S 0.6 1220923.0 686983 1.777224
> 53  D  S 0.8 1306571.2 686983 1.901897
> 54  D  S 1.0 1399836.0 686983 2.037657
> 55  D  F 0.0  724924.0 686983 1.055229
> 56  D  F 0.2  935413.5 686983 1.361625
> 57  D  F 0.4 1011621.9 686983 1.472557
> 58  D  F 0.6 1071081.6 686983 1.559109
> 59  D  F 0.8 1139325.8 686983 1.658448
> 60  D  F 1.0 1181282.1 686983 1.719522
> 61  D  I 0.0  755841.0 686983 1.100232
> 62  D  I 0.2  964335.0 686983 1.403725
> 63  D  I 0.4 1051233.4 686983 1.530218
> 64  D  I 0.6 1110842.0 686983 1.616986
> 65  D  I 0.8 1193509.0 686983 1.737320
> 66  D  I 1.0 1264249.0 686983 1.840292
> 67  D  D 0.0  751660.0 686983 1.094146
> 68  D  D 0.2 1019735.0 686983 1.484367
> 69  D  D 0.4 1101191.0 686983 1.602938
> 70  D  D 0.6 1191547.0 686983 1.734464
> 71  D  D 0.8 1293433.0 686983 1.882773
> 72  D  D 1.0 1340360.0 686983 1.951082
>
> [[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.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

[[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] Vector allocation problem while trying to plot 6 MB data file

2013-05-08 Thread Uwe Ligges



On 08.05.2013 13:38, Ramon Hofer wrote:

Thanks for your answer Uwe


On Fri, 03 May 2013 23:36:24 +0200
Uwe Ligges  wrote:


On 02.05.2013 14:37, Ramon Hofer wrote:


I'm trying to analyse the network speed and used iperf to create a
csv file containing the link test data. It's only about 6 MB big but
contains about 40'000 samples.

I can do boxplots (apart from printing the number of samples but I
ask separately for that).

To find the behaviour over time I wanted to plot the throuphput. So
I have this command:

plot(A$Timestamp, A$Bandwidth.bit.sec., xlab = "Timestamp", ylab =
"Bandwidth [bit/s]", ylim = quantile(A$Bandwidth.bit.sec.,
c(0, .99), na.rm = TRUE))

Unfortunately I get this:
Error: cannot allocate vector of size 12.5 Gb


4 samples and 6MB can't be the issue unless this is not a regular
plot but the classes of A$Timestamp or A$Bandwidth.bit.sec are rather
special.


This should be a standard plot. I can't tell exactly as I'm new to R...



What do
str(A$Timestamp)


Factor w/ 40886 levels "2013-04-29_10:31:47.189194629",..: 1 2 3 4 5 6
7 8 9 10 ...




That's the problem: you have a factor, hence producing 40886 parallel 
boxplots with a median line only in each one:


plot(factor(1:2), 1:2)

You have to convert that to a time object, e.g. to POSIXlt via:

A$Timestamp <- strptime(as.character(A$Timestamp), "%Y-%m-%d_%H:%M:%S")

Then it should work rather quickly.

Best,
Uwe Ligges







str(A$Bandwidth.bit.sec.)


int [1:40886] NA 79106 86086 49918 96353 97268 98027 99369 98049
97280 ...



Can you make a reprducible examples available?


You can find the data here:
http://people.ee.ethz.ch/~hoferr/download/data.csv

The script I have so far:
http://people.ee.ethz.ch/~hoferr/download/draw_graph.R

The same error occurs if I start a new R session and enter these two
commands:

  A <- read.csv('data.csv')
  plot(A$Timestamp, A$Bandwidth.bit.sec., xlab = "Timestamp", ylab =
  "Bandwidth [bit/s]", ylim = quantile(A$Bandwidth.bit.sec., c(0, .99),
  na.rm = TRUE))


Best regards
Ramon

__
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] How does one set up logical functions?

2013-05-08 Thread Adams, Jean
Bruce,

Try something like this

df$limlo <- ifelse(df$BG>=100, df$BG-(df$BG*0.15), df$BG-15)
df$limhi <- ifelse(df$BG>=100, df$BG+(df$BG*0.15), df$BG+15)

plot(seq(df$BG), df$BG, ylim=range(df$limlo, df$limhi))
arrows(seq(df$BG), df$limlo, seq(df$BG), df$limhi, length=0.1, angle=90,
code=3)

Jean


On Tue, May 7, 2013 at 8:54 AM, Bruce Miller  wrote:

> Hi all,
>
> I am trying to set up logical function(s) to deal with two adjustments
> to a blood glucose value.
> I have been dinking around in Excel and assume this will be much easier
> in R.
>
> DF is date-time, BG value in mg/dL,test strip
> 4/3/13 19:20105 Aviva-491350
> 4/4/13 21:0374  Aviva-491350
> 4/6/13 17:4081  Aviva-491640
> 4/6/13 17:4082  Aviva-491350
> 4/6/13 22:48106 Aviva-491640
> 4/6/13 22:48102 Aviva-491350
> 4/7/13 5:32 87  Aviva-491350
> 4/7/13 5:32 103 Aviva-491640
>
>
> What I need are the high and low ranges based on "acceptable" standards
> of the measured values.
>
> The logical expressions need to be
> IF BG =>100 then "High limit" would = (BG+(BG*.15))
> IF BG =>100 then "Low limit" would = (BG-(BG*.15))
> and
> IF BG <100 then "High limit" would = (BG+15)
> IF BG <100 then "Low limit" would = (BG-15)
>
> The standards are written as: 95% of the individual glucose results
> shall fall within ą15 mg/dL of the reference results at glucose
> concentrations less than 100 mg/dL and within ą15% at glucose
> concentrations greater than or equal to 100 mg/dL.
>
> Then I need to plot the measured value and also show the high & low
> "acceptable" values.
>
> Thanks for any who respond.
>
> Bruce
>
>
> [[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.
>
>

[[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] NaN-result from fuzzy_inference (package "sets") with certain input

2013-05-08 Thread Johannes Radinger
Hi,

I am trying to use the fuzzy_inference system on multiple input values.
Basically I combine two variables (depth, velocity) into the variable
suitability.
Both depth and velocity have 3 trapezoid classes (verylow,medium,high) each.
The consequent (suitability) has 4 fuzzy levels (none,low,medium,high) and
should
finally range between 0 and 1.
I already set up the level definitions (trapez-corners) and the rules (a
combination
of all depth-levels with all velocity-levels and the consequent
suitability).

Now I wanted to test the system on a dataframe with dummy variables (in the
range
of values I will supply), but some how I get for some combinations of depth
and velocity no resulting suitablilty.

I provide here now some code (simpler than my actual) that produces also
this
NaN values:

# Load "sets"
library(sets)

## set universe
sets_options("universe", seq(from = 0, to = 1, by = 0.001))

## set up fuzzy variables
variables <-
set(depth = fuzzy_variable(verylow = fuzzy_trapezoid(corners =
c(-3,0,0.2,0.5)),
   medium = fuzzy_trapezoid(corners
=c(0.45,0.55,0.7,0.9)),
   veryhigh = fuzzy_trapezoid(corners =
c(0.85,1,15,20))),
velocity = fuzzy_variable(verylow = fuzzy_trapezoid(corners =
c(-3,0,0.2,0.5)),
  medium = fuzzy_trapezoid(corners =
c(0.35,0.55,0.65,0.8)),
  veryhigh = fuzzy_trapezoid(corners =
c(0.7,0.9,15,20))),
suitability = fuzzy_partition(varnames = c(none = 0.2, low = 0.4,
medium = 0.6, high = 0.8),FUN = fuzzy_cone, radius = 0.15))


## set up rules
rules <-
  set(
fuzzy_rule(depth %is% verylow && velocity %is% verylow, suitability
%is% low),
fuzzy_rule(depth %is% medium && velocity %is% verylow, suitability %is%
medium),
fuzzy_rule(depth %is% veryhigh && velocity %is% verylow, suitability
%is% low),
fuzzy_rule(depth %is% verylow && velocity %is% medium, suitability %is%
medium),
fuzzy_rule(depth %is% medium && velocity %is% medium, suitability %is%
high),
fuzzy_rule(depth %is% veryhigh && velocity %is% medium, suitability
%is% medium),
fuzzy_rule(depth %is% verylow && velocity %is% veryhigh, suitability
%is% none),
fuzzy_rule(depth %is% medium && velocity %is% veryhigh, suitability
%is% low),
fuzzy_rule(depth %is% veryhigh && velocity %is% veryhigh, suitability
%is% none)
  )

## combine to a system
system <- fuzzy_system(variables, rules)
print(system)
plot(system) ## plots variables

# test df
test_df <-
data.frame(depth=round(runif(20,0,2),2),velocity=round(runif(20,0,1.5),2),suitability=NA)

# do inference on test_df
fuzzy_result <- function(df){
  gset_defuzzify(fuzzy_inference(system, list(depth = df["depth"], velocity
= df["velocity"])),"centroid")
}

apply(test_df,1,fuzzy_result)


Does anyone know what is happening there?

/Johannes

[[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] chronological season results assistance

2013-05-08 Thread arun
Hi,

May be this helps:
funFluxSumSeason <- function(DF, FUN = sum){
 month <- as.integer(format(DF$Date, format="%m"))
 year <- format(DF$Date, format="%Y")
 DF$season<- NA
 DF$season[month %in% 10:12] <- paste(year[month %in% 10:12], "Fall")
 DF$season[month %in% 1:3] <- paste(year[month %in% 1:3], "Winter")
 DF$season[month %in% 4:6] <- paste(year[month %in% 4:6], "Spring")
 DF$season[month %in% 7:9] <- paste(year[month %in% 7:9], "Summer")
 res1<-aggregate(FluxDay ~ season, data=DF, FUN = FUN) # changed here
res2<-res1[order(gsub("\\d+","",res1[,1])),]
row.names(res2)<- 1:nrow(res2)
res2
 }
funFluxSumSeason(DailyFluxSeason,sum)
#    season   FluxDay
#1    2000 Fall  2897.790
#2    2001 Fall  2148.480
#3    2002 Fall 10946.064
#4    2003 Fall 13901.042
#5  2001 Spring  4062.394
#6  2002 Spring  4551.710
#7  2003 Spring 14275.783
#8  2004 Spring 10918.103
#9  2001 Summer  4386.394
#10 2002 Summer  5159.071
#11 2003 Summer 16653.662
#12 2004 Summer 37343.184
#13 2001 Winter  7551.095
#14 2002 Winter  5887.516
#15 2003 Winter 20223.513
#16 2004 Winter 13396.535

A.K.

Hi, how are you? 

I am trying to modify the existing R function so that it will 
chronologically order the seasons beginning with Fall and ending in the 
Winter. Can you assist me in modifying the function below? 

Thank you. 

Irucka Embry 


This is the R function: 
funFluxSumSeason <- function(DF, FUN = sum){ 
 month <- as.integer(format(DF$Date, format="%m")) 
 year <- format(DF$Date, format="%Y") 
 DF$season<- NA 
 DF$season[month %in% 10:12] <- paste(year[month %in% 10:12], "Fall") 
 DF$season[month %in% 1:3] <- paste(year[month %in% 1:3], "Winter") 
 DF$season[month %in% 4:6] <- paste(year[month %in% 4:6], "Spring") 
 DF$season[month %in% 7:9] <- paste(year[month %in% 7:9], "Summer") 
 aggregate(FluxDay ~ season, data=DF, FUN = FUN) # changed here 
 } 

This is the function's result: 
dput(seasonFluxSum) 
structure(list(season = c("2000 Fall", "2001 Fall", "2001 Spring", 
"2001 Summer", "2001 Winter", "2002 Fall", "2002 Spring", "2002 Summer", 
"2002 Winter", "2003 Fall", "2003 Spring", "2003 Summer", "2003 Winter", 
"2004 Spring", "2004 Summer", "2004 Winter"), FluxDay = c(2897.79043403356, 
2148.48034139629, 4062.39365601964, 4386.39358258187, 7551.09451122126, 
10946.0644606408, 4551.71006202726, 5159.07068303165, 5887.51583868203, 
13901.0420234613, 14275.7834627696, 16653.6617307992, 20223.5133431944, 
10918.1025781646, 37343.1840220637, 13396.5350817751)), .Names = c("season", 
"FluxDay"), row.names = c(NA, -16L), class = "data.frame") 


This is the data used to obtain the above results: 
dput(DailyFluxSeason) 
structure(list(Date = structure(c(11231, 11232, 11233, 11234, 
11235, 11236, 11237, 11238, 11239, 11240, 11241, 11242, 11243, 
11244, 11245, 11246, 11247, 11248, 11249, 11250, 11251, 11252, 
11253, 11254, 11255, 11256, 11257, 11258, 11259, 11260, 11261, 
11262, 11263, 11264, 11265, 11266, 11267, 11268, 11269, 11270, 
11271, 11272, 11273, 11274, 11275, 11276, 11277, 11278, 11279, 
11280, 11281, 11282, 11283, 11284, 11285, 11286, 11287, 11288, 
11289, 11290, 11291, 11292, 11293, 11294, 11295, 11296, 11297, 
11298, 11299, 11300, 11301, 11302, 11303, 11304, 11305, 11306, 
11307, 11308, 11309, 11310, 11311, 11312, 11313, 11314, 11315, 
11316, 11317, 11318, 11319, 11320, 11321, 11322, 11323, 11324, 
11325, 11326, 11327, 11328, 11329, 11330, 11331, 11332, 11333, 
11334, 11335, 11336, 11337, 11338, 11339, 11340, 11341, 11342, 
11343, 11344, 11345, 11346, 11347, 11348, 11349, 11350, 11351, 
11352, 11353, 11354, 11355, 11356, 11357, 11358, 11359, 11360, 
11361, 11362, 11363, 11364, 11365, 11366, 11367, 11368, 11369, 
11370, 11371, 11372, 11373, 11374, 11375, 11376, 11377, 11378, 
11379, 11380, 11381, 11382, 11383, 11384, 11385, 11386, 11387, 
11388, 11389, 11390, 11391, 11392, 11393, 11394, 11395, 11396, 
11397, 11398, 11399, 11400, 11401, 11402, 11403, 11404, 11405, 
11406, 11407, 11408, 11409, 11410, 11411, 11412, 11413, 11414, 
11415, 11416, 11417, 11418, 11419, 11420, 11421, 11422, 11423, 
11424, 11425, 11426, 11427, 11428, 11429, 11430, 11431, 11432, 
11433, 11434, 11435, 11436, 11437, 11438, 11439, 11440, 11441, 
11442, 11443, 11444, 11445, 11446, 11447, 11448, 11449, 11450, 
11451, 11452, 11453, 11454, 11455, 11456, 11457, 11458, 11459, 
11460, 11461, 11462, 11463, 11464, 11465, 11466, 11467, 11468, 
11469, 11470, 11471, 11472, 11473, 11474, 11475, 11476, 11477, 
11478, 11479, 11480, 11481, 11482, 11483, 11484, 11485, 11486, 
11487, 11488, 11489, 11490, 11491, 11492, 11493, 11494, 11495, 
11496, 11497, 11498, 11499, 11500, 11501, 11502, 11503, 11504, 
11505, 11506, 11507, 11508, 11509, 11510, 11511, 11512, 11513, 
11514, 11515, 11516, 11517, 11518, 11519, 11520, 11521, 11522, 
11523, 11524, 11525, 11526, 11527, 11528, 11529, 11530, 11531, 
11532, 11533, 11534, 11535, 11536, 11537, 11538, 11539, 11540, 
11541, 11542, 11543, 11544, 11545, 11546, 11547, 11548, 11549, 
11550, 11551, 11552, 11553, 11554, 11555, 11556, 11557,

Re: [R] How to calculate Hightest Posterior Density (HPD) of coeficients in a simple regression (lm) in R?

2013-05-08 Thread Ben Bolker
Richard Asturia  gmail.com> writes:

> 
> Hi!
> 
> I am trying to calculate HPD for the coeficients of regression models
> fitted with lm or lmrob in R, pretty much in the same way that can be
> accomplished by the association of mcmcsamp and HPDinterval functions for
> multilevel models fitted with lmer. Can anyone point me in the right
> direction on which packages/how to implement this?
> 
> Thanks for your time!
> 
> R.
> 

 Hmmm. 
  At least for lm(), if the assumptions of the model are met
then the sampling distribution of the parameters should be
multivariate normal, so with a flat prior the posterior distributions
should be symmetric and equivalent to the sampling distributions of
the parameters -- so I think that the highest 95% posterior density
interval should be equivalent to classical frequentist confidence
intervals [see confint()].

  You might be interested in the bayeslm() function from the arm
package.

__
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] How to calculate Hightest Posterior Density (HPD) of coeficients in a simple regression (lm) in R?

2013-05-08 Thread Richard Asturia
Thanks a lot for your reply!

That is interesting function. And you are completely right. Of course it
may be an overkill to use hpd with lm... But anyway, I am precisely
interested in comparing CI and HPD for a model fitted with lm and then do
the same comparison for the same model fitted with lmrob. I played a little
bit with the bayeslm() you've suggested and I think it pretty much solves
my issue for lm. But what about doing something similar to lmrob? In this
case, as far as I know, there is no similar function. If this is right,
some "manual" solution should be needed, i.e. some code-implementation
using MCMC.

Any ideas on which funcionts/code could help me doing so for lmrob fitted
objects?

Thanks again!

R.


2013/5/8 Ben Bolker 

> Richard Asturia  gmail.com> writes:
>
> >
> > Hi!
> >
> > I am trying to calculate HPD for the coeficients of regression models
> > fitted with lm or lmrob in R, pretty much in the same way that can be
> > accomplished by the association of mcmcsamp and HPDinterval functions for
> > multilevel models fitted with lmer. Can anyone point me in the right
> > direction on which packages/how to implement this?
> >
> > Thanks for your time!
> >
> > R.
> >
>
>  Hmmm.
>   At least for lm(), if the assumptions of the model are met
> then the sampling distribution of the parameters should be
> multivariate normal, so with a flat prior the posterior distributions
> should be symmetric and equivalent to the sampling distributions of
> the parameters -- so I think that the highest 95% posterior density
> interval should be equivalent to classical frequentist confidence
> intervals [see confint()].
>
>   You might be interested in the bayeslm() function from the arm
> package.
>
> __
> 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.
>

[[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] State space models with regime switching

2013-05-08 Thread John P. Burkett

On 05/06/2013 04:28 PM, David Hoppe wrote:

Hello everyone,

I'm new to this mailing list, but i hope this is the right place to
post my question. I'm trying to do some time series analysis with
state space models in R. So far I used the packages dse and dlm. I was
wondering if there is a package, which allows for regime switching
state space models.


Marc Lammerding et al., "Speculative bubbles in recent oil price 
dynamics: evidence from a Bayesian Markov-switching state-space 
approach," Energy Economics, v. 36 (2013) pp. 491-502 contains useful 
footnotes on R packages and functions.  The authors used the MCMCpack 
and dlm packages as well as the loess function in the stats packages.


If you find other useful packages, I would be interested in hearing 
about them.


 -John

I did a lot of searching, but I couldn't find

anything.

Thanks for your answers!

David

__
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.




--
John P. Burkett
Department of Economics
University of Rhode Island
Kingston, RI 02881-0808
USA

phone (401) 874-9195

__
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] gam (mgcv), multiple imputation, f-stats/p-values, and summary(gam)

2013-05-08 Thread Andrew Crane-Droesch

Dear All,

I'm using gam for a project that involves multiple imputation, and it 
has led me to a question about how f-statistics/p-values work in gam.  
Specifically, how do the values in summary(gam) get generated?  As is 
made clear by the dumb example below, I'm manipul;ating gam objects to 
reflect the MI procedures that I'm using.  I don't trust the 
f-statistics/p-values that I'm getting, but I'd like to know how to 
further manipulate these objects to get trustworthy values.  Part of 
that invovles knowing how the output in summary(gam) gets generated, and 
from what elements of a gam object.


Here is the example:

library(mgcv)
par(mfrow=c(2,2))
impute <- function (a, a.impute){
ifelse (is.na(a), a.impute, a)
}

#make some dumb fake data
x1.knots = c(-1,-.5,0,.5,1)
x2.knots = c(-1,-.5,0,.5,1)
K=5
x1 = rnorm(100)
x2 = rnorm(100)
y = .05*exp(x1)-.5*x1 + .1*x2 + x1*x2 + rnorm(100)
#some of it is missing
x1[81:100] = NA
x2[71:90] = NA

#do a few dumb imputations, and fit models to the partially-imputed data
x1.imp = impute(x1, rnorm(100))
x2.imp = impute(x2, rnorm(100))
m1 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots, 
x2.imp = x2.knots))

plot(m1,plot.type="contour",scheme=2,main="Imp 1")

x1.imp = impute(x1, rnorm(100))
x2.imp = impute(x2, rnorm(100))
m2 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots, 
x2.imp = x2.knots))

plot(m2,plot.type="contour",scheme=2,main="Imp 2")

x1.imp = impute(x1, rnorm(100))
x2.imp = impute(x2, rnorm(100))
m3 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots, 
x2.imp = x2.knots))

plot(m3,plot.type="contour",scheme=2,main="Imp 3")

results = list(m1,m2,m3)

#Combine the results according to rubin's rules
reps=3
bhat=results[[1]]$coeff
for (i in 2:reps){
bhat=bhat+results[[i]]$coeff
}
bhat = bhat/reps

W=results[[1]]$Vp
for (i in 2:reps){
W = W+results[[i]]$Vp
}
W = W/reps
B= (results[[1]]$coeff-bhat) %*% t(results[[1]]$coeff-bhat)
for (i in 2:reps){
B = B+(results[[i]]$coeff-bhat) %*% t(results[[i]]$coeff-bhat)
}
B=B/(reps-1)
Vb = W+(1+1/reps)*B

#Put the results into a convenient gam object
MI = results[[1]]
MI$coefficients=bhat
MI$Vp = Vb

#and summarize
summary(MI)
plot(MI,plot.type="contour",scheme=2,main="MI")

When I do something similar with non-fake data I get wacky f-statistics 
and p-values.  For example, F could be >100 and p could equal 1.  This 
probably has something to do with degrees of freedom.


My easy question:  what goes on under the hood with gam to generate 
these values?  What parts of a gam object are called up?


My harder question:  how might one construct principled analogs of these 
statistics in an MI context, when degrees of freedom will vary across 
models, depending on the imputed data?  Has anybody thought about this, 
or do I have have some serious pencil-and-paper ahead of me?


Thanks,
Andrew

__
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.numeric () FALSE

2013-05-08 Thread David Carlson
You have still left out important information. You created Homo as a
data.frame but the next command arrayspecs() assumes Homo is a matrix. There
appears to be an initial column of characters that indicates the landmark?
What does str(Homo) produce after read.table()? We need the steps you used
to create and modify Homo before the error message including the command
that generated the error message and the exact text of that message. It
appears that arrayspecs converts Homo to a three dimensional array. You
should run str(Homo) after this step as well (and include the results in any
further posts).

-
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Alannah
Sent: Wednesday, May 8, 2013 4:25 AM
To: r-help@r-project.org
Subject: Re: [R] is.numeric () FALSE

Jeff,
The dataset are 3D landmarks taken from a skull (Homo being the dataset of 3
species of the genus Homo) I am trying to perform Generalised Procrustes
Distance and superimposition and as you can see,  I am told x is not True.
If I also perform is.numeric(Homo) I am told that it is FALSE. I hope that
is enough context for you. I also hope you know what's going wrong in my
dataset.

> Homo=read.table("D:/Homo.txt", sep="") Homo
 X1x   X1y  X1z  X2X   X2Y  X2Z  X3X  
X3Y
SK  125.2288 -207.2243 95.13449 94.08087 -184.7764 98.85405 159.1837
-189.3104
GIB 121.4254 -228.1540 33.61633 84.07050 -209.2446 52.82806 159.5556
-205.1629
KBW 128.5904 -232.1195 47.11266 92.96498 -215.2787 48.39832 164.3043
-213.7220
 X3Z  X4X   X4Y   X4Z   X5X   X5Y  X5Z 
X6x
SK  94.84497 129.3257 -192.9469 120.64075 102.09383 -167.0360 140.4830
161.4940
GIB 48.10354 123.3033 -235.6632  68.96723  82.34183 -220.0837 104.7756
164.1860
KBW 51.10052 126.2948 -223.1627  81.66055  75.98707 -201.2843 108.0087
177.3304
  X6y  X6z  X7x   X7y  X7z  X8x   X8y 
X8z
SK  -169.4289 136.2563 56.07269 -156.3827 89.49998 195.9156 -165.8967
79.33151
GIB -221.0951 101.2779 57.06448 -194.0515 61.04704 188.6181 -184.5234
57.21327
KBW -199.6966 110.2110 55.50871 -172.5727 55.57302 201.8666 -173.5339
57.47801
 X9x   X9y   X9z X10x  X10y  X10z
SK  71.01711 -158.7208 126.92698 192.5974 -158.2639 116.59634 GIB 57.25282
-198.6531  93.25098 186.9386 -195.8407  88.64017 KBW 55.54756 -180.8983
92.43064 197.7266 -180.1343  96.22781
> Homo=arrayspecs(Homo, 10, 3, byLand=F) Homo
, , SK

  [,1] [,2]  [,3]
 [1,] 125.2288 -207.2243 95.13449
 [2,] 94.08087 -184.7764 98.85405
 [3,] 159.1837 -189.3104 94.84497
 [4,] 129.3257 -192.9469 120.6407
 [5,] 102.0938 -167.036  140.483
 [6,] 161.494  -169.4289 136.2563
 [7,] 56.07269 -156.3827 89.49998
 [8,] 195.9156 -165.8967 79.33151
 [9,] 71.01711 -158.7208 126.927
[10,] 192.5974 -158.2639 116.5963

, , GIB

  [,1] [,2]  [,3]
 [1,] 121.4254 -228.154  33.61633
 [2,] 84.0705  -209.2446 52.82806
 [3,] 159.5556 -205.1629 48.10354
 [4,] 123.3033 -235.6632 68.96723
 [5,] 82.34183 -220.0837 104.7756
 [6,] 164.186  -221.0951 101.2779
 [7,] 57.06448 -194.0515 61.04704
 [8,] 188.6181 -184.5234 57.21327
 [9,] 57.25282 -198.6531 93.25098
[10,] 186.9386 -195.8407 88.64017

, , KBW

  [,1] [,2]  [,3]
 [1,] 128.5904 -232.1195 47.11266
 [2,] 92.96498 -215.2787 48.39832
 [3,] 164.3043 -213.722  51.10052
 [4,] 126.2948 -223.1627 81.66055
 [5,] 75.98707 -201.2843 108.0087
 [6,] 177.3304 -199.6966 110.211
 [7,] 55.50871 -172.5727 55.57302
 [8,] 201.8666 -173.5339 57.47801
 [9,] 55.54756 -180.8983 92.43064
[10,] 197.7266 -180.1343 96.22781

> Homo=gpagen(Homo, Proj=T, ProcD=T,ShowPlot=T,curves=NULL, 
> surfaces=NULL,
> pointscale=1)
Error: is.atomic(x) is not TRUE
> 




--
View this message in context:
http://r.789695.n4.nabble.com/is-numeric-FALSE-tp4666530p4666564.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
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] gam (mgcv), multiple imputation, f-stats/p-values, and summary(gam)

2013-05-08 Thread Bert Gunter
?summary.gam  ## The Help page

Since the Help page is presumably not enough, why don't you look at
the code?? R is open source.

summary.gam  ## at the prompt

-- Bert

On Wed, May 8, 2013 at 7:12 AM, Andrew Crane-Droesch  wrote:
> Dear All,
>
> I'm using gam for a project that involves multiple imputation, and it has
> led me to a question about how f-statistics/p-values work in gam.
> Specifically, how do the values in summary(gam) get generated?  As is made
> clear by the dumb example below, I'm manipul;ating gam objects to reflect
> the MI procedures that I'm using.  I don't trust the f-statistics/p-values
> that I'm getting, but I'd like to know how to further manipulate these
> objects to get trustworthy values.  Part of that invovles knowing how the
> output in summary(gam) gets generated, and from what elements of a gam
> object.
>
> Here is the example:
>
> library(mgcv)
> par(mfrow=c(2,2))
> impute <- function (a, a.impute){
> ifelse (is.na(a), a.impute, a)
> }
>
> #make some dumb fake data
> x1.knots = c(-1,-.5,0,.5,1)
> x2.knots = c(-1,-.5,0,.5,1)
> K=5
> x1 = rnorm(100)
> x2 = rnorm(100)
> y = .05*exp(x1)-.5*x1 + .1*x2 + x1*x2 + rnorm(100)
> #some of it is missing
> x1[81:100] = NA
> x2[71:90] = NA
>
> #do a few dumb imputations, and fit models to the partially-imputed data
> x1.imp = impute(x1, rnorm(100))
> x2.imp = impute(x2, rnorm(100))
> m1 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots, x2.imp
> = x2.knots))
> plot(m1,plot.type="contour",scheme=2,main="Imp 1")
>
> x1.imp = impute(x1, rnorm(100))
> x2.imp = impute(x2, rnorm(100))
> m2 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots, x2.imp
> = x2.knots))
> plot(m2,plot.type="contour",scheme=2,main="Imp 2")
>
> x1.imp = impute(x1, rnorm(100))
> x2.imp = impute(x2, rnorm(100))
> m3 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots, x2.imp
> = x2.knots))
> plot(m3,plot.type="contour",scheme=2,main="Imp 3")
>
> results = list(m1,m2,m3)
>
> #Combine the results according to rubin's rules
> reps=3
> bhat=results[[1]]$coeff
> for (i in 2:reps){
> bhat=bhat+results[[i]]$coeff
> }
> bhat = bhat/reps
>
> W=results[[1]]$Vp
> for (i in 2:reps){
> W = W+results[[i]]$Vp
> }
> W = W/reps
> B= (results[[1]]$coeff-bhat) %*% t(results[[1]]$coeff-bhat)
> for (i in 2:reps){
> B = B+(results[[i]]$coeff-bhat) %*% t(results[[i]]$coeff-bhat)
> }
> B=B/(reps-1)
> Vb = W+(1+1/reps)*B
>
> #Put the results into a convenient gam object
> MI = results[[1]]
> MI$coefficients=bhat
> MI$Vp = Vb
>
> #and summarize
> summary(MI)
> plot(MI,plot.type="contour",scheme=2,main="MI")
>
> When I do something similar with non-fake data I get wacky f-statistics and
> p-values.  For example, F could be >100 and p could equal 1.  This probably
> has something to do with degrees of freedom.
>
> My easy question:  what goes on under the hood with gam to generate these
> values?  What parts of a gam object are called up?
>
> My harder question:  how might one construct principled analogs of these
> statistics in an MI context, when degrees of freedom will vary across
> models, depending on the imputed data?  Has anybody thought about this, or
> do I have have some serious pencil-and-paper ahead of me?
>
> Thanks,
> Andrew
>
> __
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] gam (mgcv), multiple imputation, f-stats/p-values, and summary(gam)

2013-05-08 Thread Simon Wood

For smooths the method is described in

Wood 2013 On p-values for smooth components of an extended generalized 
additive model, Biometrika 100(1),221-228


http://biomet.oxfordjournals.org/content/early/2012/10/18/biomet.ass048.full.pdf+html

best,
Simon

On 08/05/13 15:12, Andrew Crane-Droesch wrote:

Dear All,

I'm using gam for a project that involves multiple imputation, and it
has led me to a question about how f-statistics/p-values work in gam.
Specifically, how do the values in summary(gam) get generated?  As is
made clear by the dumb example below, I'm manipul;ating gam objects to
reflect the MI procedures that I'm using.  I don't trust the
f-statistics/p-values that I'm getting, but I'd like to know how to
further manipulate these objects to get trustworthy values.  Part of
that invovles knowing how the output in summary(gam) gets generated, and
from what elements of a gam object.

Here is the example:

library(mgcv)
par(mfrow=c(2,2))
impute <- function (a, a.impute){
 ifelse (is.na(a), a.impute, a)
 }

#make some dumb fake data
x1.knots = c(-1,-.5,0,.5,1)
x2.knots = c(-1,-.5,0,.5,1)
K=5
x1 = rnorm(100)
x2 = rnorm(100)
y = .05*exp(x1)-.5*x1 + .1*x2 + x1*x2 + rnorm(100)
#some of it is missing
x1[81:100] = NA
x2[71:90] = NA

#do a few dumb imputations, and fit models to the partially-imputed data
x1.imp = impute(x1, rnorm(100))
x2.imp = impute(x2, rnorm(100))
m1 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots,
x2.imp = x2.knots))
plot(m1,plot.type="contour",scheme=2,main="Imp 1")

x1.imp = impute(x1, rnorm(100))
x2.imp = impute(x2, rnorm(100))
m2 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots,
x2.imp = x2.knots))
plot(m2,plot.type="contour",scheme=2,main="Imp 2")

x1.imp = impute(x1, rnorm(100))
x2.imp = impute(x2, rnorm(100))
m3 = gam(y~te(x1.imp,x2.imp,k=c(K,K)),knots = list(x1.imp = x1.knots,
x2.imp = x2.knots))
plot(m3,plot.type="contour",scheme=2,main="Imp 3")

results = list(m1,m2,m3)

#Combine the results according to rubin's rules
reps=3
bhat=results[[1]]$coeff
for (i in 2:reps){
 bhat=bhat+results[[i]]$coeff
 }
bhat = bhat/reps

W=results[[1]]$Vp
for (i in 2:reps){
 W = W+results[[i]]$Vp
 }
W = W/reps
B= (results[[1]]$coeff-bhat) %*% t(results[[1]]$coeff-bhat)
for (i in 2:reps){
 B = B+(results[[i]]$coeff-bhat) %*% t(results[[i]]$coeff-bhat)
 }
B=B/(reps-1)
Vb = W+(1+1/reps)*B

#Put the results into a convenient gam object
MI = results[[1]]
MI$coefficients=bhat
MI$Vp = Vb

#and summarize
summary(MI)
plot(MI,plot.type="contour",scheme=2,main="MI")

When I do something similar with non-fake data I get wacky f-statistics
and p-values.  For example, F could be >100 and p could equal 1.  This
probably has something to do with degrees of freedom.

My easy question:  what goes on under the hood with gam to generate
these values?  What parts of a gam object are called up?

My harder question:  how might one construct principled analogs of these
statistics in an MI context, when degrees of freedom will vary across
models, depending on the imputed data?  Has anybody thought about this,
or do I have have some serious pencil-and-paper ahead of me?

Thanks,
Andrew







--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603   http://people.bath.ac.uk/sw283

__
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] Parsing XML to tree.

2013-05-08 Thread Ben Tupper
Hi,

On May 8, 2013, at 3:43 AM, avinash sahu wrote:

> Hi All,
> 
> I am struggling to parse a XML file that describes a tree. The XML file is
> present here:
> http://www.emouseatlas.org/emap/ema/theiler_stages/StageDefinition/Stage_xml/TS23.xml
> I want is simple list of parents id of each component. The output will look
> like
> Component = [7148  7149   7150   7151. 7177..]
> Parents=[NA   7148   7149  7150  7148..]
> I meant if components are arranged from 7148 to 8419, I need their parents
> id.
> 

Why don't you show us the steps that you have tried?  I hope you are using the 
XML package for this; if not, I highly recommend it.

http://cran.r-project.org/web/packages/XML/index.html

Cheers,
Ben





> I hope this is clear.
> thanks
> avi
> 
>   [[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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
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] rowspan and readHTMLTable

2013-05-08 Thread Chris Stubben
Sorry to answer my own question - I guess here's one way to read this 
table.  Other suggestions are still welcome.


Chris

--

x<-htmlParse("
abX
YZ
c
")

# split by rows
z <- getNodeSet(x, "//tr")

# create empty data.frame - probably not the best solution...
t1<- data.frame(matrix(NA, nrow = 3,  ncol = 2 ))

for (i in 1:3){
  rowspan <- as.numeric( xpathSApply(z[[i]], ".//td", xmlGetAttr, 
"rowspan", 1) )

  val <- xpathSApply(z[[i]], ".//td", xmlValue)

  # fill values into empty cells
  n <- which(is.na(t1[i,]))
  t1[ i ,n] <- val

  if( any(rowspan > 1) ){
 for(j in 1:length( rowspan ) ){
if(rowspan[j] > 1){
## repeat value down column
  t1[ (i+1):(i+ ( rowspan[j] -1) ) , n[j] ]   <- val[j]
}
 }
  }
}


t1
 X1 X2
1 ab  X
2 ab YZ
3  c YZ


If you are interested, I used this code in the pmcTable function at 
https://github.com/cstubben/pubmed .  To get  Table 1, this now works...


doc<-pmc("PMC3544749")  # downloads XML from OAI service
t1 <- pmcTable(doc,1)  # parse table... also saves caption and footnotes 
to attributes

t1[1:4,1:4]
  Category Gen Name Rv 
number  Description
1 Lipids and Fatty Acid Metabolism kasBRv2246 
3-oxoacyl-[acyl-carrier protein] synthase 2 kasb
2   Mycolic acid synthesismmaA4   Rv0642c  
Methoxy mycolic acid synthase 4
3   Mycolic acid synthesis pcaA   Rv0470cMycolic acid 
synthase (cyclopropane synthase)
4   Mycolic acid synthesis pcaA   Rv0470cMycolic acid 
synthase (cyclopropane synthase)





--

Chris Stubben

Los Alamos National Lab
Bioscience Division
MS M888
Los Alamos, NM 87545

__
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] Some unrelated questions.

2013-05-08 Thread Harry Mamaysky
R gives you facilities for doing this (using '...' and 'missing') without 
passing in a data.frame. For example,

> foo <- function(arg1,arg2,...) { if (missing(arg1)) cat('missing arg1\n'); 
> print(list(...)) }
> foo(1,2,arg3=3,arg4=4,arg5=5)
$arg3
[1] 3
 
$arg4
[1] 4
 
$arg5
[1] 5
 
> foo(arg2=2,arg3=3,arg4=4,arg5=5)
missing arg1
$arg3
[1] 3
 
$arg4
[1] 4
 
$arg5
[1] 5
 
> 

Sent from my iPhone

On May 7, 2013, at 4:29 PM, Keith S Weintraub  wrote:

Jim,
  Thanks for your comments.
KW

--

On May 6, 2013, at 5:48 PM, Jim Lemon  wrote:

> see inline
> 
> On 05/07/2013 02:14 AM, Keith S Weintraub wrote:
>> Folks,
>> 
>> I have been working on an R project that has a few dozen functions.
>> 
>> I have some questions that are only tangentially related and might only be a 
>> difference in style.
>> 
>> 1. Some of my functions take single-row data.frames as input parameters 
>> lists. I don't force the user of the function to provide all of the 
>> parameters. I use code within a function to test if a particular parameter 
>> (column-name) exists in the data.frame and if so use the value of that 
>> parameter in a test. If the parameter doesn't exist in the data.frame then 
>> some default behavior applies like so:
>> 
>>   if("rollDown" %in% names(runParams)) rollDown<-runParams[["rollDown"]]
>>  else rollDown<-0
>> 
>> Is this good style? What are the pitfalls? Is there a better way?
> Whether it is good style or not, you must have been reading my mind. This is 
> more or less what I am working on to streamline the increasing number of 
> arguments in functions in some of the packages I maintain. At the moment I am 
> trying to work out whether it is easier to have one big function to complete 
> all the arguments or a set of smaller functions for related groups of 
> arguments.
> 
>> One nice thing about this method is that if I need to add a new parameter I 
>> don't have to change the signature of the function.
>> 
>> 2. What is a good way to organize a project with dozens of functions in R?
> Creating a package is an easy and well documented way of
> 
> 1) keeping all the functions together
> 2) checking that everything works
> 3) maintaining a record of the evolution of the project
> 
> Even a handful of functions can benefit from packaging.
> 
>> 3. My project involves a fair amount of simulation. I am not talking hours 
>> but some of my "runs" take up to 30 minutes.
>> 
>> Suppose I have a "control" function that calls a number of other functions 
>> that might benefit from compilation (using the compiler package). Is it 
>> better to compile the called functions inside or outside the control 
>> function?
>> 
>> Is there a good "idiom" or standardized way of turning compilation of the 
>> called functions on and off? What about debugging (I use the debug package)?
>> 
>> I am perfectly happy with pointers to articles, books and code.
> Jim

__
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] chronological season results assistance

2013-05-08 Thread Irucka Embry
Hi Arun, thank you. I am well.

Yes, that worked perfectly.

Irucka


<-Original Message-> 
>From: arun [smartpink...@yahoo.com]
>Sent: 5/8/2013 11:39:54 AM
>To: iruc...@mail2world.com
>Cc: r-help@r-project.org
>Subject: Re: chronological season results assistance
>
>
>
>Hi,
>I am fine.  Hope are you too.
>
>Try this:
>funFluxSumSeason <- function(DF, FUN = sum){
> month <- as.integer(format(DF$Date, format="%m"))
> year <- format(DF$Date, format="%Y")
> DF$season<- NA
> DF$season[month %in% 10:12] <- paste(year[month %in% 10:12], "Fall")
> DF$season[month %in% 1:3] <- paste(year[month %in% 1:3], "Winter")
> DF$season[month %in% 4:6] <- paste(year[month %in% 4:6], "Spring")
> DF$season[month %in% 7:9] <- paste(year[month %in% 7:9], "Summer")
> res1<-aggregate(FluxDay ~ season, data=DF, FUN = FUN) # changed here
>res1<-res[order(factor(gsub("\\d+\\s+","",res1[,1]),levels=c("Winter","
Spring","Summer","Fall"))),]
>res2<-res1[order(gsub("\\s+.*","",res1[,1])),]
>row.names(res2)<- 1:nrow(res2)
>res2
> }
>funFluxSumSeason(DailyFluxSeason,sum)
>#season   FluxDay
>#12000 Fall  2897.790
>#2  2001 Winter  7551.095
>#3  2001 Spring  4062.394
>#4  2001 Summer  4386.394
>#52001 Fall  2148.480
>#6  2002 Winter  5887.516
>#7  2002 Spring  4551.710
>#8  2002 Summer  5159.071
>#92002 Fall 10946.064
>#10 2003 Winter 20223.513
>#11 2003 Spring 14275.783
>#12 2003 Summer 16653.662
>#13   2003 Fall 13901.042
>#14 2004 Winter 13396.535
>#15 2004 Spring 10918.103
>#16 2004 Summer 37343.184
>A.K.
>
>From: Irucka Embry 
>To: smartpink...@yahoo.com 
>Cc: r-help@r-project.org 
>Sent: Wednesday, May 8, 2013 12:18 PM
>Subject: Re: chronological season results assistance
>
>
>
>Hi Arun, how are you?
>
>Thank you for your assistance. I'm sorry, but I made a mistake in what
I was seeking.
>
>For this example, this is how I would like the results to look:
>
>2000 Fall
>2001 Winter
>2001 Spring
>2001 Summer
>2001 Fall
>2002 Winter
>2002 Spring
>2002 Summer
>2002 Fall
>2003 Winter
>2003 Spring
>2003 Summer
>2003 Fall
>2004 Winter
>2004 Spring
>2004 Summer
>
>Thank you Arun.
>
>Irucka 


___Get
 the Free email that has everyone talking at http://www.mail2world.com 
target=new>http://www.mail2world.com  Unlimited 
Email Storage – POP3 – Calendar – SMS – Translator – 
Much More!
[[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] Estimating confidence intervals from several simulations

2013-05-08 Thread Zilefac Elvis
Hi,

I have 1000 simulations each arranged beneath another. The attached data is on 
monthly basis. First column is number of simulation, second is year and the 
rest, months.

Problem: 
1) Take sim 1 for example to be my original data from 1961-2005 with twelve 
months. You can delete the years. I want to obtain results with same dimensions 
as sim one but estimating the values in each row from the 1000 simulations as 
is the case with bootstrapping. Instead of bootstrapping, I have simulations 
from my model.
For example, after every 45th row, estimate values of row 1 and so on for other 
rows.

2) estimate confidence intervals for the resulting 45 rows by 12 columns 
matrix. Each value in each month and year should have a confidence interval.  
OR you could estimate confidence intervals for each value in the data attached 
and then do task 1.

3) Put the confidence intervals in 45 by 12 matrix, one matrix for lower CIs 
and another 45 by 12 matrix for upper CIs.

Thanks so much for your great help.
Atem.__
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] Tranfer data from exel into R

2013-05-08 Thread iembry
Hi, how are you?

You are welcome for my assistance. I'm sorry, but I made a mistake in my
previous post.

Is your .csv file in your working R directory?

If so, then 

H<-read.csv("Book.csv", header=TRUE, sep=",") 

should work. I am assuming that your data is comma separated and that
the names of the variables are in the first line (header).


If your .csv file is not in your working R directory, then 

H<-read.csv(file="c:/Book.csv", header=TRUE, sep=",") # replace
c:/Book.csv with the full file path

should work. 

Also check out 

?read.csv

for more information on read.csv, read.table, etc.

Irucka




<-Original Message-> 
>From: Hiep [via R] [ml-node+s789695n4666557...@n4.nabble.com]
>Sent: 5/8/2013 3:26:38 AM
>To: iruc...@mail2world.com
>Subject: Re: Tranfer data from exel into R
>
>Hi Irucka, thanks for help me 
>
>When I apply your way, I convert file exel into CSV, type:
H<-read.csv("Book.csv") 
>R show: 
>Error in file(file, "rt") : cannot open the connection 
>In addition: Warning message: 
>In file(file, "rt") : 
> cannot open file 'Book.csv': No such file or directory 
>
>I don't know why 
>
>
>
>
>If you reply to this email, your message will be added to the
discussion below:
>http://r.789695.n4.nabble.com/Tranfer-data-from-exel-into-R-tp4666452p4
666557.html 
>To unsubscribe from Tranfer data from exel into R, click here.
>NAML 


___Get
 the Free email that has everyone talking at http://www.mail2world.com 
target=new>http://www.mail2world.com  Unlimited 
Email Storage – POP3 – Calendar – SMS – Translator – 
Much More!



--
View this message in context: 
http://r.789695.n4.nabble.com/Tranfer-data-from-exel-into-R-tp4666452p4666590.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.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] chronological season results assistance

2013-05-08 Thread Irucka Embry
Hi Arun, how are you?

Thank you for your assistance. I'm sorry, but I made a mistake in what I
was seeking.

For this example, this is how I would like the results to look:

2000 Fall
2001 Winter
2001 Spring
2001 Summer
2001 Fall
2002 Winter
2002 Spring
2002 Summer
2002 Fall
2003 Winter
2003 Spring
2003 Summer
2003 Fall
2004 Winter
2004 Spring
2004 Summer

Thank you Arun.

Irucka


<-Original Message-> 
>From: arun [smartpink...@yahoo.com]
>Sent: 5/8/2013 7:53:46 AM
>To: iruc...@mail2world.com
>Cc: r-help@r-project.org
>Subject: Re: chronological season results assistance
>
>Hi,
>
>May be this helps:
>funFluxSumSeason <- function(DF, FUN = sum){
> month <- as.integer(format(DF$Date, format="%m"))
> year <- format(DF$Date, format="%Y")
> DF$season<- NA
> DF$season[month %in% 10:12] <- paste(year[month %in% 10:12], "Fall")
> DF$season[month %in% 1:3] <- paste(year[month %in% 1:3], "Winter")
> DF$season[month %in% 4:6] <- paste(year[month %in% 4:6], "Spring")
> DF$season[month %in% 7:9] <- paste(year[month %in% 7:9], "Summer")
> res1<-aggregate(FluxDay ~ season, data=DF, FUN = FUN) # changed here
>res2<-res1[order(gsub("\\d+","",res1[,1])),]
>row.names(res2)<- 1:nrow(res2)
>res2
> }
>funFluxSumSeason(DailyFluxSeason,sum)
>#season   FluxDay
>#12000 Fall  2897.790
>#22001 Fall  2148.480
>#32002 Fall 10946.064
>#42003 Fall 13901.042
>#5  2001 Spring  4062.394
>#6  2002 Spring  4551.710
>#7  2003 Spring 14275..783
>#8  2004 Spring 10918.103
>#9  2001 Summer  4386.394
>#10 2002 Summer  5159.071
>#11 2003 Summer 16653.662
>#12 2004 Summer 37343.184
>#13 2001 Winter  7551.095
>#14 2002 Winter  5887.516
>#15 2003 Winter 20223.513
>#16 2004 Winter 13396.535
>
>A.K.
>
>Hi, how are you? 
>
>I am trying to modify the existing R function so that it will 
>chronologically order the seasons beginning with Fall and ending in the
>Winter. Can you assist me in modifying the function below? 
>
>Thank you. 
>
>Irucka Embry 
>
>
>This is the R function: 
>funFluxSumSeason <- function(DF, FUN = sum){ 
> month <- as.integer(format(DF$Date, format="%m")) 
> year <- format(DF$Date, format="%Y") 
> DF$season<- NA 
> DF$season[month %in% 10:12] <- paste(year[month %in% 10:12], "Fall") 
> DF$season[month %in% 1:3] <- paste(year[month %in% 1:3], "Winter") 
> DF$season[month %in% 4:6] <- paste(year[month %in% 4:6], "Spring") 
> DF$season[month %in% 7:9] <- paste(year[month %in% 7:9], "Summer") 
> aggregate(FluxDay ~ season, data=DF, FUN = FUN) # changed here 
> } 
>
>This is the function's result: 
>dput(seasonFluxSum) 
>structure(list(season = c("2000 Fall", "2001 Fall", "2001 Spring", 
>"2001 Summer", "2001 Winter", "2002 Fall", "2002 Spring", "2002
Summer", 
>"2002 Winter", "2003 Fall", "2003 Spring", "2003 Summer", "2003
Winter", 
>"2004 Spring", "2004 Summer", "2004 Winter"), FluxDay =
c(2897.79043403356, 
>2148.48034139629, 4062.39365601964, 4386.39358258187, 7551.09451122126,
>10946.0644606408, 4551.71006202726, 5159.07068303165, 5887.51583868203,
>13901.0420234613, 14275.7834627696, 16653.6617307992, 20223.5133431944,
>10918.1025781646, 37343.1840220637, 13396.5350817751)), .Names =
c("season", 
>"FluxDay"), row.names = c(NA, -16L), class = "data.frame") 
>
>
>This is the data used to obtain the above results: 
>dput(DailyFluxSeason) 
>structure(list(Date = structure(c(11231, 11232, 11233, 11234, 
>11235, 11236, 11237, 11238, 11239, 11240, 11241, 11242, 11243, 
>11244, 11245, 11246, 11247, 11248, 11249, 11250, 11251, 11252, 
>11253, 11254, 11255, 11256, 11257, 11258, 11259, 11260, 11261, 
>11262, 11263, 11264, 11265, 11266, 11267, 11268, 11269, 11270, 
>11271, 11272, 11273, 11274, 11275, 11276, 11277, 11278, 11279, 
>11280, 11281, 11282, 11283, 11284, 11285, 11286, 11287, 11288, 
>11289, 11290, 11291, 11292, 11293, 11294, 11295, 11296, 11297, 
>11298, 11299, 11300, 11301, 11302, 11303, 11304, 11305, 11306, 
>11307, 11308, 11309, 11310, 11311, 11312, 11313, 11314, 11315, 
>11316, 11317, 11318, 11319, 11320, 11321, 11322, 11323, 11324, 
>11325, 11326, 11327, 11328, 11329, 11330, 11331, 11332, 11333, 
>11334, 11335, 11336, 11337, 11338, 11339, 11340, 11341, 11342, 
>11343, 11344, 11345, 11346, 11347, 11348, 11349, 11350, 11351, 
>11352, 11353, 11354, 11355, 11356, 11357, 11358, 11359, 11360, 
>11361, 11362, 11363, 11364, 11365, 11366, 11367, 11368, 11369, 
>11370, 11371, 11372, 11373, 11374, 11375, 11376, 11377, 11378, 
>11379, 11380, 11381, 11382, 11383, 11384, 11385, 11386, 11387, 
>11388, 11389, 11390, 11391, 11392, 11393, 11394, 11395, 11396, 
>11397, 11398, 11399, 11400, 11401, 11402, 11403, 11404, 11405, 
>11406, 11407, 11408, 11409, 11410, 11411, 11412, 11413, 11414, 
>11415, 11416, 11417, 11418, 11419, 11420, 11421, 11422, 11423, 
>11424, 11425, 11426, 11427, 11428, 11429, 11430, 11431, 11432, 
>11433, 11434, 11435, 11436, 11437, 11438, 11439, 11440, 11441, 
>11442, 11443, 11444, 11445, 11446, 11447, 11448, 11449, 11450, 
>11451, 11452, 11453, 11454, 11455, 11456, 11457, 11458, 11459, 
>11460,

[R] Using the Sun Grid Engine with R-3.0

2013-05-08 Thread Hubert Rehrauer

Dear all

In previous R versions I ran R jobs on our cluster managed by SUN Grid 
Engine using the Rsge package. With the R-3.0 release, the package Rsge 
has been discontinued. What would be the equivalent way of running jobs 
on the cluster using current packages?


I understand that the parallel package has been updated. What would be 
the equivalent to the lines below:


require(Rsge)
sge.options("sge.qsub.options"="-cwd -q GT -pe smp 8 -l C=2")
sge.options("sge.save.global"=TRUE)
sge.options("sge.remove.files"=TRUE)

jobList = list( )
myJobFunc  = function(x) {}
result = sge.parLapply(jobList, myJobFunc, njobs=length(jobList))

Many thanks
Hubert Rehrauer

__
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] scatter plot matrix with different x-y variables

2013-05-08 Thread Adel
Dear list-members,

I wonder if there is a way of creating a scatter plot table/grid with
different variables on the y-axis compared to the x-axis? Something like
this:

 A***
B***
C***
-XYZ


I know that you can create scatter plot matrix with the same variables on
the
y-axis as on the x-axis, like this:



A*
*B
**C***
***X**
Y*
*Z

But this is not what I want. I basically want to get a visual
representation of different dependent variables (y-axis) on various
independent variables (x-axis). So I want it to look like a scatter plot
matrix or grid, but with my own specified variables on each axis.

Secondly, to add to this, can I add a correlation line (linear and
quadratic)
through all scatter plots with both correlation and R2 values?


All help appreciated.

Adel

-- 
Adel Daoud, PhD
Department of Sociology,  University of Gothenburg
Box 720
405 30 Göteborg, SWEDEN
Visiting address: Sprängkullsgatan 25, room F411
+46 031-786 47 84
adel.da...@sociology.gu.se




--
View this message in context: 
http://r.789695.n4.nabble.com/scatter-plot-matrix-with-different-x-y-variables-tp4666598.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.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] generate gaussian

2013-05-08 Thread Iut
Dear Sir,

My name is Iut Tri Utami. i am beginning user.  I have a problem about
generate data in R. It consists of one disk generated by a Gaussian N(0,
0.167) and one ring generated by a Gaussian N(R, 0.1). The mean R was
generated from its polar coordinates. The angle was drawn from a uniform
distribution on the interval (0, 2ð), and the radius, from a Gaussian N(1.5,
0.1). The class sizes are 500 and 2000.
 

Thank you very much for your attention and, I wish that you will help me.  

Best wishes ,

Iut Tri Utami


[[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] Correctly Setting New Seed

2013-05-08 Thread Ellerbe, Caitlyn Nicole
Could someone please suggest a method to store the current random seed. I'm 
having trouble understanding how to correctly use set.seed and .Random.seed.

Specifically, I have the following code that crashes:



set.seed(seed)

for(i in 1:10){

  print( runif(1))

}



To get around this I need to split the number of iterations into chunks:



set.seed(seed)

for(i in 1:5){

print(runif(1))

new.seed<-.Random.seed

}



set.seed(new.seed)

for(i in 6:10){

print(runif(1))

}



When I compare the sequence of numbers from the single run to the sequence from 
the chunked code they don't match. Is the .Random.seed argument in the wrong 
position or is there another way to accomplish this?

---
Caitlyn Ellerbe

Division of Biostatistics
Department of Public Health
Medical University of South Carolina


[[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] Correctly Setting New Seed

2013-05-08 Thread Jeff Newmiller
"Crashes" is not a clear description. When I execute the statement:

set.seed(seed)

I get the error

Error in set.seed(seed) : object 'seed' not found

which makes sense because there is no variable defined that is called "seed".

Choose a literal value like 42:

set.seed(42)

or define the variable

seed <- 42
set.seed(seed)

and you should not get that error.

If you get a different error message, then give us a better clue how to 
reproduce it. (Also, please post plain text email as the Posting Guide 
requests. You have read that, right?)
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

"Ellerbe, Caitlyn Nicole"  wrote:

>Could someone please suggest a method to store the current random seed.
>I'm having trouble understanding how to correctly use set.seed and
>.Random.seed.
>
>Specifically, I have the following code that crashes:
>
>
>
>set.seed(seed)
>
>for(i in 1:10){
>
>  print( runif(1))
>
>}
>
>
>
>To get around this I need to split the number of iterations into
>chunks:
>
>
>
>set.seed(seed)
>
>for(i in 1:5){
>
>print(runif(1))
>
>new.seed<-.Random.seed
>
>}
>
>
>
>set.seed(new.seed)
>
>for(i in 6:10){
>
>print(runif(1))
>
>}
>
>
>
>When I compare the sequence of numbers from the single run to the
>sequence from the chunked code they don't match. Is the .Random.seed
>argument in the wrong position or is there another way to accomplish
>this?
>
>---
>Caitlyn Ellerbe
>
>Division of Biostatistics
>Department of Public Health
>Medical University of South Carolina
>
>
>   [[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] Very basic statistics in R

2013-05-08 Thread Robert Baer

On 5/6/2013 7:02 AM, arun wrote:
   stErr<- sd(vec1)/sqrt(length(vec1))

Or possibly,

 stErr<- sd(vec1)/sqrt(!is.na(vec1))


--

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksille College of Osteopathic Medicine
A. T. Still University of Health Sciences
Kirksville, MO 63501 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] generate gaussian

2013-05-08 Thread John Kane
Someone probably could help but you did not tell us what the problem is.

 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


> -Original Message-
> From: triutami@gmail.com
> Sent: Thu, 9 May 2013 00:03:25 +0700
> To: r-help@r-project.org
> Subject: [R] generate gaussian
> 
> Dear Sir,
> 
> My name is Iut Tri Utami. i am beginning user.  I have a problem about
> generate data in R. It consists of one disk generated by a Gaussian N(0,
> 0.167) and one ring generated by a Gaussian N(R, 0.1). The mean R was
> generated from its polar coordinates. The angle was drawn from a uniform
> distribution on the interval (0, 2p), and the radius, from a Gaussian
> N(1.5,
> 0.1). The class sizes are 500 and 2000.
> 
> 
> Thank you very much for your attention and, I wish that you will help me.
> 
> Best wishes ,
> 
> Iut Tri Utami
> 
> 
>   [[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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
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] Correctly Setting New Seed

2013-05-08 Thread Ellerbe, Caitlyn Nicole
By crash, I mean that it shuts the program and no error message is provided. 
However, my question is more general - how to get the two versions of code 
below to return the same string of random numbers. The code provided will run 
without incident  and is only provided to make the problem clear. The true code 
that causes the crash isn't necessary, only that I need to be able to split it 
into smaller chunks while maintaining the integrity of the random sequence even 
if the program closes and all information is lost. 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Ellerbe, Caitlyn Nicole
Sent: Wednesday, May 08, 2013 2:06 PM
To: r-help@R-project.org
Subject: [R] Correctly Setting New Seed

Could someone please suggest a method to store the current random seed. I'm 
having trouble understanding how to correctly use set.seed and .Random.seed.

Specifically, I have the following code that crashes:



set.seed(seed)

for(i in 1:10){

  print( runif(1))

}



To get around this I need to split the number of iterations into chunks:



set.seed(seed)

for(i in 1:5){

print(runif(1))

new.seed<-.Random.seed

}



set.seed(new.seed)

for(i in 6:10){

print(runif(1))

}



When I compare the sequence of numbers from the single run to the sequence from 
the chunked code they don't match. Is the .Random.seed argument in the wrong 
position or is there another way to accomplish this?

---
Caitlyn Ellerbe

Division of Biostatistics
Department of Public Health
Medical University of South Carolina


[[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] scatter plot matrix with different x-y variables

2013-05-08 Thread John Kane
Several ways but I find that grid.arrange in the  gridExtra package combined 
with ggplot2 to draw the actual graphs works nicely.

You might also want to look mfcol or mfrow in ?par 

### quick and dirty example of ggplot2/gridExtra

library(ggplot2)
library(gridExtra)

mdat  <-  data.frame(a= 1:5, b=1:5)
ndat  <-  data.frame(x = rnorm(20), y =  rnorm(20))
p  <-  ggplot(mdat  , aes(a,b, colour = 'red'   )) + geom_point() +
theme(legend.position="none")
  

p 
q  <-  ggplot(ndat , aes( x, y  )) + geom_line() 
q

grid.arrange(p, q)
###  
I imagine that you will need to install the ggplot2 and gridExtra packages. See 
?install.packages for help
John Kane
Kingston ON Canada


> -Original Message-
> From: adelda...@gmail.com
> Sent: Wed, 8 May 2013 09:49:25 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] scatter plot matrix with different x-y variables
> 
> Dear list-members,
> 
> I wonder if there is a way of creating a scatter plot table/grid with
> different variables on the y-axis compared to the x-axis? Something like
> this:
> 
>  A***
> B***
> C***
> -XYZ
> 
> 
> I know that you can create scatter plot matrix with the same variables on
> the
> y-axis as on the x-axis, like this:
> 
> 
> 
> A*
> *B
> **C***
> ***X**
> Y*
> *Z
> 
> But this is not what I want. I basically want to get a visual
> representation of different dependent variables (y-axis) on various
> independent variables (x-axis). So I want it to look like a scatter plot
> matrix or grid, but with my own specified variables on each axis.
> 
> Secondly, to add to this, can I add a correlation line (linear and
> quadratic)
> through all scatter plots with both correlation and R2 values?
> 
> 
> All help appreciated.
> 
> Adel
> 
> --
> Adel Daoud, PhD
> Department of Sociology,  University of Gothenburg
> Box 720
> 405 30 GC6teborg, SWEDEN
> Visiting address: SprC$ngkullsgatan 25, room F411
> +46 031-786 47 84
> adel.da...@sociology.gu.se
> 
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/scatter-plot-matrix-with-different-x-y-variables-tp4666598.html
> Sent from the R help mailing list archive at Nabble.com.
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.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.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
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] PPCOR: Semipartial Correlation & Regression weights

2013-05-08 Thread Torvon
In linear regression, regression weights of x1 on Y given x2 and x3 should
be mathematically identical to the semipartial correlations between x1 and
Y, given x2 and x3.

However, I do not obtain identical results, so apparently I'm doing
something wrong in R.

Data preparation:
data<-read.csv("file.csv", head=T)
data <- subset(data, select=c(age,s1,s2,s3,s5,s10,WSAS01))
data <- na.omit(data1)

In the following example, I am interested in the regression
coefficient/semi-partial correlation of s1(x) and WSAS01 (y).

Regression:
m1 <- lm(WSAS01 ~ s1+s2+s3+s5+s10+age, data=data)
summary(m1)
regression coefficient s1: 0.091

Semipartial Correlation:
library(ppcor)
spcor.test(data$s1,data$WSAS01,data[,c("age","s2","s3","s5","s10")])
semi-partial correlation s1 with WSAS01: 0.202

What am I doing wrong?

Thank you
T

[[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] Correctly Setting New Seed

2013-05-08 Thread John Kane
I was wondering about that code.  It seemed to run alright for me.
We really need to see the code and hopefully the data, or a,sample thereof, 
that is causing the actual crash.  Prefereably cut out anything that is not 
causing the problem and ship us the bare minimum of code.


 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Thanks

John Kane
Kingston ON Canada


> -Original Message-
> From: eller...@musc.edu
> Sent: Wed, 8 May 2013 14:50:42 -0400
> To: eller...@musc.edu, r-help@r-project.org
> Subject: Re: [R] Correctly Setting New Seed
> 
> By crash, I mean that it shuts the program and no error message is
> provided. However, my question is more general - how to get the two
> versions of code below to return the same string of random numbers. The
> code provided will run without incident  and is only provided to make the
> problem clear. The true code that causes the crash isn't necessary, only
> that I need to be able to split it into smaller chunks while maintaining
> the integrity of the random sequence even if the program closes and all
> information is lost.
> 
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Ellerbe, Caitlyn Nicole
> Sent: Wednesday, May 08, 2013 2:06 PM
> To: r-help@R-project.org
> Subject: [R] Correctly Setting New Seed
> 
> Could someone please suggest a method to store the current random seed.
> I'm having trouble understanding how to correctly use set.seed and
> .Random.seed.
> 
> Specifically, I have the following code that crashes:
> 
> 
> 
> set.seed(seed)
> 
> for(i in 1:10){
> 
>   print( runif(1))
> 
> }
> 
> 
> 
> To get around this I need to split the number of iterations into chunks:
> 
> 
> 
> set.seed(seed)
> 
> for(i in 1:5){
> 
> print(runif(1))
> 
> new.seed<-.Random.seed
> 
> }
> 
> 
> 
> set.seed(new.seed)
> 
> for(i in 6:10){
> 
> print(runif(1))
> 
> }
> 
> 
> 
> When I compare the sequence of numbers from the single run to the
> sequence from the chunked code they don't match. Is the .Random.seed
> argument in the wrong position or is there another way to accomplish
> this?
> 
> ---
> Caitlyn Ellerbe
> 
> Division of Biostatistics
> Department of Public Health
> Medical University of South Carolina
> 
> 
>   [[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.


GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at 
http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most 
webmails

__
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] how to read numeric vector as factors using read.table.ffdf

2013-05-08 Thread MacQueen, Don
Please read the posting guide.

Your question is far from clear. First you're apparently unhappy because
character vectors are being converted to factors. Then later you ask how
to tell a function that some numeric datas should be considered factors.
Which is it that you want? A simple short example would help.

> help.search('read.table.ffdf')
No vignettes or demos or help files found with alias or concept or title
matching 'read.table.ffdf' using regular expression matching.

> help.search('biglm.big.matrix')
No vignettes or demos or help files found with alias or concept or title
matching 'biglm.big.matrix' using regular expression matching.

You need to provide information about where these apparent functions come
from. 

Regardless, if after using read.table.ffdf you have a data frame, you can
convert any column, numeric or character, to a factor using the factor()
function. You can also convert factors back to characters using, for
example, format().

In other 'read' functions, such as read.table, when character data is
converted to factors, the "labels" are not lost. Perhaps the documentation
for read.table.ffdf describes how to prevent conversion to factor.

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 5/7/13 3:46 PM, "li li"  wrote:

>I have a big data set that includes character variables of many different
>values. I'm trying to use ff to read the data and then use
>biglm.big.matrix
>to build linear models. However, since big.matrix will convert all
>character vectors to factors and the character labels will be lost. I
>decided to create a lookup table outside of R for my character columns and
>use numbers to represent different levels for R. However, I do not know
>how
>to tell read.table.ffdf these columns should be considered factors instead
>of numerics. Please help. thanks.
>
>   [[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] Very basic statistics in R

2013-05-08 Thread peter dalgaard

On May 8, 2013, at 20:38 , Robert Baer wrote:

> On 5/6/2013 7:02 AM, arun wrote:
>   stErr<- sd(vec1)/sqrt(length(vec1))
> 
> Or possibly,
> 
> stErr<- sd(vec1)/sqrt(!is.na(vec1))
> 

You probably intended sqrt(sum(!is.na(...))).

-- 
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.


Re: [R] Correctly Setting New Seed

2013-05-08 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ellerbe, Caitlyn Nicole
> Sent: Wednesday, May 08, 2013 11:51 AM
> To: Ellerbe, Caitlyn Nicole; r-help@R-project.org
> Subject: Re: [R] Correctly Setting New Seed
> 
> By crash, I mean that it shuts the program and no error message is
> provided. However, my question is more general - how to get the two
> versions of code below to return the same string of random numbers. The
> code provided will run without incident  and is only provided to make
> the problem clear. The true code that causes the crash isn't necessary,
> only that I need to be able to split it into smaller chunks while
> maintaining the integrity of the random sequence even if the program
> closes and all information is lost.
> 
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ellerbe, Caitlyn Nicole
> Sent: Wednesday, May 08, 2013 2:06 PM
> To: r-help@R-project.org
> Subject: [R] Correctly Setting New Seed
> 
> Could someone please suggest a method to store the current random seed.
> I'm having trouble understanding how to correctly use set.seed and
> .Random.seed.
> 
> Specifically, I have the following code that crashes:
> 
> 
> 
> set.seed(seed)
> 
> for(i in 1:10){
> 
>   print( runif(1))
> 
> }
> 
> 
> 
> To get around this I need to split the number of iterations into
> chunks:
> 
> 
> 
> set.seed(seed)
> 
> for(i in 1:5){
> 
> print(runif(1))
> 
> new.seed<-.Random.seed
> 
> }
> 
> 
> 
> set.seed(new.seed)
> 
> for(i in 6:10){
> 
> print(runif(1))
> 
> }
> 
> 
> 
> When I compare the sequence of numbers from the single run to the
> sequence from the chunked code they don't match. Is the .Random.seed
> argument in the wrong position or is there another way to accomplish
> this?
> 

To answer your specific question, you need to change the line

set.seed(new.seed)

To 

.Random.seed <- new.seed


Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


__
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] ecdf --- title suggestion and question

2013-05-08 Thread ivo welch
dear R-experts---first, a suggestion to martin: the ecdf() function
could have an optional parameter to set the title.  by looking at
str(), I see the plot title is set in an attr named "call".  i.e., I
can reset it as

ee <- ecdf( rnorm(25 ) )
attr(ee,"call") <- "my own title"
plot(ee)

alas, I cannot figure out how to get rid of the title altogether.
attr(ee,"call") <- NULL gives me two quotation marks ("") .  is it
possible to remove the title altogether?

regards,

/iaw

Ivo Welch (ivo.we...@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.


Re: [R] ecdf --- title suggestion and question

2013-05-08 Thread Steve Lianoglou
Hi Ivo,

On Wed, May 8, 2013 at 1:37 PM, ivo welch  wrote:
> dear R-experts---first, a suggestion to martin: the ecdf() function
> could have an optional parameter to set the title.  by looking at
> str(), I see the plot title is set in an attr named "call".  i.e., I
> can reset it as
>
> ee <- ecdf( rnorm(25 ) )
> attr(ee,"call") <- "my own title"
> plot(ee)

Why not just:

R> plot(ee, main="my own title")

> alas, I cannot figure out how to get rid of the title altogether.
> attr(ee,"call") <- NULL gives me two quotation marks ("") .  is it
> possible to remove the title altogether?

R> plot(ee, main="")
R> plot(ee, main=NULL)

-steve

--
Steve Lianoglou
Computational Biologist
Department of Bioinformatics and Computational Biology
Genentech

__
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] ecdf --- title suggestion and question

2013-05-08 Thread ivo welch
ooops...never mind.  I mixed up "title" and "main" as options.


Ivo Welch (ivo.we...@gmail.com)

On Wed, May 8, 2013 at 1:54 PM, Steve Lianoglou
 wrote:
> Hi Ivo,
>
> On Wed, May 8, 2013 at 1:37 PM, ivo welch  wrote:
>> dear R-experts---first, a suggestion to martin: the ecdf() function
>> could have an optional parameter to set the title.  by looking at
>> str(), I see the plot title is set in an attr named "call".  i.e., I
>> can reset it as
>>
>> ee <- ecdf( rnorm(25 ) )
>> attr(ee,"call") <- "my own title"
>> plot(ee)
>
> Why not just:
>
> R> plot(ee, main="my own title")
>
>> alas, I cannot figure out how to get rid of the title altogether.
>> attr(ee,"call") <- NULL gives me two quotation marks ("") .  is it
>> possible to remove the title altogether?
>
> R> plot(ee, main="")
> R> plot(ee, main=NULL)
>
> -steve
>
> --
> Steve Lianoglou
> Computational Biologist
> Department of Bioinformatics and Computational Biology
> Genentech

__
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] Parsing XML to tree.

2013-05-08 Thread avinash sahu
Hi All,

I am using XML package. Even this type of simple parse is not giving
intended result.
tissue.tree <- xmlTreeParse("
http://www.emouseatlas.org/emap/ema/theiler_stages/StageDefinition/Stage_xml/TS23.xml";,
handlers=list(
  anatomy=function(x,attr) {x},
  component=function(x,attr) {x},
  parentId=function(x,attr) {x},
  startElement=function(x,attr){ NULL}, isURL=T),
asTree=T, isURL=T)

I just need componentId and parentId From that xml and remove everything
else.
thanks
avi

On Wed, May 8, 2013 at 12:37 PM, Ben Tupper  wrote:

> Hi,
>
> On May 8, 2013, at 3:43 AM, avinash sahu wrote:
>
> > Hi All,
> >
> > I am struggling to parse a XML file that describes a tree. The XML file
> is
> > present here:
> >
> http://www.emouseatlas.org/emap/ema/theiler_stages/StageDefinition/Stage_xml/TS23.xml
> > I want is simple list of parents id of each component. The output will
> look
> > like
> > Component = [7148  7149   7150   7151. 7177..]
> > Parents=[NA   7148   7149  7150  7148..]
> > I meant if components are arranged from 7148 to 8419, I need their
> parents
> > id.
> >
>
> Why don't you show us the steps that you have tried?  I hope you are using
> the XML package for this; if not, I highly recommend it.
>
> http://cran.r-project.org/web/packages/XML/index.html
>
> Cheers,
> Ben
>
>
>
>
>
> > I hope this is clear.
> > thanks
> > avi
> >
> >   [[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.
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> __
> 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.
>

[[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] Very basic statistics in R

2013-05-08 Thread Rui Barradas

Hello,

Or, to make it complete, use the na.rm argument.

sd(vec1, na.rm = TRUE)/sqrt(sum(!is.na(vec1)))

Rui Barradas

Em 08-05-2013 20:55, peter dalgaard escreveu:


On May 8, 2013, at 20:38 , Robert Baer wrote:


On 5/6/2013 7:02 AM, arun wrote:
   stErr<- sd(vec1)/sqrt(length(vec1))

Or possibly,

stErr<- sd(vec1)/sqrt(!is.na(vec1))



You probably intended sqrt(sum(!is.na(...))).



__
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] Parsing XML to tree.

2013-05-08 Thread Gabor Grothendieck
On Wed, May 8, 2013 at 3:43 AM, avinash sahu  wrote:
> Hi All,
>
> I am struggling to parse a XML file that describes a tree. The XML file is
> present here:
> http://www.emouseatlas.org/emap/ema/theiler_stages/StageDefinition/Stage_xml/TS23.xml
> I want is simple list of parents id of each component. The output will look
> like
> Component = [7148  7149   7150   7151. 7177..]
> Parents=[NA   7148   7149  7150  7148..]
> I meant if components are arranged from 7148 to 8419, I need their parents
> id.
>

Try this:

library(XML)

URL <- 
"http://www.emouseatlas.org/emap/ema/theiler_stages/StageDefinition/Stage_xml/TS23.xml";
root <- xmlTreeParse(URL, useInternalNodes = TRUE)

fn <- function(node) {
   id <- xmlAttrs(node)["id"]
   parent.id <- xmlAttrs(xmlParent(node))["id"]
   setNames(head(c(id, parent.id, NA), 2), c("id", "parent"))
}
parents <- t(xpathSApply(root, "//component", fn))

parents[1:4, ]

The last line shows the first 4 child/parent pairs as follows:

 id parent
[1,] "7148" NA
[2,] "7149" "7148"
[3,] "7150" "7149"
[4,] "7151" "7150"



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at 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.


Re: [R] Correctly Setting New Seed

2013-05-08 Thread jim holtman
This approach gives the same results:

> set.seed(1)
> for (i in 1:10) print(runif(1))
[1] 0.2655087
[1] 0.3721239
[1] 0.5728534
[1] 0.9082078
[1] 0.2016819
[1] 0.8983897
[1] 0.9446753
[1] 0.6607978
[1] 0.629114
[1] 0.06178627
>
> set.seed(1)
> for (i in 1:5) print(runif(1))
[1] 0.2655087
[1] 0.3721239
[1] 0.5728534
[1] 0.9082078
[1] 0.2016819
> for (i in 6:10) print(runif(1))
[1] 0.8983897
[1] 0.9446753
[1] 0.6607978
[1] 0.629114
[1] 0.06178627
>


On Wed, May 8, 2013 at 2:06 PM, Ellerbe, Caitlyn Nicole
wrote:

> Could someone please suggest a method to store the current random seed.
> I'm having trouble understanding how to correctly use set.seed and
> .Random.seed.
>
> Specifically, I have the following code that crashes:
>
>
>
> set.seed(seed)
>
> for(i in 1:10){
>
>   print( runif(1))
>
> }
>
>
>
> To get around this I need to split the number of iterations into chunks:
>
>
>
> set.seed(seed)
>
> for(i in 1:5){
>
> print(runif(1))
>
> new.seed<-.Random.seed
>
> }
>
>
>
> set.seed(new.seed)
>
> for(i in 6:10){
>
> print(runif(1))
>
> }
>
>
>
> When I compare the sequence of numbers from the single run to the sequence
> from the chunked code they don't match. Is the .Random.seed argument in the
> wrong position or is there another way to accomplish this?
>
> ---
> Caitlyn Ellerbe
>
> Division of Biostatistics
> Department of Public Health
> Medical University of South Carolina
>
>
> [[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.
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

[[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] Very basic statistics in R

2013-05-08 Thread David Winsemius

On May 8, 2013, at 12:55 PM, peter dalgaard wrote:

> 
> On May 8, 2013, at 20:38 , Robert Baer wrote:
> 
>> On 5/6/2013 7:02 AM, arun wrote:
>>  stErr<- sd(vec1)/sqrt(length(vec1))
>> 
>> Or possibly,
>> 
>> stErr<- sd(vec1)/sqrt(!is.na(vec1))
>> 
> 
> You probably intended sqrt(sum(!is.na(...))).

And if 'vec1' has NA's in it, he would also need:  sd(vec1, na.rm=TRUE)

-- 

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.


[R] NMDS with missing data?

2013-05-08 Thread Elizabeth Beck
Hi,
I'm trying to run NMDS (non-metric multidimensional scaling) with R vegan
(metaMDS) but I have a few NAs in my data set. I've tried to run it 2 ways.

The first way with my entire data set which includes variables such as ID,
sex, exposure, treatment, sodium, potassium, chloride

mydata.mds<-metaMDS(dat)

I get the following error:

 in if (any(autotransform, noshare > 0, wascores) && any(comm < 0)) { :
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In Ops.factor(left, right) : < not meaningful for factors
2: In Ops.factor(left, right) : < not meaningful for factors
3: In Ops.factor(left, right) : < not meaningful for factors
4: In Ops.factor(left, right) : < not meaningful for factors
5: In Ops.factor(left, right) : < not meaningful for factors

The second way with only those last biochemical variables (29 in total).

mydata.mds<-metaMDS(measurements)

I get this error:

Error in if (any(autotransform, noshare > 0, wascores) && any(comm < 0)) {
:
  missing value where TRUE/FALSE needed

My go to "na.rm=TRUE" does nothing. Any ideas on how to account for NAs and
if so which of the above options I should be using?
Thanks!
Elizabeth

[[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] R unable to access internet to install packages

2013-05-08 Thread Alex Collier
Hi,

I am having some trouble trying to install a number of packages in R on my work 
computer. An example of the code I am using is as follows:

install.packages("ggplot2",dependencies=TRUE)

An example of the error messages I am getting is:

Warning: unable to access index for repository 
http://cran.stat.auckland.ac.nz/bin/windows/contrib/2.9
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.9
Warning messages:
1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
2: In getDependencies(pkgs, dependencies, available, lib) :
  package ‘ggplot2’ is not available

The version of R I am using is 2.9.1.

I have tried the same script at home with no problems and also at my previous 
workplace. I thought it may be to do with not having IT administrator 
privileges but and IT administrator tried with the same result and also tried 
the latest version of R with the same result. The It administrator also did not 
see any internet traffic from my machine when I tried the install so we have 
come to the conclusion that R must not be able to access the internet from my 
machine – I do have general internet access.

We are using a proxy server (TMG – Microsoft’s Threat Management Gateway). Can 
R work with a proxy server on the network?
If so, how should this be configured so that a Network Administrator can make 
the appropriate changes?

Thanks for your help.

Regards,

Alex Collier



Nâku noa nâ
Alex Collier
Research Analyst
SuPERU (Social Policy Evaluation and Research Unit)
Families Commission | Kômihâna â Whânau
Level 5, Public Trust Building
117-125 Lambton Quay
PO Box 2839
WELLINGTON

DDI  04 917 7048 | Fax  04 917 7059
Email: alex.coll...@nzfamilies.org.nz
Web:  www.nzfamilies.org.nz
Follow us on 
Facebook | 
Follow us on Twitter
A centre of excellence about families and whânau


--
This email is confidential. If it is not intended for you please do not read, 
distribute or copy it or any attachments. Please notify the sender by return 
email and delete the original message and any attachments.

Any views expressed in this email may be those of the individual sender and may 
not necessarily reflect the views of the Families Commission.

--

[[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] [newbie] *apply to matching elements of n arrays?

2013-05-08 Thread Tom Roche

How to apply a function to all elements with the same indices in
multiple arrays? E.g.:

I have two spatial grids defined the same way (i.e., same number of
rows and columns--and dimensions, both 2D). Wherever both

* the value of an element i,j in the first grid is NA
* the value of element i,j in the second grid is !NA

I want to copy the value from grid2[i,j] to grid1[i,j]. These matrices
are not too big, so I'm able to do this with loops, but I know that's
not "the R way." How to parallelize/vectorize this, e.g., with a
single call to an 'apply'-type method? I believe I know how to operate
on a single matrix (e.g., by using `apply` to traverse it by rows or
cols), but not how to operate on multiple matrices.

Extra points for solutions that generalize to 3D or 4D (i.e., that allow
applying the same function to identical elements in n arrays of n
dimensions), since I will almost certainly need to work on arrays of
those dimensions eventually.

Apologies if this is a FAQ, but a fair amount of googling via
rseek.org is not finding an answer (perhaps because I'm not using the
correct search terms). Feel free (in fact, be encouraged :-) to reply
directly to me as well as the list (I'm on the digest, which gets huge).

TIA, Tom Roche 

__
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] R unable to access internet to install packages

2013-05-08 Thread Jeff Newmiller
a) You really should upgrade your version of R.

b) You have not indicated clearly what your operating system is as the Posting 
Guide requests of you (e.g. sessionInfo()), but if it is Windows then you 
should look at the R for Windows FAQ (section 2.19).
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Alex Collier  wrote:

>Hi,
>
>I am having some trouble trying to install a number of packages in R on
>my work computer. An example of the code I am using is as follows:
>
>install.packages("ggplot2",dependencies=TRUE)
>
>An example of the error messages I am getting is:
>
>Warning: unable to access index for repository
>http://cran.stat.auckland.ac.nz/bin/windows/contrib/2.9
>Warning: unable to access index for repository
>http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.9
>Warning messages:
>1: In open.connection(con, "r") : unable to resolve
>'cran.r-project.org'
>2: In getDependencies(pkgs, dependencies, available, lib) :
>  package �ggplot2� is not available
>
>The version of R I am using is 2.9.1.
>
>I have tried the same script at home with no problems and also at my
>previous workplace. I thought it may be to do with not having IT
>administrator privileges but and IT administrator tried with the same
>result and also tried the latest version of R with the same result. The
>It administrator also did not see any internet traffic from my machine
>when I tried the install so we have come to the conclusion that R must
>not be able to access the internet from my machine � I do have general
>internet access.
>
>We are using a proxy server (TMG � Microsoft�s Threat Management
>Gateway). Can R work with a proxy server on the network?
>If so, how should this be configured so that a Network Administrator
>can make the appropriate changes?
>
>Thanks for your help.
>
>Regards,
>
>Alex Collier
>
>
>
>N�ku noa n�
>Alex Collier
>Research Analyst
>SuPERU (Social Policy Evaluation and Research Unit)
>Families Commission | K�mih�na � Wh�nau
>Level 5, Public Trust Building
>117-125 Lambton Quay
>PO Box 2839
>WELLINGTON
>
>DDI  04 917 7048 | Fax  04 917 7059
>Email:
>alex.coll...@nzfamilies.org.nz
>Web:  www.nzfamilies.org.nz
>Follow us on
>Facebook
>| Follow us on Twitter
>A centre of excellence about families and wh�nau
>
>
>--
>This email is confidential. If it is not intended for you please do not
>read, distribute or copy it or any attachments. Please notify the
>sender by return email and delete the original message and any
>attachments.
>
>Any views expressed in this email may be those of the individual sender
>and may not necessarily reflect the views of the Families Commission.
>
>--
>
>   [[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] R unable to access internet to install packages

2013-05-08 Thread Pascal Oettli

Hello,

About problem for R to download files:
http://cran.r-project.org/bin/windows/rw-FAQ.html#The-Internet-download-functions-fail_002e

The repertory "2.9" for the second mirror doesn't exist.

Hope this helps,
Pascal


On 05/09/2013 09:30 AM, Alex Collier wrote:

Hi,

I am having some trouble trying to install a number of packages in R on my work 
computer. An example of the code I am using is as follows:

install.packages("ggplot2",dependencies=TRUE)

An example of the error messages I am getting is:

Warning: unable to access index for repository 
http://cran.stat.auckland.ac.nz/bin/windows/contrib/2.9
Warning: unable to access index for repository 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.9
Warning messages:
1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
2: In getDependencies(pkgs, dependencies, available, lib) :
   package 組gplot2� is not available

The version of R I am using is 2.9.1.

I have tried the same script at home with no problems and also at my previous 
workplace. I thought it may be to do with not having IT administrator 
privileges but and IT administrator tried with the same result and also tried 
the latest version of R with the same result. The It administrator also did not 
see any internet traffic from my machine when I tried the install so we have 
come to the conclusion that R must not be able to access the internet from my 
machine � I do have general internet access.

We are using a proxy server (TMG � Microsoft痴 Threat Management Gateway). Can R 
work with a proxy server on the network?
If so, how should this be configured so that a Network Administrator can make 
the appropriate changes?

Thanks for your help.

Regards,

Alex Collier



N稾u noa n�
Alex Collier
Research Analyst
SuPERU (Social Policy Evaluation and Research Unit)
Families Commission | Kih穗a � Wh穗au
Level 5, Public Trust Building
117-125 Lambton Quay
PO Box 2839
WELLINGTON

DDI  04 917 7048 | Fax  04 917 7059
Email: alex.coll...@nzfamilies.org.nz
Web:  www.nzfamilies.org.nz
Follow us on 
Facebook | Follow 
us on Twitter
A centre of excellence about families and wh穗au


--
This email is confidential. If it is not intended for you please do not read, 
distribute or copy it or any attachments. Please notify the sender by return 
email and delete the original message and any attachments.

Any views expressed in this email may be those of the individual sender and may 
not necessarily reflect the views of the Families Commission.

--

[[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] [newbie] *apply to matching elements of n arrays?

2013-05-08 Thread Jeff Newmiller
Not particularly interested in "points" from you. Would like reproducibility 
from you [1], including dput of before and after data, and (inefficient) code 
of course.

 For loops are part of R.. If your data structure is not set up to take 
advantage of vectorization, then for loops are generally of the same order of 
speed as apply functions, and are perfectly usable. You may benefit from 
sensible memory management optimizations, or from a data reorganization so you 
can do vector computations.

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Tom Roche  wrote:

>
>How to apply a function to all elements with the same indices in
>multiple arrays? E.g.:
>
>I have two spatial grids defined the same way (i.e., same number of
>rows and columns--and dimensions, both 2D). Wherever both
>
>* the value of an element i,j in the first grid is NA
>* the value of element i,j in the second grid is !NA
>
>I want to copy the value from grid2[i,j] to grid1[i,j]. These matrices
>are not too big, so I'm able to do this with loops, but I know that's
>not "the R way." How to parallelize/vectorize this, e.g., with a
>single call to an 'apply'-type method? I believe I know how to operate
>on a single matrix (e.g., by using `apply` to traverse it by rows or
>cols), but not how to operate on multiple matrices.
>
>Extra points for solutions that generalize to 3D or 4D (i.e., that
>allow
>applying the same function to identical elements in n arrays of n
>dimensions), since I will almost certainly need to work on arrays of
>those dimensions eventually.
>
>Apologies if this is a FAQ, but a fair amount of googling via
>rseek.org is not finding an answer (perhaps because I'm not using the
>correct search terms). Feel free (in fact, be encouraged :-) to reply
>directly to me as well as the list (I'm on the digest, which gets
>huge).
>
>TIA, Tom Roche 
>
>__
>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.


[R] Choice of statistical test (in R) of two apparently different distributions

2013-05-08 Thread Gundala Viswanath
I have the following list of data each has 10 samples.
The values indicate binding strength of a particular molecule.

What I want so show is that 'x' is statistically different from
'y', 'z' and 'w'.  Which it does if you look at X it has
more values greater than zero (2.8,1.00,5.4, etc) than others.

I tried t-test, but all of them shows insignificant difference
with high P-value.

What's the appropriate test for that?

Below is my code:

x   <-
c(2.852672123,0.076840264,1.009542943,0.430716968,5.4016,0.084281843,0.065654548,0.971907344,3.325405405,0.606504718)
y   <-
c(0.122615039,0.844203734,0.002128992,0.628740077,0.87752229,0.888600425,0.728667099,0.000375047,0.911153571,0.553786408);
z   <-
c(0.766445916,0.726801899,0.389718652,0.978733927,0.405585807,0.408554832,0.799010791,0.737676439,0.433279599,0.947906524)
w   <-
c(0.000124984,1.486637663,0.979713013,0.917105894,0.660855127,0.338574774,0.211689885,0.434050179,0.955522972,0.014195184)

t.test(x,y)
t.test(x,z)

--END--

G.V.

[[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] Choice of statistical test (in R) of two apparently different distributions

2013-05-08 Thread Pascal Oettli

Hello,

1) Why 'x' should be statistically different from others?

2) 'y' looks to be bimodal. The mean is not an appropriate measurement 
for this kind of distribution.


Regards,
Pascal


On 05/09/2013 10:29 AM, Gundala Viswanath wrote:

I have the following list of data each has 10 samples.
The values indicate binding strength of a particular molecule.

What I want so show is that 'x' is statistically different from
'y', 'z' and 'w'.  Which it does if you look at X it has
more values greater than zero (2.8,1.00,5.4, etc) than others.

I tried t-test, but all of them shows insignificant difference
with high P-value.

What's the appropriate test for that?

Below is my code:

x   <-
c(2.852672123,0.076840264,1.009542943,0.430716968,5.4016,0.084281843,0.065654548,0.971907344,3.325405405,0.606504718)
y   <-
c(0.122615039,0.844203734,0.002128992,0.628740077,0.87752229,0.888600425,0.728667099,0.000375047,0.911153571,0.553786408);
z   <-
c(0.766445916,0.726801899,0.389718652,0.978733927,0.405585807,0.408554832,0.799010791,0.737676439,0.433279599,0.947906524)
w   <-
c(0.000124984,1.486637663,0.979713013,0.917105894,0.660855127,0.338574774,0.211689885,0.434050179,0.955522972,0.014195184)

t.test(x,y)
t.test(x,z)

--END--

G.V.

[[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.


[R] Inputting white noise values for ARMA prediction

2013-05-08 Thread Preetam Pal
Hi All,



I have the following time series model for prediction purposes



*Loss_t = b1* Loss_(t-1)   +  b2*GDP_t  +  b3*W_(t-1)*  where W_t is the
usual white noise variable.

So this is similar to ARMA(1,1) except that it also contains an extra
predictor, GDP at time t.

I have only 20 observations on each variable except GDP for which I know
till 100 values. And I have also calculated the coefficients in some way.



For predicting say, the 22nd value for Loss (i.e.Loss_22),  how do I input
the value of the W_21 variable, because this variable (W_21) is generally
proxied via the error in prediction (i.e. observed - predicted value of
Loss) in the 21st stage, but since I don't know the observed value of Y_21,
there is no way to calculate the error in this stage (21st) .



Also, the way I have calculated the coefficients in the above model is
non-standard (differencing, bootstrapping, ridge regression), hence I
cannot use the general ARMA codes in R for prediction (or can I? (Please
let me know if this is possible))


So it would be great if you could help on this method or let me know what
algorithm R uses to solve this problem because such models are indeed used
 in practice.



Appreciate your help.



Thanks,

Preetam

-- 
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division,   C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.

[[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] error with lhoat() function from the package hydroPSO

2013-05-08 Thread Rui Esteves
Dear all,

I just installed the package hydroPSO and when I try to run the example of
the lhoat() function I got this error:

nparam <- 5

lhoat(

  fn=sphere,

  lower=rep(-100,nparam),

  upper=rep(100,nparam),

  control=list(N=10, f=0.1, write2disk=TRUE)

  )

*Error in fn.name == "hydromod" : *

* comparison (1) is possible only for atomic and list types*

Any idea about what it might be?

Thank you

Rui

[[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] Bootstrapped 1-sided confidence intervals

2013-05-08 Thread Janh Anni
Great!  Thanks to all for your assistance.

Regards

Janh


On Tue, May 7, 2013 at 11:37 PM, Pascal Oettli  wrote:

> Hello,
>
> You already asked that question on May 7, 2013. And David Winsemius
> already responded to you:
> https://stat.ethz.ch/**pipermail/r-help/2013-May/**353044.html
>
> Regards,
> Pascal
>
>
>
> On 05/08/2013 12:21 PM, Janh Anni wrote:
>
>> Hello All,
>>
>> Does anyone know if there’s a function for computing 1-sided confidence
>> intervals for bootstrapped statistics (mean, median, percentiles,
>> etc.)?  Thanks
>> in advance
>>
>> Janh
>>
>> [[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.
>>
>>

[[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] [newbie] *apply to matching elements of n arrays?

2013-05-08 Thread William Dunlap
Is the following what you want?   It works for vectors or arrays of
any number of dimensions.  It assumes that the dimensions of the
grids are the same.

> grid1 <- c(1,2,NA,3,NA)
> grid2 <- c(101,102,103,104,NA)
> shouldCopy <- is.na(grid1) & !is.na(grid2)
> grid1[shouldCopy] <- grid2[shouldCopy]
> grid1
[1]   1   2 103   3  NA

You don't really need the ' & !is.na(grid2)': it just stops the copying
of NA elements of grid2 to NA elements of grid1.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf
> Of Tom Roche
> Sent: Wednesday, May 08, 2013 5:38 PM
> To: r-help@r-project.org
> Subject: [R] [newbie] *apply to matching elements of n arrays?
> 
> 
> How to apply a function to all elements with the same indices in
> multiple arrays? E.g.:
> 
> I have two spatial grids defined the same way (i.e., same number of
> rows and columns--and dimensions, both 2D). Wherever both
> 
> * the value of an element i,j in the first grid is NA
> * the value of element i,j in the second grid is !NA
> 
> I want to copy the value from grid2[i,j] to grid1[i,j]. These matrices
> are not too big, so I'm able to do this with loops, but I know that's
> not "the R way." How to parallelize/vectorize this, e.g., with a
> single call to an 'apply'-type method? I believe I know how to operate
> on a single matrix (e.g., by using `apply` to traverse it by rows or
> cols), but not how to operate on multiple matrices.
> 
> Extra points for solutions that generalize to 3D or 4D (i.e., that allow
> applying the same function to identical elements in n arrays of n
> dimensions), since I will almost certainly need to work on arrays of
> those dimensions eventually.
> 
> Apologies if this is a FAQ, but a fair amount of googling via
> rseek.org is not finding an answer (perhaps because I'm not using the
> correct search terms). Feel free (in fact, be encouraged :-) to reply
> directly to me as well as the list (I'm on the digest, which gets huge).
> 
> TIA, Tom Roche 
> 
> __
> 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] R unable to access internet to install packages

2013-05-08 Thread Nilesh Gupta
Alex

For using a proxy server configuration with R please ensure that you use
the internet2 ddl to connect to the internet. It can be set in an R session
by using setInternet2(TRUE).
Besides all of these you should really set up a new version of R.

Regards

The woods are lovely, dark and deep
But I have promises to keep
And miles to go before I sleep
And miles to go before I sleep
-


On Thu, May 9, 2013 at 6:28 AM, Pascal Oettli  wrote:

> Hello,
>
> About problem for R to download files:
> http://cran.r-project.org/bin/**windows/rw-FAQ.html#The-**
> Internet-download-functions-**fail_002e
>
> The repertory "2.9" for the second mirror doesn't exist.
>
> Hope this helps,
> Pascal
>
>
>
> On 05/09/2013 09:30 AM, Alex Collier wrote:
>
>> Hi,
>>
>> I am having some trouble trying to install a number of packages in R on
>> my work computer. An example of the code I am using is as follows:
>>
>> install.packages("ggplot2",**dependencies=TRUE)
>>
>> An example of the error messages I am getting is:
>>
>> Warning: unable to access index for repository
>> http://cran.stat.auckland.ac.**nz/bin/windows/contrib/2.9
>> Warning: unable to access index for repository
>> http://www.stats.ox.ac.uk/pub/**RWin/bin/windows/contrib/2.9
>> Warning messages:
>> 1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
>> 2: In getDependencies(pkgs, dependencies, available, lib) :
>>package 組gplot2� is not available
>>
>>
>> The version of R I am using is 2.9.1.
>>
>> I have tried the same script at home with no problems and also at my
>> previous workplace. I thought it may be to do with not having IT
>> administrator privileges but and IT administrator tried with the same
>> result and also tried the latest version of R with the same result. The It
>> administrator also did not see any internet traffic from my machine when I
>> tried the install so we have come to the conclusion that R must not be able
>> to access the internet from my machine � I do have general internet access.
>>
>> We are using a proxy server (TMG � Microsoft痴 Threat Management Gateway).
>> Can R work with a proxy server on the network?
>>
>> If so, how should this be configured so that a Network Administrator can
>> make the appropriate changes?
>>
>> Thanks for your help.
>>
>> Regards,
>>
>> Alex Collier
>>
>>
>>
>> N稾u noa n�
>>
>> Alex Collier
>> Research Analyst
>> SuPERU (Social Policy Evaluation and Research Unit)
>> Families Commission | Kih穗a � Wh穗au
>>
>> Level 5, Public Trust Building
>> 117-125 Lambton Quay
>> PO Box 2839
>> WELLINGTON
>>
>> DDI  04 917 7048 | Fax  04 917 7059
>> Email: alex.coll...@nzfamilies.org.nz**> nzfamilies.org.nz >
>> Web:  
>> www.nzfamilies.org.nz
>> >
>> Follow us on Facebook> com/pages/Families-Commission/**121836017891600>
>> | Follow us on 
>> Twitter
>> >
>>  A centre of excellence about families and wh穗au
>>
>>
>>
>> --**
>> This email is confidential. If it is not intended for you please do not
>> read, distribute or copy it or any attachments. Please notify the sender by
>> return email and delete the original message and any attachments.
>>
>> Any views expressed in this email may be those of the individual sender
>> and may not necessarily reflect the views of the Families Commission.
>>
>> --**
>>
>> [[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.
>

[[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] R unable to access internet to install packages

2013-05-08 Thread Nilesh Gupta
also try this command to set the proxy
Sys.setenv(http_proxy="http://proxy_server_ip :port_for_proxy")

The woods are lovely, dark and deep
But I have promises to keep
And miles to go before I sleep
And miles to go before I sleep
-


On Thu, May 9, 2013 at 7:50 AM, Nilesh Gupta wrote:

> Alex
>
> For using a proxy server configuration with R please ensure that you use
> the internet2 ddl to connect to the internet. It can be set in an R session
> by using setInternet2(TRUE).
> Besides all of these you should really set up a new version of R.
>
> Regards
>
> The woods are lovely, dark and deep
> But I have promises to keep
> And miles to go before I sleep
> And miles to go before I sleep
> -
>
>
> On Thu, May 9, 2013 at 6:28 AM, Pascal Oettli  wrote:
>
>> Hello,
>>
>> About problem for R to download files:
>> http://cran.r-project.org/bin/**windows/rw-FAQ.html#The-**
>> Internet-download-functions-**fail_002e
>>
>> The repertory "2.9" for the second mirror doesn't exist.
>>
>> Hope this helps,
>> Pascal
>>
>>
>>
>> On 05/09/2013 09:30 AM, Alex Collier wrote:
>>
>>> Hi,
>>>
>>> I am having some trouble trying to install a number of packages in R on
>>> my work computer. An example of the code I am using is as follows:
>>>
>>> install.packages("ggplot2",**dependencies=TRUE)
>>>
>>> An example of the error messages I am getting is:
>>>
>>> Warning: unable to access index for repository
>>> http://cran.stat.auckland.ac.**nz/bin/windows/contrib/2.9
>>> Warning: unable to access index for repository
>>> http://www.stats.ox.ac.uk/pub/**RWin/bin/windows/contrib/2.9
>>> Warning messages:
>>> 1: In open.connection(con, "r") : unable to resolve 'cran.r-project.org'
>>> 2: In getDependencies(pkgs, dependencies, available, lib) :
>>>package 組gplot2� is not available
>>>
>>>
>>> The version of R I am using is 2.9.1.
>>>
>>> I have tried the same script at home with no problems and also at my
>>> previous workplace. I thought it may be to do with not having IT
>>> administrator privileges but and IT administrator tried with the same
>>> result and also tried the latest version of R with the same result. The It
>>> administrator also did not see any internet traffic from my machine when I
>>> tried the install so we have come to the conclusion that R must not be able
>>> to access the internet from my machine � I do have general internet 
>>> access.
>>>
>>> We are using a proxy server (TMG � Microsoft痴 Threat Management
>>> Gateway). Can R work with a proxy server on the network?
>>>
>>> If so, how should this be configured so that a Network Administrator can
>>> make the appropriate changes?
>>>
>>> Thanks for your help.
>>>
>>> Regards,
>>>
>>> Alex Collier
>>>
>>>
>>>
>>> N稾u noa n�
>>>
>>> Alex Collier
>>> Research Analyst
>>> SuPERU (Social Policy Evaluation and Research Unit)
>>> Families Commission | Kih穗a � Wh穗au
>>>
>>> Level 5, Public Trust Building
>>> 117-125 Lambton Quay
>>> PO Box 2839
>>> WELLINGTON
>>>
>>> DDI  04 917 7048 | Fax  04 917 7059
>>> Email: alex.coll...@nzfamilies.org.nz**>> nzfamilies.org.nz >
>>> Web:  
>>> www.nzfamilies.org.nz
>>> >
>>> Follow us on Facebook>> com/pages/Families-Commission/**121836017891600>
>>> | Follow us on 
>>> Twitter
>>> >
>>>  A centre of excellence about families and wh穗au
>>>
>>>
>>>
>>> --**
>>> This email is confidential. If it is not intended for you please do not
>>> read, distribute or copy it or any attachments. Please notify the sender by
>>> return email and delete the original message and any attachments.
>>>
>>> Any views expressed in this email may be those of the individual sender
>>> and may not necessarily reflect the views of the Families Commission.
>>>
>>> --**
>>>
>>> [[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 

[R] Re-start R issue on win7 [SEC=UNOFFICIAL]

2013-05-08 Thread Yang, Xiaoping
Hi all,

It is really annoying. The first time starting R, it works, but I cannot 
re-start R unless re-start my PC. Operation system is Win7.

Anyone knows how to deal with issue?


Cheers,
Xiaoping


** 
IMPORTANT: This e-mail is for the use of the intended recipient only and may 
contain information that is confidential, commercially valuable and/or subject 
to legal or parliamentary privilege. If you are not the intended recipient you 
are notified that any review, re-transmission, disclosure, dissemination or 
other use of, or taking of any action in reliance upon, this information is 
prohibited and may result in severe penalties. If you have received this e-mail 
in error please notify the sender immediately and delete all electronic and 
hard copies of this transmission together with any attachments. Please consider 
the environment before printing this e-mail 
**

[[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] ARMA(p,q) prediction with pre-determined coefficients

2013-05-08 Thread Preetam Pal
I have the following time series model for prediction purposes



*Loss_t = b1* Loss_(t-1)   +  b2*GDP_t  +  b3*W_(t-1)*  where W_t is the
usual white noise variable.

So this is similar to ARMA(1,1) except that it also contains an extra
predictor, GDP at time t.

I have only 20 observations on each variable except GDP for which I know
till 100 values.

And most importantly,I have also calculated the coefficients in some way
(these I want to use for prediction).



How can I use R to predict the value of Loss_22 (say) because I cannot
manually input the values of the white noise error at time 21 (since I
don't know what the actual observationL_21 is going to be).


I guess the arima() function can be used for this purpose and was going
through it where I found : "When regressors are specified, they are
orthogonalized prior to fitting unless any of the coefficients is fixed ".
I wanted to know exactly how to fix the coefficients to run the prediction
model and get the values of Loss_22,23,.. and so on.


The link to the help-page is as below:

http://stat.ethz.ch/R-manual/R-devel/library/stats/html/arima.html


Appreciate your help.


Thanks,

Preetam




-- 
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division,   C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.

[[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] Re-start R issue on win7 [SEC=UNOFFICIAL]

2013-05-08 Thread Jeff Newmiller
Have not experienced that.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

"Yang, Xiaoping"  wrote:

>Hi all,
>
>It is really annoying. The first time starting R, it works, but I
>cannot re-start R unless re-start my PC. Operation system is Win7.
>
>Anyone knows how to deal with issue?
>
>
>Cheers,
>Xiaoping
>
>
>**
>IMPORTANT: This e-mail is for the use of the intended recipient only
>and may contain information that is confidential, commercially valuable
>and/or subject to legal or parliamentary privilege. If you are not the
>intended recipient you are notified that any review, re-transmission,
>disclosure, dissemination or other use of, or taking of any action in
>reliance upon, this information is prohibited and may result in severe
>penalties. If you have received this e-mail in error please notify the
>sender immediately and delete all electronic and hard copies of this
>transmission together with any attachments. Please consider the
>environment before printing this e-mail
>**
>
>   [[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] Re-start R issue on win7 [SEC=UNOFFICIAL]

2013-05-08 Thread annoporci
I have not experienced that, but have you tried to see if killing the  
processes helps? On Windows CTRL+ALT+DEL usually brings up the system  
monitor or whatever it's called, where you can see programs and processes  
currently running. If your R gets stuck in a loop then you may see some  
reference to R even after you close or exit the R program. Use the Windows  
monitor to kill it. Tedious but quicker than restarting your computer.


Patrick.



On Thu, 09 May 2013 12:54:53 +0800, Yang, Xiaoping  
 wrote:



Hi all,

It is really annoying. The first time starting R, it works, but I cannot  
re-start R unless re-start my PC. Operation system is Win7.


Anyone knows how to deal with issue?


Cheers,
Xiaoping


**  
IMPORTANT: This e-mail is for the use of the intended recipient only and  
may contain information that is confidential, commercially valuable  
and/or subject to legal or parliamentary privilege. If you are not the  
intended recipient you are notified that any review, re-transmission,  
disclosure, dissemination or other use of, or taking of any action in  
reliance upon, this information is prohibited and may result in severe  
penalties. If you have received this e-mail in error please notify the  
sender immediately and delete all electronic and hard copies of this  
transmission together with any attachments. Please consider the  
environment before printing this e-mail  
**


[[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.