Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't load *.dat files after update #79

Closed
ProfessorPeregrine opened this issue Oct 31, 2023 · 9 comments
Closed

Can't load *.dat files after update #79

ProfessorPeregrine opened this issue Oct 31, 2023 · 9 comments

Comments

@ProfessorPeregrine
Copy link

Previously, my app would load text files with a .dat extension (usually they would be tab-delimited). Now it says " Ooops Format not supported"

Is there a way to add this functionality back? There are many legacy files that loaded just fine that I will have to change the extension on now if not.

Thanks again for an amazing package!

@pvictor
Copy link
Member

pvictor commented Nov 8, 2023

Hello,
It seems that package rio no longer support .dat files, this produce an error :

readr::write_delim(mtcars, file = "mtcars.dat")
rio::import(file = "mtcars.dat")

if you want to be able to import .dat files with datamods you can still specify the function to use manually for this specific extension :

imported <- import_file_server(
  id = "myid",
  read_fns = list(
    dat = function(file) {
      readr::read_delim(file = file)
    }
  )
)

Victor

@ProfessorPeregrine
Copy link
Author

ProfessorPeregrine commented Nov 8, 2023 via email

@pvictor
Copy link
Member

pvictor commented Nov 8, 2023

Be sure to use latest version, import_server() should have a read_fns argument.

@ProfessorPeregrine
Copy link
Author

ProfessorPeregrine commented Nov 8, 2023 via email

@ProfessorPeregrine
Copy link
Author

ProfessorPeregrine commented Nov 9, 2023 via email

@pvictor
Copy link
Member

pvictor commented Nov 10, 2023

Seems to be a readr error, for single column file you have to explicitly set delim = " ", e.g. :

readr::write_delim(mtcars[, 1, drop = FALSE], file = "mtcars1.dat")

readr::read_delim(file = "mtcars1.dat")
# Error: Could not guess the delimiter.
# 
# Use `vroom(delim =)` to specify one explicitly.

readr::read_delim(file = "mtcars1.dat", delim = " ")
# Rows: 32 Columns: 1                                                                                                                                                                                                                                           
# ── Column specification ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# Delimiter: " "
# dbl (1): mpg
# 
# ℹ Use `spec()` to retrieve the full column specification for this data.
# ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# # A tibble: 32 × 1
#     mpg
#   <dbl>
# 1  21  
# 2  21  
# 3  22.8
# 4  21.4
# 5  18.7
# 6  18.1
# 7  14.3
# 8  24.4
# 9  22.8
# 10  19.2
# # ℹ 22 more rows
# # ℹ Use `print(n = ...)` to see more rows

@chainsawriot
Copy link
Contributor

chainsawriot commented Jun 9, 2024

@pvictor @ProfessorPeregrine Sorry for the breaking change. Will fix this here gesistsa/rio#430 .

@pvictor
Copy link
Member

pvictor commented Jun 10, 2024

Thank you @chainsawriot ! Great work 👍

@ProfessorPeregrine
Copy link
Author

Thank you @chainsawriot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants