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

Error in file.info(x, extra_cols = FALSE) : file name conversion problem -- name too long? #72

Open
mjdzr opened this issue May 11, 2023 · 0 comments

Comments

@mjdzr
Copy link

mjdzr commented May 11, 2023

Hi

First of all, thank you for creating this package, it's amazing. I am working on some confidential data and use SlickR to create some plot carousel. Many datasets end up okay, but a few of them return the following error after I run the slickR function:

Error in file.info(x, extra_cols = FALSE) : 
  file name conversion problem -- name too long?

Unfortunately I cannot share the dataset, but I can confirm that the final_plot object, if called on its own, works and plots the desired output. But the slickR throws an error.

The code that I'm using:

for (i in 1){ #Create a one-slide carousel
  fig_list[[i]] <- 
    {
      svglite::xmlSVG(
        code = {
          
          g = ggplot(plotdata) +
            geom_point(aes(x = DATE2, y = VARIABLE_VALUE, shape = Censored, 
                           fill = TYPE, color = TYPE), color = "black"
                       , size = 3, alpha = 0.8) +         
            scale_x_date(date_breaks = "5 years", date_labels = "%b-%y") +
            theme_bw() +
            scale_shape_manual(values = c("TRUE" = 24, 'FALSE' = 21))
          
          #First plot, with legends
          p1 <- (
            g + 
              guides(fill = guide_legend(override.aes = list(shape = 21))) +
              theme(legend.position = "right",
                    axis.title.x=element_blank(),
                    axis.text.x = element_blank())
          )
          
          #Second plot: log, without legend
          p2 <- (
            g + scale_y_log10(labels = label_comma()) + 
              theme(legend.position = "none")
          )
          
          final_plot = ggdraw() +
            draw_plot( plot = p2, x = 0, y = 0, width = 1, height = .35 ) +
           #testing a table to be added on top of plots
            draw_plot( plot = tableGrob(iris[1, ], rows = NULL), x = 0, y = .7, width = 1, height = .3 ) +  
            draw_plot( plot = p1, x = 0, y = 0.35, width = 1, height = .35 ) 
          show(final_plot)
        },
        standalone = TRUE, width = 7)
    }
}

slickR(fig_list)
Error in file.info(x, extra_cols = FALSE) : 
  file name conversion problem -- name too long?

Note: if I remove scale_shape_manual(values = c("TRUE" = 24, 'FALSE' = 21)) the error diappears and slickR works well.
Also if I don't add the table (tableGrob(iris[1, ], rows = NULL)), the slickR function works well.

Any ideas on why that error is thrown? I have also checked long/short path names for my project. There is no non-English character in the directory.

Thank you!

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

1 participant