hello everyone, i often work on contingency table that I create from data.frame (with table() function) but a friend sent me an excel sheet wich *already is* a contingency table (just a simple 2 way table !...) any clue on how to import it in R (keeping row names and col names) ? any tuto I come accross only mention the table transformation, but never the import of such data I only found read.ftable() but couldn't get it to work any help appreciated Sylv
import contingency table
3 messages · sylvain willart, Rui Barradas
Hello,
Try function read.xls in library gdata
Also, a good way of avoiding such doubts is
library(sos)
findFn('xls')
It returns read.xls as the first line.
Hope this helps,
Rui Barradas
Em 28-05-2012 11:32, sylvain willart escreveu:
hello everyone, i often work on contingency table that I create from data.frame (with table() function) but a friend sent me an excel sheet wich *already is* a contingency table (just a simple 2 way table !...) any clue on how to import it in R (keeping row names and col names) ? any tuto I come accross only mention the table transformation, but never the import of such data I only found read.ftable() but couldn't get it to work any help appreciated Sylv
______________________________________________ R-help at 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.
Thanks Rui, but my problem is not to read an xls file, I converted already to csv, but rather to read a contingency table into R, and telling R it is astually a contingency table, and not a data.frame... file below, if it helps... Sylv ,AUC,Alin,BLG,BrDep,CRF,CrfMkt,CAS,Casto,Confo,ElecDep,Geant,Halle,KIA,LerMrl,Match,METRO,MNP,SimpMkt Strasbg,4,0,0,2,3,0,0,6,2,1,2,1,0,2,3,2,3,6 Paris,0,0,0,0,10,1,5,2,4,0,5,1,0,0,0,3,7,7 Brest,3,0,0,2,8,0,5,9,4,0,5,0,2,0,0,0,0,0 Lyon,0,0,0,1,4,2,8,2,3,0,5,1,0,0,0,0,4,5 Nice,3,0,0,0,3,2,5,1,2,0,2,0,0,0,0,2,2,0 Limg,3,0,0,1,4,2,3,0,0,0,3,0,0,0,0,1,0,4 Toulse,0,0,0,1,5,4,3,2,2,0,5,0,0,0,0,2,1,5 Nancy,0,0,0,2,3,1,1,8,2,0,2,0,1,0,2,3,2,4 Lille,0,0,0,0,6,8,0,0,2,2,3,1,0,1,5,1,2,6 Mtplier,0,0,0,0,7,3,4,1,0,1,4,0,0,0,0,1,6,3 Aix,0,4,0,0,9,2,5,1,0,0,5,0,0,0,0,1,7,5 Senart,0,0,0,1,10,3,5,0,5,0,6,0,0,0,0,0,3,3 Grenbl,0,0,0,0,3,2,5,3,1,0,5,0,0,0,0,0,0,4 Angers,0,0,0,2,8,0,4,0,4,0,4,0,2,0,0,0,3,3 Brdx,3,0,0,2,4,3,3,0,1,0,5,0,2,0,0,1,3,4 Dijon,0,0,0,1,8,2,5,3,4,0,5,0,0,0,0,2,1,0 Rouen,3,0,0,1,2,0,2,0,3,1,2,1,2,0,0,0,0,6 2012/5/28 Rui Barradas <ruipbarradas at sapo.pt>:
Hello,
Try function read.xls in library gdata
Also, a good way of avoiding such doubts is
library(sos)
findFn('xls')
It returns read.xls as the first line.
Hope this helps,
Rui Barradas
Em 28-05-2012 11:32, sylvain willart escreveu:
hello everyone, i often work on contingency table that I create from data.frame (with table() function) but a friend sent me an excel sheet wich *already is* a contingency table (just a simple 2 way table !...) any clue on how to import it in R (keeping row names and col names) ? any tuto I come accross only mention the table transformation, but never the import of such data I only found read.ftable() but couldn't get it to work any help appreciated Sylv
______________________________________________ R-help at 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.