topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.62k stars 633 forks source link

error in library(caret) #1249

Open avrenli2 opened 3 years ago

avrenli2 commented 3 years ago

Hello One of my students, who uses a Windows PC, is experiencing the following error message when attempting to open the caret package. We tried multiple solutions, including re-installing R but it didn't work. We would be grateful for your help,

`library(caret)`

Loading required package: lattice

Loading required package: ggplot2

Error: package or namespace load failed for ‘ggplot2’ in namespaceExport(ns, exports):

undefined exports: %+%, %+replace%, .pt, .stroke, AxisSecondary, Coord, CoordCartesian, CoordFixed, CoordFlip, CoordMap, CoordPolar, CoordQuickmap, CoordSf, CoordTrans, Facet, FacetGrid, FacetNull, FacetWrap, Geom, GeomAbline, GeomAnnotationMap, GeomArea, GeomBar, GeomBlank, GeomBoxplot, GeomCol, GeomContour, GeomContourFilled, GeomCrossbar, GeomCurve, GeomCustomAnn, GeomDensity, GeomDensity2d, GeomDensity2dFilled, GeomDotplot, GeomErrorbar, GeomErrorbarh, GeomFunction, GeomHex, GeomHline, GeomLabel, GeomLine, GeomLinerange, GeomLogticks, GeomMap, GeomPath, GeomPoint, GeomPointrange, GeomPolygon, GeomQuantile, GeomRaster, GeomRasterAnn, GeomRect, GeomRibbon, GeomRug, GeomSegment, GeomSf, GeomSmooth, GeomSpoke, GeomStep, GeomText, GeomTile, GeomViolin, GeomVline, Layout, PositionDodge, PositionDodge2, PositionFill, PositionIdentity, PositionJitter, PositionJitterdodge, PositionNudge, PositionStack, Scale, ScaleBinned, ScaleBinnedPosition, ScaleContinuous, ScaleContinuousDate, ScaleContinuousDatetime, ScaleContinuousIdentity, ScaleContinuousPosition, ScaleDiscrete, ScaleDiscreteIdentity, ScaleDiscretePosition, Stat, StatBin, StatBin2d, StatBindot, StatBinhex, StatBoxplot, StatContour, StatContourFilled, StatCount, StatDensity, StatDensity2d, StatDensity2dFilled, StatEcdf, StatEllipse, StatFunction, StatIdentity, StatQq, StatQqLine, StatQuantile, StatSf, StatSfCoordinates, StatSmooth, StatSum, StatSummary, StatSummary2d, StatSummaryBin, StatSummaryHex, StatUnique, StatYdensity, aes, aes_, aes_all, aes_auto, aes_q, aes_string, after_scale, after_stat, annotate, annotation_custom, annotation_logticks, annotation_map, annotation_raster, as_labeller, autolayer, autoplot, benchplot, binned_scale, borders, calc_element, combine_vars, continuous_scale, coord_cartesian, coord_equal, coord_fixed, coord_flip, coord_map, coord_munch, coord_polar, coord_quickmap, coord_sf, coord_trans, cut_interval, cut_number, cut_width, derive, discrete_scale, draw_key_abline, draw_key_blank, draw_key_boxplot, draw_key_crossbar, draw_key_dotplot, draw_key_label, draw_key_path, draw_key_point, draw_key_pointrange, draw_key_polygon, draw_key_rect, draw_key_smooth, draw_key_text, draw_key_timeseries, draw_key_vline, draw_key_vpath, dup_axis, el_def, element_blank, element_grob, element_line, element_rect, element_render, element_text, expand_limits, expand_scale, expansion, facet_grid, facet_null, facet_wrap, find_panel, flip_data, flipped_names, fortify, geom_abline, geom_area, geom_bar, geom_bin2d, geom_bin_2d, geom_blank, geom_boxplot, geom_col, geom_contour, geom_contour_filled, geom_count, geom_crossbar, geom_curve, geom_density, geom_density2d, geom_density2d_filled, geom_density_2d, geom_density_2d_filled, geom_dotplot, geom_errorbar, geom_errorbarh, geom_freqpoly, geom_function, geom_hex, geom_histogram, geom_hline, geom_jitter, geom_label, geom_line, geom_linerange, geom_map, geom_path, geom_point, geom_pointrange, geom_polygon, geom_qq, geom_qq_line, geom_quantile, geom_raster, geom_rect, geom_ribbon, geom_rug, geom_segment, geom_sf, geom_sf_label, geom_sf_text, geom_smooth, geom_spoke, geom_step, geom_text, geom_tile, geom_violin, geom_vline, get_alt_text, get_element_tree, gg_dep, ggplot, ggplotGrob, ggplot_add, ggplot_build, ggplot_gtable, ggproto, ggproto_parent, ggsave, ggtitle, guide_axis, guide_bins, guide_colorbar, guide_colorsteps, guide_colourbar, guide_coloursteps, guide_gengrob, guide_geom, guide_legend, guide_merge, guide_none, guide_train, guide_transform, guides, has_flipped_aes, is.Coord, is.facet, is.ggplot, is.ggproto, is.theme, label_both, label_bquote, label_context, label_parsed, label_value, label_wrap_gen, labeller, labs, last_plot, layer, layer_data, layer_grob, layer_scales, layer_sf, lims, map_data, margin, max_height, max_width, mean_cl_boot, mean_cl_normal, mean_sdl, mean_se, median_hilow, merge_element, panel_cols, panel_rows, position_dodge, position_dodge2, position_fill, position_identity, position_jitter, position_jitterdodge, position_nudge, position_stack, qplot, quickplot, register_theme_elements, rel, remove_missing, render_axes, render_strips, reset_theme_settings, resolution, scale_alpha, scale_alpha_binned, scale_alpha_continuous, scale_alpha_date, scale_alpha_datetime, scale_alpha_discrete, scale_alpha_identity, scale_alpha_manual, scale_alpha_ordinal, scale_color_binned, scale_color_brewer, scale_color_continuous, scale_color_date, scale_color_datetime, scale_color_discrete, scale_color_distiller, scale_color_fermenter, scale_color_gradient, scale_color_gradient2, scale_color_gradientn, scale_color_grey, scale_color_hue, scale_color_identity, scale_color_manual, scale_color_ordinal, scale_color_steps, scale_color_steps2, scale_color_stepsn, scale_color_viridis_b, scale_color_viridis_c, scale_color_viridis_d, scale_colour_binned, scale_colour_brewer, scale_colour_continuous, scale_colour_date, scale_colour_datetime, scale_colour_discrete, scale_colour_distiller, scale_colour_fermenter, scale_colour_gradient, scale_colour_gradient2, scale_colour_gradientn, scale_colour_grey, scale_colour_hue, scale_colour_identity, scale_colour_manual, scale_colour_ordinal, scale_colour_steps, scale_colour_steps2, scale_colour_stepsn, scale_colour_viridis_b, scale_colour_viridis_c, scale_colour_viridis_d, scale_continuous_identity, scale_discrete_identity, scale_discrete_manual, scale_fill_binned, scale_fill_brewer, scale_fill_continuous, scale_fill_date, scale_fill_datetime, scale_fill_discrete, scale_fill_distiller, scale_fill_fermenter, scale_fill_gradient, scale_fill_gradient2, scale_fill_gradientn, scale_fill_grey, scale_fill_hue, scale_fill_identity, scale_fill_manual, scale_fill_ordinal, scale_fill_steps, scale_fill_steps2, scale_fill_stepsn, scale_fill_viridis_b, scale_fill_viridis_c, scale_fill_viridis_d, scale_linetype, scale_linetype_binned, scale_linetype_continuous, scale_linetype_discrete, scale_linetype_identity, scale_linetype_manual, scale_radius, scale_shape, scale_shape_binned, scale_shape_continuous, scale_shape_discrete, scale_shape_identity, scale_shape_manual, scale_shape_ordinal, scale_size, scale_size_area, scale_size_binned, scale_size_binned_area, scale_size_continuous, scale_size_date, scale_size_datetime, scale_size_discrete, scale_size_identity, scale_size_manual, scale_size_ordinal, scale_type, scale_x_binned, scale_x_continuous, scale_x_date, scale_x_datetime, scale_x_discrete, scale_x_log10, scale_x_reverse, scale_x_sqrt, scale_x_time, scale_y_binned, scale_y_continuous, scale_y_date, scale_y_datetime, scale_y_discrete, scale_y_log10, scale_y_reverse, scale_y_sqrt, scale_y_time, sec_axis, set_last_plot, sf_transform_xy, should_stop, stage, standardise_aes_names, stat, stat_bin, stat_bin2d, stat_bin_2d, stat_bin_hex, stat_binhex, stat_boxplot, stat_contour, stat_contour_filled, stat_count, stat_density, stat_density2d, stat_density2d_filled, stat_density_2d, stat_density_2d_filled, stat_ecdf, stat_ellipse, stat_function, stat_identity, stat_qq, stat_qq_line, stat_quantile, stat_sf, stat_sf_coordinates, stat_smooth, stat_spoke, stat_sum, stat_summary, stat_summary2d, stat_summary_2d, stat_summary_bin, stat_summary_hex, stat_unique, stat_ydensity, summarise_coord, summarise_layers, summarise_layout, theme, theme_bw, theme_classic, theme_dark, theme_get, theme_gray, theme_grey, theme_light, theme_linedraw, theme_minimal, theme_replace, theme_set, theme_test, theme_update, theme_void, transform_position, update_geom_defaults, update_labels, update_stat_defaults, waiver, wrap_dims, xlab, xlim, ylab, ylim, zeroGrob

