Hi,
On Aug 18, 2009, at 10:52 AM, Inchallah Yarab wrote:
----- Message transféré ----
De : Inchallah Yarab <inchallahya...@yahoo.fr>
À : r-help@r-project.org
Envoyé le : Mardi, 18 Août 2009, 16h26mn 20s
Objet : create a table in the console!!
HI
I want to do a table with R (in the console)
GWP_Max NumberOfPolicies
No_GWPMax 8
[0-1000] 4
[1000-3000] 3
[> 3000] 5
i begin by calculate the number of policies in each class :
Data1 <- read.csv2("c:/Total1.csv", sep=",")
Data2 <- read.csv2("c:/GWPMax1.csv",sep=",")[1:20,1:2]
M <- merge(Data1,Data2, by.x = "Policy.Number",by.y =
"Policy.Number",all.x = TRUE,all.y = TRUE )
(No_GWPMax<-nrow(M[M[,25]=="NA",]))
[1] 8
M2<- merge(Data1,Data2, by.x = "Policy.Number",by.y =
"Policy.Number")
M2$GWP_Max <- as.numeric(as.character(M2$GWP_Max ))
class1 <- M2[M2[,25]>0 & M2[,25]<1000,]
(NbpolicyClass1 <- nrow(class1))
[1] 5
class2 <- M2[M2[,25]>1000 & M2[,25]<3000,]
(NbpolicyClass2 <- nrow(class2))
[1] 3
class3 <- M2[M2[,25]>3000,]
(NbpolicyClass3 <- nrow(class3))
[1] 4
can you help me ?
I don't understand what you want to do.
From the code you've pasted, you already have extracted the numbers
you wanted, so what do you mean when you say "I want to do a table"
with them? Do you just want to put them in a data.frame, or something?
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
______________________________________________
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.