[R] Storing vectors as vectors in a list without losing each individual vector

2014-10-13 Thread Patricia Seo
Hi everyone,

My help request is similar to what was asked by Ken Termiso on April 18th, 
2005. Link here: https://stat.ethz.ch/pipermail/r-help/2005-April/069729.html

Matt Wiener answered with suggesting a vector list where you hand type each of 
the vectors. This is not what I want to do. What I want to do is automate the 
process. So, in other words creating a list through a loop. 

For example:

My data frame is called "df" and I have four variables/vectors that are v7, v8, 
v9, 10. Each variable/vector is an integer (no character strings). I want to 
create a list called "Indexes" so that I can use this list for "for-in" loops 
to SEPARATELY plot each and every variable/vector. 

If I followed Matt Wiener's suggestion, I would input this:


Indexes = list()
Indexes[[1]] = df$v7 
Indexes[[2]] = df$v8
Indexes[[3]] = df$v9
Indexes[[4]] = df$v10

But if I want to include more than four variable/vectors (let's say I want to 
include 25 of them!), I do not want to have to type all of it. If I do the 
following command:

Indexes <- c(df$v7, df$v8, df$v9, df$v10)

then I run into the same problem as Ken Termiso with having all the integers in 
one vector. I need to keep the variables/vectors separate. 

Is this just not possible in R? Any help would be great. Thank you!

__
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] Legend (guides) for point and two line graph

2014-10-13 Thread David Bourne
I’m trying to generate a plot with a series of data points and best fit lines 
from two stat models. I’m generating the best-fits with another program. I have 
the data in a csv file as:

Time,Observed,Calculated,Model
0.000,0.0,13.0810,1C
0.2500,15.,12.5298,1C
0.5000,12.,12.0018,1C
1.000,9.0,11.0117,1C
2.000,8.0,9.26969,1C
4.000,6.5,6.56882,1C
6.000,4.8,4.65489,1C
9.000,3.2,2.77680,1C
12.00,2.1,1.65641,1C
18.00,1.8,0.589422,1C
24.00,0.90,0.209736,1C
0.000,0.0,21.7130,2C
0.2500,15.,15.0512,2C
0.5000,12.,11.8203,2C
1.000,9.0,9.29374,2C
2.000,8.0,7.82242,2C
4.000,6.5,6.20213,2C
6.000,4.8,4.93346,2C
9.000,3.2,3.50010,2C
12.00,2.1,2.48310,2C
18.00,1.8,1.24979,2C
24.00,0.90,0.629039,2C

I read in the data with (R 3.1.1 GUI 1.65 Mavericks build (6784)):

>rtest <- read.csv("rtest.csv",header=TRUE)

Checked with

>rtest
Time Observed Calculated Model
1   0.00  0.0  13.0810001C
2   0.25 15.0  12.5298001C
3   0.50 12.0  12.0018001C
4   1.00  9.0  11.0117001C
5   2.00  8.0   9.2696901C
6   4.00  6.5   6.5688201C
7   6.00  4.8   4.6548901C
8   9.00  3.2   2.7768001C
9  12.00  2.1   1.6564101C
10 18.00  1.8   0.5894221C
11 24.00  0.9   0.2097361C
12  0.00  0.0  21.7130002C
13  0.25 15.0  15.0512002C
14  0.50 12.0  11.8203002C
15  1.00  9.0   9.2937402C
16  2.00  8.0   7.8224202C
17  4.00  6.5   6.2021302C
18  6.00  4.8   4.9334602C
19  9.00  3.2   3.5001002C
20 12.00  2.1   2.4831002C
21 18.00  1.8   1.2497902C
22 24.00  0.9   0.6290392C

Generated the graph with:

ggplot(rtest, aes(x=Time, y=Calculated,color=Model, group=Model)) + 
geom_line(aes(size=2)) + geom_point(aes(y=Observed, size=Observed), size=6, 
colour="black") + scale_colour_manual(values=c("green","red")) + 
labs(size="Observed”)

Which resulted in the plot:

http://www.boomer.org/rtest/rtest.pdf

I’d like to:

1) get rid of the Observed / 2 legend(guide)
2) maybe keep the Observed and have a circle, i.e., loose the ‘2’
3) understand how to create, format the legend

This seems like a common enough problem but the online documentation, R for 
Dummies nor the R Graphic Cookbook seems to have an answer (from my reading).

Thanks for any clues/suggestion.

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.


Re: [R] How to Install R 3.1.0 on ubuntu 12.0.4