Error: package ‘ggplot2’ could not be loaded

In addition: Warning message:

S3 methods ‘$.ggproto’, ‘$.ggproto_parent’, ‘$<-.uneval’, ‘+.gg’, ‘[.mapped_discrete’, ‘[.uneval’, ‘[<-.mapped_discrete’, ‘[<-.uneval’, ‘[[.ggproto’, ‘[[<-.uneval’, ‘.DollarNames.ggproto’, ‘as.data.frame.mapped_discrete’, ‘as.list.ggproto’, ‘autolayer.default’, ‘autoplot.default’, ‘c.mapped_discrete’, ‘drawDetails.zeroGrob’, ‘element_grob.element_blank’, ‘element_grob.element_line’, ‘element_grob.element_rect’, ‘element_grob.element_text’, ‘format.ggproto’, ‘format.ggproto_method’, ‘fortify.NULL’, ‘fortify.function’, ‘fortify.Line’, ‘fortify.Lines’, ‘fortify.Polygon’, ‘fortify.Polygons’, ‘fortify.SpatialLinesDataFrame’, ‘fortify.SpatialPolygons’, ‘fortify.SpatialPolygonsDataFrame’, ‘fortify.cld’, ‘fortify.confint.glht’, ‘fortify.data.frame’, ‘fortify.default’, ‘fortify.formula’, ‘fortify.glht’, ‘fortify.grouped_df’, ‘fortify.lm’, ‘fortify.map’, ‘fortify.sfc’, ‘fortify.sfg’, ‘fortify.summary.glht’, ‘fortify.tbl’, ‘fortify.tbl_df’, ‘get_alt_text.ggplot’, ‘get_alt_text.ggplot_built’, ‘get [... truncated]

image

topepo commented 3 years ago

Sorry that this occurred. We exclusively see this issue with windows computers and often when the OS has extra security policies. It appears that the package was unzipped and installed but install.packages() does not verify this. Some times, the OS thinks that the package install is an issue and silently quarantines it.

I suggest using the development version of the pak package. It checks for these specific issues and lets you know if there is an issue.