[R-es] leer ficheros excel en R en Ubuntu

Jorge I Velez jorgeivanvelez en gmail.com
Vie Ago 15 02:23:58 CEST 2014


Hola Miguel,

A que te refieres con "y nada"?  Obtienes algun error?  Algun mensaje?  Has
probado con scan() y/o readLines()?

Saludos,
Jorge.-



2014-08-15 7:38 GMT+10:00 Miguel Fiandor Gutiérrez <
miguel.fiandor.gutierrez en gmail.com>:

> Hola,
>
> Pensé que esto iba a ser trivial en R, pero me estoy encontrado muchos con
> mi problema en internet, y que las soluciones ofrecidas no terminan de
> funcionar.
>
> Estoy intentando leer un fichero .xls en ubuntu con los siguientes paquetes
> y nada:
>
> require(RODBC)
> conn = odbcConnectExcel("madrid.xls") # open a connection to the Excel file
> sqlTables(conn)$TABLE_NAME # show all sheets
> df = sqlFetch(conn, "Sheet1") # read a sheet
> df = sqlQuery(conn, "select * from [Sheet1 $]") # read a sheet (alternative
> SQL sintax)
> close(conn) # close the connection to the file
>
> require(gdata)
> xlsfile <- file.path(path.package('gdata'),'xls','madrid.xls')
> df = read.xls (xlsfile)
> df = read.xls (xlsfile, sheet = 1, header = TRUE)
> df = read.xls ("madrid.xls", sheet = 1, header = TRUE)
> df = read.xls ("madrid.xls")
>
> require(xlsx)
> read.xlsx("madrid.xls", sheetName = "Sheet1")
>
> library(XLConnect)
> wk = loadWorkbook("madrid.xls")
> df = readWorksheet(wk, sheet="Sheet1")
>
> --
>
> también he probado directamente read.table ya que el fichero es tipo xml
> por dentro:
> df = read.table("madrid.xls", header = TRUE)
>
>
> -- ejemplo del fichero:
> $ head -c 500 madrid.xls
> <table border="1"><tr><th bgcolor="#FFB18C">Nombre de la
> instalacion</th><th bgcolor="#FFB18C">Municipio de la instalacion</th><th
> bgcolor="#FFB18C">Provincia de la instalacion</th><th
> bgcolor="#FFB18C">Clave del registro</th><th bgcolor="#FFB18C">Codigo
> registro autonomico definitivo</th><th bgcolor="#FFB18C">Potencia nominal
> de la fase (kW)</th><th bgcolor="#FFB18C">Grupo Normativo</th><th
> bgcolor="#FFB18C">Tipo de Inscripcion</th></tr><tr><td>PERGOLA FOTOVOLTAICA
> JARDINES COMPLEJO DE MONCLOA
> ...
>
>
> Gracias de antemano.
>
> Por cierto, aprovecho que lanzo la pregunta es para una aplicación Shiny,
> alguna recomendación de como leer esta info solo una vez al arrancar el
> servidor?
>
>
> Miguel
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

	[[alternative HTML version deleted]]



Más información sobre la lista de distribución R-help-es