2014-10-13 Thread Pascal Oettli
Please reply to the list, not only to me.

RStudio is for Ubuntu 10.04+ (please note the "+").

About R 3.1.0, you probably will have to compile from the source.

Regards,
Pascal


On Tue, Oct 14, 2014 at 3:31 PM, madhvi  wrote:
> Hi,
> I have followed these links but it is giving R version 3.1.1 and R studio
> for ubuntu 10.04
>
> Madhvi
>
> On Tuesday 14 October 2014 11:58 AM, Pascal Oettli wrote:
>>
>> Hi,
>>
>> http://cran.r-project.org/bin/linux/ubuntu/
>> http://www.rstudio.com/products/rstudio/download/
>>
>> Enjoy,
>> Pascal
>>
>> On Tue, Oct 14, 2014 at 3:17 PM, madhvi  wrote:
>>>
>>> Hi,
>>> Can anyone tell me the steps to install R 3.1.0 and rstudio on ubuntu
>>> 12.0.4.
>>>
>>> Thanks
>>> Madhvi
>>>
>>> __
>>> 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.
>>
>>
>>
>



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
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 Install R 3.1.0 on ubuntu 12.0.4

2014-10-13 Thread Pascal Oettli
Hi,

http://cran.r-project.org/bin/linux/ubuntu/
http://www.rstudio.com/products/rstudio/download/

Enjoy,
Pascal

On Tue, Oct 14, 2014 at 3:17 PM, madhvi  wrote:
> Hi,
> Can anyone tell me the steps to install R 3.1.0 and rstudio on ubuntu
> 12.0.4.
>
> Thanks
> Madhvi
>
> __
> 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.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
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] How to Install R 3.1.0 on ubuntu 12.0.4

2014-10-13 Thread madhvi

Hi,
Can anyone tell me the steps to install R 3.1.0 and rstudio on ubuntu 
12.0.4.


Thanks
Madhvi

__
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] Reading text file with fortran format

2014-10-13 Thread Steven Yen

Hello
Any idea how to read a text file with fortran format, WITH MULTIPLE 
RECORDS? My fortran format is as follows, and I do know I need to 
change F7.4 to F7.0, and 2F2.0 to 2I2, etc.
I just have no idea how to handle the "slash" (/) which dictates a 
jump to the next record in fortran. Thank you all.

---

 10   FORMAT(F8.0,4F2.0,6F7.4,F8.4,3F4.1,2F3.0,36F2.0,11F8.5
 * /2F8.5,F10.4,F2.0,F8.1,F10.4,F11.4,F6.2,F2.0,3F10.4,2F12.7,2F2.0,
 * F4.0,2F2.0,F8.5,5F2.0)

__
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] Help with a function [along columns]

2014-10-13 Thread Kate Ignatius
Just an update to this:

