----- 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 ? thank you a lot!! [[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.