如何修复错误“关闭未使用的连接” [英] How to fix error "closing unused connection"
本文介绍了如何修复错误“关闭未使用的连接”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要阅读 Test.csv
前5列,我可以:
To read in the first 5 columns of Test.csv
I may go:
x <- matrix(scan(pipe(paste0("cut -f1,2,3,4,5 -d, ","/home/test/Test.csv")),skip=1,sep=","),ncol=5)
然后如果我使用正常方法:
Then if I read it using a normal method:
y <- read.csv("/home/test/Test.csv")
我收到错误信息:
Warning message:
closing unused connection 3 (cut -f1,2,3,4,5 -d, /home/test/Test.csv)
这个错误讯息是否有问题,如果有,如何解决?
Is this error message a problem, and if so how do I remedy it?
推荐答案
我无法复制我的系统上的警告。但是,您可以尝试显式关闭连接:
I cannot replicate the warning on my system. However, you could try closing the connection explicitly:
con <- pipe(paste0("cut -f1,2,3,4,5 -d, ","/home/test/Test.csv"))
x <- matrix(scan(con,skip=1,sep=","),ncol=5)
close(con)
这篇关于如何修复错误“关闭未使用的连接”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文