I exported a file from Tableau that I want to read in R. But, when I load the csv, it reports an Error, but checking the file, its created in this way:
Año Categoría Migratoria Centro Regional Ciudad Hospedaje Colombiano Extranjero Departamento Hospedaje Departamento1 Entrada Salida Entrada Salida (copia) Meses1 Motivo Viaje País Destino Procedencia País Nacionalidad Puesto Migratorio Rango Edad Region Destino Region Nacionalidad Sexo1 Tipo Transporte Cantidad de filas (agregadas) aFemenino Masculino Number of Records
2022 Sin Especificar Antioquia Sabaneta Colombianos Antioquia Antioquía Entradas Entradas Septiembre Residente República Dominicana Colombia Aeropuerto José María Córdova de Rionegro 0-17 América Central y el Caribe América del Sur Femenino Aéreo 2 2 0 1
2022 Sin Especificar Antioquia Rionegro Colombianos Antioquia Antioquía Entradas Entradas Septiembre Turismo México Colombia Aeropuerto José María Córdova de Rionegro 0-17 América Central y el Caribe América del Sur Femenino Aéreo 1 1 0 1
2022 Sin Especificar Antioquia Envigado Colombianos Antioquia Antioquía Entradas Entradas Septiembre Turismo República Dominicana Colombia Aeropuerto José María Córdova de Rionegro 0-17 América Central y el Caribe América del Sur Femenino Aéreo 3 3 0 1
2022 Sin Especificar Antioquia Barranquilla Colombianos Atlántico Antioquía Entradas Entradas Septiembre Residente República Dominicana
Excel reads it flawlessly, but R give me this error when I run df <- read.csv(file = pathfile, header = TRUE, sep = " ", dec = ".", encoding = "ANSI", stringsAsFactors = FALSE)
Error in make.names(col.names, unique = TRUE) :
invalid multibyte string at '<ff><fe>A'
Además: Warning messages:
1: In read.table(file = file, header = header, sep = sep, quote = quote, :
line 1 appears to contain embedded nulls
2: In read.table(file = file, header = header, sep = sep, quote = quote, :
line 2 appears to contain embedded nulls
3: In read.table(file = file, header = header, sep = sep, quote = quote, :
line 3 appears to contain embedded nulls
4: In read.table(file = file, header = header, sep = sep, quote = quote, :
line 4 appears to contain embedded nulls
5: In read.table(file = file, header = header, sep = sep, quote = quote, :
line 5 appears to contain embedded nulls