Error in grid.newpage() : 視窗的位置或大小不能是无限的

想问一下,这个怎么操作

picWidth <- length(unique(corr$node2))/4 + max(nchar(corr$node1))/20+2
Warning message:
In max(nchar(corr$node1)) : no non-missing arguments to max; returning -Inf

picHeight <- length(unique(corr$node1))/4 + max(nchar(corr$node2))/20

Warning message:
In max(nchar(corr$node2)) : no non-missing arguments to max; returning -Inf
ggsave(

  •   "corr.pdf",
    
  •   plot = p,
    
  •   width = picWidth,
    
  •   height = picHeight,
    
  •   limitsize = FALSE
    
  • )
    
    Error in grid.newpage() : 視窗的位置或大小不能是无限的

    ggsave(

  •  "corr.tiff",
    
  •  plot = p,
    
  •  width = picWidth,
    
  •  height = picHeight,
    
  •  limitsize = FALSE
    
  • )####----鍥剧墖淇℃伅澶浼氭姤閿?
    Error in tiff_dev(..., res = dpi, units = "in") :
    'width'或'height'的值不对

在max(nchar(corr$node2)函数里添加参数:na.rm=T,试一下看看。