h(SimpleRorror(msg,call))与' as.matrix':无法打开连接的错误

发布于 2025-01-26 07:34:31 字数 1161 浏览 1 评论 0原文

这是我在这里的第一个问题。目前,我正在学习如何在R-Studio中使用R,并且当我尝试以矩阵形式读取数据时,该程序显示了错误。我尝试了此代码:

ModelName = 'new_file' #I'm writing the file name in the same directory as the .r file is
FileName = paste(ModelName, '.txt', sep = '') #as far as I understand, I'm telling the program that 
the file is in the form of txt

### Read Time series
d = as.matrix(read.table(FileName, header= T))

然后该程序写下了:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': 
cannot open the connection

我不明白为什么它不起作用。

分析的文件以TXT形式,数据的示例如下:

decy Temp CTD_S OxFix Pro Syn Piceu Naneu
 2011.74221     27.60333     36.20700     27.26667  58638.33333  13107.00000    799.66667    117.66667
 2011.74401     26.97950     36.13400     27.05000  71392.50000  13228.50000   1149.00000    116.50000
 2011.74617     24.99750     35.34450     24.80000 264292.00000  27514.00000   2434.50000    132.50000
 2011.74692     24.78400     35.25800     25.82500 208996.50000  39284.00000   3761.75000    220.75000

我的R-Studio版本为4.2.0。

我会非常感谢解释。

This is my first question here. For now I'm learning how to use R in R-studio, and when I tried to read the data in a matrix form, the program showed the mistake. I tried this code:

ModelName = 'new_file' #I'm writing the file name in the same directory as the .r file is
FileName = paste(ModelName, '.txt', sep = '') #as far as I understand, I'm telling the program that 
the file is in the form of txt

### Read Time series
d = as.matrix(read.table(FileName, header= T))

And then the program writes this:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': 
cannot open the connection

And I don't understand why it's not working.

The file for analysis is in the txt form, the example of data is below:

decy Temp CTD_S OxFix Pro Syn Piceu Naneu
 2011.74221     27.60333     36.20700     27.26667  58638.33333  13107.00000    799.66667    117.66667
 2011.74401     26.97950     36.13400     27.05000  71392.50000  13228.50000   1149.00000    116.50000
 2011.74617     24.99750     35.34450     24.80000 264292.00000  27514.00000   2434.50000    132.50000
 2011.74692     24.78400     35.25800     25.82500 208996.50000  39284.00000   3761.75000    220.75000

My r-studio version is 4.2.0.

I would be very grateful for explanation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文