gtal <- function(d) {
alleles <- sapply(d, function(.) strsplit(as.character(.), "/"))
gt <- unlist(lapply(alleles, function(x)
   ifelse(identical(x[[1]], vcf[,3]) & identical(x[[2]], vcf[,3]), 'RR',
   ifelse(identical(x[[1]], vcf[,4]) & identical(x[[2]], vcf[,4]), 'AA',
   ifelse(identical(x[[1]], vcf[,3]) & identical(x[[2]], vcf[,4]), 'RA',
   ifelse(identical(x[[1]], vcf[,4]) & identical(x[[2]],
vcf[,3]), 'RA', ''))
}

I've got something working but I'm having trouble with the gt part...
I'm getting the error: object of type 'closure' is not subsettable.
The vcf is my original file that I want to match with so not sure
whether this a problem.

On Mon, Oct 13, 2014 at 4:46 PM, Kate Ignatius  wrote:
> Hi all,
>
> I need help with a function.  I'm trying to write a function to apply
> to varying number of columns in a lot of files - hence the function...
> but I'm getting stuck.  Here it is:
>
> gt<- function(x) {
> alleles <- sapply(x, function(.) strsplit(as.character(.), "/"))
> gt <- apply(x, function(.) ifelse(x[1] == vcf[3] & x[2] == vcf[3], 'RR',
> ifelse(x[1] == vcf[4] & x[2] == vcf[4], 'AA',
> ifelse(x[1] == vcf[3] & x[2] == vcf[4], 'RA',
> ifelse(x[1] == vcf[4] & x[2] == vcf[3], 'RA', '')
> }
>
> I have different sized family genetic files and at the end of the day
> I want to see whether the alleles of each person in the family match
> the ref and/or the alt and if so, give AA, RA or RR.
>
> Like so:
>
> REF ALT Sample_1 GT_1 Sample_2 GT_2
> A G A/A RR A/G RA
> T G G/G AA T/T RR
> A T T/T AA A/A RR
> G A G/A RA G/G RR
> G A G/G RR G/A RA
> T C C/C AA C/C AA
> T C C/C AA C/C AA
> C T C/T RA T/T AA
> G A A/A AA A/A AA
> T G T/G RA G/G AA
>
>
> Is there an easy way to do this?
>
> Thanks!

__
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 with a function [along columns]

2014-10-13 Thread Kate Ignatius
Hi all,

I need help with a function.  I'm trying to write a function to apply
to varying number of columns in a lot of files - hence the function...
but I'm getting stuck.  Here it is:

gt<- function(x) {
alleles <- sapply(x, function(.) strsplit(as.character(.), "/"))
gt <- apply(x, function(.) ifelse(x[1] == vcf[3] & x[2] == vcf[3], 'RR',
ifelse(x[1] == vcf[4] & x[2] == vcf[4], 'AA',
ifelse(x[1] == vcf[3] & x[2] == vcf[4], 'RA',
ifelse(x[1] == vcf[4] & x[2] == vcf[3], 'RA', '')
}

I have different sized family genetic files and at the end of the day
I want to see whether the alleles of each person in the family match
the ref and/or the alt and if so, give AA, RA or RR.

Like so:

REF ALT Sample_1 GT_1 Sample_2 GT_2
A G A/A RR A/G RA
T G G/G AA T/T RR
A T T/T AA A/A RR
G A G/A RA G/G RR
G A G/G RR G/A RA
T C C/C AA C/C AA
T C C/C AA C/C AA
C T C/T RA T/T AA
G A A/A AA A/A AA
T G T/G RA G/G AA


Is there an easy way to do this?

Thanks!

__
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] Loading a rda file for predicton

2014-10-13 Thread Peter Langfelder
see help(load) and pay particular attention to what the function
returns: the names of the loaded objects, not the object(s)
themselves.

You have to use

predict(fit,Testsamp,type="response")

since the load() created a variable 'fit' (same name as the one saved).

HTH

Peter



On Mon, Oct 13, 2014 at 6:37 AM, TJUN KIAT TEO  wrote:
> I tried this
>
> 
> fit<-glm(Pred~Pressure+MissingStep, data = Test, family="binomial")
>
> save(fit,file="pred.rda")
>
> pred<-load("pred.rda")
>
>
> predict(pred,Testsamp,type="response")
>
> 
>
> But got this error message
>
>  no applicable method for 'predict' applied to an object of class "character"
>
> What did I do wrong?
>
>
> Tjun Kiat
>
>
> [[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] seqinr ?: Splitting a factor name into several columns. Dealing with metabarcoding data.

2014-10-13 Thread David.Kaethner
I'm not sure I understood your problem, maybe like this:

# split identifiers into columns
df1 <- data.frame(cbind(X = 1:10, Y = rnorm(10)),
  Z.identifierA.B1298712 = factor(rep(LETTERS[1:2], each = 5)))

id <- names(df1)[3]
x <- do.call(rbind, str_split(id, "\\."))
y <- sapply(x, function(z) z <- df1[,id])

df1.goal <- data.frame(df1[,-3], y)

-dk

-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im 
Auftrag von Anna Zakrisson Braeunlich
Gesendet: Sonntag, 12. Oktober 2014 09:25
An: r-help@r-project.org
Betreff: [R] seqinr ?: Splitting a factor name into several columns. Dealing 
with metabarcoding data.

Hi,

I have a question how to split a factor name into different columns. I have 
metabarcoding data and need to merge the FASTA-file with the taxonomy- and 
counttable files (dataframes). To be able to do this merge, I need to isolate 
the common identifier, that unfortunately is baked in with a lot of other 
labels in the factor name eg:
sequence identifier: 
M01271_77_0.A8J0P_1_1101_10150_1525.1.322519.sample_1.sample_2

I want to split this name at every "." to get several columns:
column1: M01271_77_0
column2: A8J0P_1_1101_10150_1525
column3: 1
column4: 322519
column5: sample_1
column6: sample_2

I must add that I have no influence on how these names are given. This is how 
thay are supplied from Illumina Miseq. I just need to be able to deal with it.

Here is some extremely simplified dummy data to further show the issue at hand:

df1 <- data.frame(cbind(X = 1:10, Y = rnorm(10)),
  Z.identifierA.B1298712 = factor(rep(LETTERS[1:2], each = 5)))
df2 <- data.frame(cbind(B = 13:22, K = rnorm(10)),
  Q.identifierA.B4668726 = factor(rep(LETTERS[1:2], each = 5)))

# I have metabarcoding data with one FASTA-file, one count table and one 
taxonomy file # Above dummy data is just showing the issue at hand. I want to 
be able to merge my three # original data frames (here, the dummy data is only 
two dataframes). The problem is that # the only identifier that is commmon for 
the dataframes is "hidden" in the # factor name eg: Z.identifierA.1298712 and 
Q.identifierA.4668726. I hence need to be able # to split this name up into 
different columns to get "identifierA" alone as one column name # Then I can 
merge the dataframes.
# How can I do this in R. I know that it can be done in excel, but I would like 
to # produce a complete R-script to get a fast pipeline and avoid copy and 
paste errors.
# This is what I want it to look:

df1.goal <- data.frame(cbind(X = 1:10, Y = rnorm(10)),
  Z = factor(rep(LETTERS[1:2], each = 5)),
  identifierA = factor(rep(LETTERS[1:2], each = 5)),
  B1298712 = factor(rep(LETTERS[1:2], each = 5)))

# Many thank's and with kind regards
Anna Zakrisson

>< >` . .   ` . .  ` . . >< >` . .   ` . .  ` . .>< >` . .   
>` . .  ` . .>< >

Anna Zakrisson Braeunlich
PhD student

Department of Ecology, Environment and Plant Sciences Stockholm University 
Svante Arrheniusv. 21A
SE-106 91 Stockholm
Sweden/Sverige

Lives in Berlin.
For paper mail:
Katzbachstr. 21
D-10965, Berlin
Germany/Deutschland

E-mail: anna.zakris...@su.se
Tel work: +49-(0)3091541281
Mobile: +49-(0)15777374888
LinkedIn: http://se.linkedin.com/pub/anna-zakrisson-braeunlich/33/5a2/51b

>< >` . .   ` . .  ` . . >< >` . .   ` . .  ` . .>< >` . .   
>` . .  ` . .>< >

[[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] Loading a rda file for predicton

2014-10-13 Thread TJUN KIAT TEO
I tried this


fit<-glm(Pred~Pressure+MissingStep, data = Test, family="binomial")

save(fit,file="pred.rda")

pred<-load("pred.rda")


predict(pred,Testsamp,type="response")



But got this error message

 no applicable method for 'predict' applied to an object of class "character"

What did I do wrong?


Tjun Kiat

  
[[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] User authentication

2014-10-13 Thread Baranowski, Bartosz
Hi all,

I am envisioning the user logging into a shiny app, or RStudio
server, and then, based on that authentication, obtaining the
necessary credentials to access other remote systems.
Is there maybe any working solution for this kind of problem?
All the help would be greatly appreciated.

Kind Regards,
Bartosz Baranowski

__
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] seqinr ?: Splitting a factor name into several columns. Dealing with metabarcoding data.

2014-10-13 Thread Ista Zahn
Hi Anna,


On Sun, Oct 12, 2014 at 3:24 AM, Anna Zakrisson Braeunlich
 wrote:
> Hi,
>
> I have a question how to split a factor name into different columns. I have 
> metabarcoding data and need to merge the FASTA-file with the taxonomy- and 
> counttable files (dataframes). To be able to do this merge, I need to isolate 
> the common identifier, that unfortunately is baked in with a lot of other 
> labels in the factor name eg:
> sequence identifier: 
> M01271_77_0.A8J0P_1_1101_10150_1525.1.322519.sample_1.sample_2
>
> I want to split this name at every "." to get several columns:
> column1: M01271_77_0
> column2: A8J0P_1_1101_10150_1525
> column3: 1
> column4: 322519
> column5: sample_1
> column6: sample_2
>
> I must add that I have no influence on how these names are given. This is how 
> thay are supplied from Illumina Miseq. I just need to be able to deal with it.
>
> Here is some extremely simplified dummy data to further show the issue at 
> hand:
>
> df1 <- data.frame(cbind(X = 1:10, Y = rnorm(10)),
>   Z.identifierA.B1298712 = factor(rep(LETTERS[1:2], each = 
> 5)))
> df2 <- data.frame(cbind(B = 13:22, K = rnorm(10)),
>   Q.identifierA.B4668726 = factor(rep(LETTERS[1:2], each = 
> 5)))
>
> # I have metabarcoding data with one FASTA-file, one count table and one 
> taxonomy file
> # Above dummy data is just showing the issue at hand. I want to be able to 
> merge my three
> # original data frames (here, the dummy data is only two dataframes). The 
> problem is that
> # the only identifier that is commmon for the dataframes is "hidden" in the
> # factor name eg: Z.identifierA.1298712 and Q.identifierA.4668726. I hence 
> need to be able
> # to split this name up into different columns to get "identifierA" alone as 
> one column name
> # Then I can merge the dataframes.
> # How can I do this in R. I know that it can be done in excel, but I would 
> like to
> # produce a complete R-script to get a fast pipeline and avoid copy and paste 
> errors.
> # This is what I want it to look:
>
> df1.goal <- data.frame(cbind(X = 1:10, Y = rnorm(10)),
>   Z = factor(rep(LETTERS[1:2], each = 5)),
>   identifierA = factor(rep(LETTERS[1:2], each = 5)),
>   B1298712 = factor(rep(LETTERS[1:2], each = 5)))

Use strsplit to separate the components, something like

separateNames <- strsplit(names(df1)[3], split = "\\.")[[1]]
for(name in separateNames) {
df1[[name]] <- df1[[3]]
}
df1[[3]] <- NULL

Best,
Ista

>
> # Many thank's and with kind regards
> Anna Zakrisson
>
>><º>`•. . • `•. .• `•. . ><º>`•. . • `•. .• `•. .><º>`•. . • `•. 
>>.• `•. .><º>
>
> Anna Zakrisson Braeunlich
> PhD student
>
> Department of Ecology, Environment and Plant Sciences
> Stockholm University
> Svante Arrheniusv. 21A
> SE-106 91 Stockholm
> Sweden/Sverige
>
> Lives in Berlin.
> For paper mail:
> Katzbachstr. 21
> D-10965, Berlin
> Germany/Deutschland
>
> E-mail: anna.zakris...@su.se
> Tel work: +49-(0)3091541281
> Mobile: +49-(0)15777374888
> LinkedIn: http://se.linkedin.com/pub/anna-zakrisson-braeunlich/33/5a2/51b
>
>><º>`•. . • `•. .• `•. . ><º>`•. . • `•. .• `•. .><º>`•. . • `•. 
>>.• `•. .><º>
>
> [[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] How to sum some columns based on their names

2014-10-13 Thread Jeff Newmiller
Your regular expressions are invalid, Charles. You seem to be thinking of file 
name globbing as at the command line.
---
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.

On October 13, 2014 6:05:43 AM PDT, Charles Determan Jr  
wrote:
>You can use grep with some basic regex, index your dataframe, and
>colSums
>
>colSums(df[,grep("*6574*|*7584*|*85*", colnames(df))])
>colSums(df[,grep("f6574*|f7584*|f85*", colnames(df))])
>
>
>Regards,
>Dr. Charles Determan
>
>On Mon, Oct 13, 2014 at 7:57 AM, Kuma Raj  wrote:
>
>> I want to sum columns based on their names. As an exampel how could I
>> sum columns which contain 6574, 7584 and 85 as column names?  In
>> addition, how could I sum those which contain 6574, 7584 and 85 in
>> ther names and have a prefix "f". My data contains several variables
>> with
>>
>> I want to sum columns based on their names. As an exampel how could I
>> sum columns which contain 6574, 7584 and 85 as column names?  In
>> addition, how could I sum those which contain 6574, 7584 and 85 in
>> ther names and have a prefix "f". My data contains several variables
>> with
>>
>> dput(df1)
>> structure(list(date = structure(c(1230768000, 1230854400, 1230940800,
>> 1231027200, 1231113600, 123120, 1231286400, 1231372800,
>1231459200,
>> 1231545600, 1231632000), class = c("POSIXct", "POSIXt"), tzone =
>"UTC"),
>> f014card = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), f1534card = c(0,
>> 1, 1, 0, 0, 1, 0, 0, 1, 0, 1), f3564card = c(1, 6, 1, 5,
>> 5, 4, 4, 7, 6, 4, 6), f6574card = c(3, 6, 4, 5, 5, 2, 10,
>> 3, 4, 2, 4), f7584card = c(13, 6, 1, 4, 10, 6, 8, 12, 10,
>> 4, 3), f85card = c(5, 3, 1, 0, 2, 10, 7, 9, 1, 7, 3), m014card =
>c(0,
>> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), m1534card = c(0, 0, 1, 0,
>> 0, 0, 0, 1, 1, 1, 0), m3564card = c(12, 7, 4, 7, 12, 13,
>> 12, 7, 12, 2, 11), m6574card = c(3, 4, 8, 8, 8, 10, 7, 6,
>> 7, 7, 5), m7584card = c(8, 10, 5, 4, 12, 7, 14, 11, 9, 1,
>> 11), m85card = c(1, 4, 3, 0, 3, 4, 5, 5, 4, 5, 0)), .Names =
>c("date",
>> "f014card", "f1534card", "f3564card", "f6574card", "f7584card",
>> "f85card", "m014card", "m1534card", "m3564card", "m6574card",
>> "m7584card", "m85card"), class = "data.frame", row.names = c("1",
>> "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"))
>>
>> __
>> 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 to sum some columns based on their names

2014-10-13 Thread Jeff Newmiller
Learn regular expressions.. there are many websites and books that describe how 
they work. R has a number of functions that use them...

?regexp
?grep

For example...

grep("^[^0-9]*(6574|85|7584)[^0-9]*$",names(dta))

where dta is your data frame. You can read that regular expression as zero or 
more characters that are not digits at the beginning of the string, followed by 
any of three specified sequences of digits, followed by zero or more non-digit 
characters at the end of the string.

You can then use that function as the column specification index to look only 
at certain columns. The sapply function can apply the sum function to all of 
those columns:

sapply(dta[,grep("^[^0-9]*(6574|85|7584)[^0-9]*$",names(dta))],sum)
---
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.

On October 13, 2014 5:57:45 AM PDT, Kuma Raj  wrote:
>I want to sum columns based on their names. As an exampel how could I
>sum columns which contain 6574, 7584 and 85 as column names?  In
>addition, how could I sum those which contain 6574, 7584 and 85 in
>ther names and have a prefix "f". My data contains several variables
>with
>
>I want to sum columns based on their names. As an exampel how could I
>sum columns which contain 6574, 7584 and 85 as column names?  In
>addition, how could I sum those which contain 6574, 7584 and 85 in
>ther names and have a prefix "f". My data contains several variables
>with
>
>dput(df1)
>structure(list(date = structure(c(1230768000, 1230854400, 1230940800,
>1231027200, 1231113600, 123120, 1231286400, 1231372800, 1231459200,
>1231545600, 1231632000), class = c("POSIXct", "POSIXt"), tzone =
>"UTC"),
>f014card = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), f1534card = c(0,
>1, 1, 0, 0, 1, 0, 0, 1, 0, 1), f3564card = c(1, 6, 1, 5,
>5, 4, 4, 7, 6, 4, 6), f6574card = c(3, 6, 4, 5, 5, 2, 10,
>3, 4, 2, 4), f7584card = c(13, 6, 1, 4, 10, 6, 8, 12, 10,
>  4, 3), f85card = c(5, 3, 1, 0, 2, 10, 7, 9, 1, 7, 3), m014card = c(0,
>0, 0, 0, 0, 0, 0, 0, 0, 0, 0), m1534card = c(0, 0, 1, 0,
>0, 0, 0, 1, 1, 1, 0), m3564card = c(12, 7, 4, 7, 12, 13,
>12, 7, 12, 2, 11), m6574card = c(3, 4, 8, 8, 8, 10, 7, 6,
>7, 7, 5), m7584card = c(8, 10, 5, 4, 12, 7, 14, 11, 9, 1,
> 11), m85card = c(1, 4, 3, 0, 3, 4, 5, 5, 4, 5, 0)), .Names = c("date",
>"f014card", "f1534card", "f3564card", "f6574card", "f7584card",
>"f85card", "m014card", "m1534card", "m3564card", "m6574card",
>"m7584card", "m85card"), class = "data.frame", row.names = c("1",
>"2", "3", "4", "5", "6", "7", "8", "9", "10", "11"))
>
>__
>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 to sum some columns based on their names

2014-10-13 Thread Charles Determan Jr
You can use grep with some basic regex, index your dataframe, and colSums

colSums(df[,grep("*6574*|*7584*|*85*", colnames(df))])
colSums(df[,grep("f6574*|f7584*|f85*", colnames(df))])


Regards,
Dr. Charles Determan

On Mon, Oct 13, 2014 at 7:57 AM, Kuma Raj  wrote:

> I want to sum columns based on their names. As an exampel how could I
> sum columns which contain 6574, 7584 and 85 as column names?  In
> addition, how could I sum those which contain 6574, 7584 and 85 in
> ther names and have a prefix "f". My data contains several variables
> with
>
> I want to sum columns based on their names. As an exampel how could I
> sum columns which contain 6574, 7584 and 85 as column names?  In
> addition, how could I sum those which contain 6574, 7584 and 85 in
> ther names and have a prefix "f". My data contains several variables
> with
>
> dput(df1)
> structure(list(date = structure(c(1230768000, 1230854400, 1230940800,
> 1231027200, 1231113600, 123120, 1231286400, 1231372800, 1231459200,
> 1231545600, 1231632000), class = c("POSIXct", "POSIXt"), tzone = "UTC"),
> f014card = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), f1534card = c(0,
> 1, 1, 0, 0, 1, 0, 0, 1, 0, 1), f3564card = c(1, 6, 1, 5,
> 5, 4, 4, 7, 6, 4, 6), f6574card = c(3, 6, 4, 5, 5, 2, 10,
> 3, 4, 2, 4), f7584card = c(13, 6, 1, 4, 10, 6, 8, 12, 10,
> 4, 3), f85card = c(5, 3, 1, 0, 2, 10, 7, 9, 1, 7, 3), m014card = c(0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), m1534card = c(0, 0, 1, 0,
> 0, 0, 0, 1, 1, 1, 0), m3564card = c(12, 7, 4, 7, 12, 13,
> 12, 7, 12, 2, 11), m6574card = c(3, 4, 8, 8, 8, 10, 7, 6,
> 7, 7, 5), m7584card = c(8, 10, 5, 4, 12, 7, 14, 11, 9, 1,
> 11), m85card = c(1, 4, 3, 0, 3, 4, 5, 5, 4, 5, 0)), .Names = c("date",
> "f014card", "f1534card", "f3564card", "f6574card", "f7584card",
> "f85card", "m014card", "m1534card", "m3564card", "m6574card",
> "m7584card", "m85card"), class = "data.frame", row.names = c("1",
> "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"))
>
> __
> 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.
>



-- 
Dr. Charles Determan, PhD
Integrated Biosciences

[[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] How to sum some columns based on their names

2014-10-13 Thread Kuma Raj
I want to sum columns based on their names. As an exampel how could I
sum columns which contain 6574, 7584 and 85 as column names?  In
addition, how could I sum those which contain 6574, 7584 and 85 in
ther names and have a prefix "f". My data contains several variables
with

I want to sum columns based on their names. As an exampel how could I
sum columns which contain 6574, 7584 and 85 as column names?  In
addition, how could I sum those which contain 6574, 7584 and 85 in
ther names and have a prefix "f". My data contains several variables
with

dput(df1)
structure(list(date = structure(c(1230768000, 1230854400, 1230940800,
1231027200, 1231113600, 123120, 1231286400, 1231372800, 1231459200,
1231545600, 1231632000), class = c("POSIXct", "POSIXt"), tzone = "UTC"),
f014card = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), f1534card = c(0,
1, 1, 0, 0, 1, 0, 0, 1, 0, 1), f3564card = c(1, 6, 1, 5,
5, 4, 4, 7, 6, 4, 6), f6574card = c(3, 6, 4, 5, 5, 2, 10,
3, 4, 2, 4), f7584card = c(13, 6, 1, 4, 10, 6, 8, 12, 10,
4, 3), f85card = c(5, 3, 1, 0, 2, 10, 7, 9, 1, 7, 3), m014card = c(0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0), m1534card = c(0, 0, 1, 0,
0, 0, 0, 1, 1, 1, 0), m3564card = c(12, 7, 4, 7, 12, 13,
12, 7, 12, 2, 11), m6574card = c(3, 4, 8, 8, 8, 10, 7, 6,
7, 7, 5), m7584card = c(8, 10, 5, 4, 12, 7, 14, 11, 9, 1,
11), m85card = c(1, 4, 3, 0, 3, 4, 5, 5, 4, 5, 0)), .Names = c("date",
"f014card", "f1534card", "f3564card", "f6574card", "f7584card",
"f85card", "m014card", "m1534card", "m3564card", "m6574card",
"m7584card", "m85card"), class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11"))

__
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] Q-Q Plot for loglogistic, lognormal and 2 parameter exponential distributions

2014-10-13 Thread peter dalgaard
A basic approach is

x <- rchisq(1000, 4)
qqplot(qchisq(ppoints(x), 4), x) 
abline(0,1)

Substitute whatever distribution and parameters that might apply. Notice that 
if you don't have a location-scale family of distributions, you need to compare 
to the identity line, not just look for linearity.

-pd

On 12 Oct 2014, at 11:58 , Jomy Jose  wrote:

> Is there any R package that can plot Q-Q plot for loglogistic,lognormal and
> 2 parameter exponential distributions or is there a way to check the model
> fit for these distributions in R ?
> 
>   [[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.

-- 
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] Is xyz point inside 3d convex hull?

2014-10-13 Thread Keith Jewell

Back in 2009 I posted some code to this list, see:


I submitted the function 'inhull' to the geometry package maintainer, 
but I don't think it was ever included.


HTH

Keith J
On 12/10/2014 21:24, Don McKenzie wrote:

Check the R-news archive with approrpriate keywords.  There was a long exchange 
awhile back when I asked a similar question.

On Oct 12, 2014, at 1:20 PM, Camilo Mora  wrote:


Hi everyone,

I wonder if there is a code in r that can generate a 3d convex hull from a 
data-frame containing 3 columns and then use another database with the same 
three columns and for each row determine if the xyz point is inside or not the 
convex hull generated with the first database?

The package geometry allows to calculate a hull and it's volume. I was planning 
to calculate the volume of the convex hull after adding each point in the 
second database and if the hull gets bigger then the point is out and if not 
then the point is in. A problem with this method is that I have over 10 million 
points and the calculation for each point will take a lot of time.

Any guidance will be greatly appreciated,

Thanks,

Camilo

[[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] Finding the Summation of Monthly Amount

2014-10-13 Thread peter dalgaard
Looks like a job for aggregate()

-pd

On 13 Oct 2014, at 04:25 , dila radi  wrote:

> Hi all,
> 
> Could someone help me on this? I have this kind of data set
> 
> structure(list(Year = c(1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L, 1972L,
> 1972L, 1972L, 1972L, 1972L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L, 1973L,
> 1973L, 1973L, 1973L, 1973L), Month = c(1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), Rain = c(68, 6, 6.3, 55.3,
> 18.2, 1.2, 5.3, 0, 0, 1.2, 0.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.5,
> 0, 0, 12.1, 0.5, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 50.8, 7.1, 0, 0, 0, 4, 22, 14.7, 0, 17.7, 0,
> 106.6, 0, 4.8, 14.7, 2.2, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 8.6, 3.3, 0, 16.7, 0, 5.8, 9.1, 0, 0, 0, 0, 0, 0, 0, 12.6,
> 12.9, 0, 0, 0, 0, 0, 3.3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50.7,
> 1.2, 2.5, 0, 0, 0, 0, 17, 0, 2.5, 0, 0, 0, 0, 3.8, 0, 0, 0, 0,
> 0, 0, 2.7, 2.7, 12.6, 0, 0, 0, 0, 0, 0, 0, 3.3, 0, 0, 5.5, 2.5,
> 0, 35.5, 5, 3.3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6.3,
> 0, 0, 0, 5.8, 0, 0, 0, 15.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5.5,
> 30.2, 64.5, 0, 11.9, 3.8, 3.3, 7.1, 27.9, 32, 106.6, 0.2, 0,
> 5.3, 4.5, 0, 0, 1.5, 11.9, 6.6, 0, 0, 11.9, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 8.3, 8.1, 0.5, 0, 0, 0, 0, 0, 0, 0, 0, 30.9, 1.2,
> 0, 0, 9.3, 82.5, 16.5, 0, 0, 0, 0.7, 0, 0, 36, 0, 3.8, 0, 0,
> 0, 0, 0, 0, 0, 4.3, 0, 0, 38, 8.8, 0, 26.4, 0, 0, 0.7, 13.4,
> 9.6, 8.3, 0, 3.8, 8.8, 0, 45.7, 1.2, 12.9, 0, 0, 0, 21.3, 1,
> 0)), .Names = c("Year", "Month", "Rain"), class = "data.frame", row.names =
> c(NA,
> -271L))
> 
> and I want to find the sum of Rain in column 3 according to their month.
> How could I achieved this so that it would appear as follow:
> 
> structure(list(Year = c(1971L, 1971L, 1971L, 1972L, 1972L, 1972L,
> 1973L, 1973L, 1973L), Month = c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
> 3L), Rain = c(176.8, 228.2, 90.9, 81, 73.1, 127.7, 242.8, 189.5,
> 204.2)), .Names = c("Year", "Month", "Rain"), class = "data.frame",
> row.names = c(NA,
> -9L))
> 
> Thank you so much
> 
> Dila
> 
>   [[alternative HTML version deleted]]
> 
> _