在 R 中选择热图的列
我再次需要你的帮助:)
我编写了一个 R 脚本,它根据给定的制表符分隔的 txt 或 xls 文件生成热图。目前,我在 xls 文件中手动删除了热图中不需要的所有列。 现在我想自动化它,但我不知道如何:(
所有 xls 文件中有趣的列都以相同的开头,后跟一个单独的名称:
xls-file 1: L1_tpm_xxxx L2_tpm_xxxx L3_tpm_xxxx
xls-file 2: L1_tpm_xxxx L2_tpm_xxxx L3_tpm_xxxx L4_tpm_xxxx L5_tpm_xxxx
有什么想法如何选择这些列吗?
谢谢您,Philipp
I need your help again :)
I wrote an R script, that generates a heatmap out of a given tab-seperated txt or xls file. At the moment, I delete all columns I don't want to have in the heatmap by hand in the xls file.
Now I want to automatize it, but I don't know how :(
The interesting columns all start the same in all xls files, followed by an individual name:
xls-file 1: L1_tpm_xxxx L2_tpm_xxxx L3_tpm_xxxx
xls-file 2: L1_tpm_xxxx L2_tpm_xxxx L3_tpm_xxxx L4_tpm_xxxx L5_tpm_xxxx
Any ideas how to select those columns?
Thanking you in anticipation, Philipp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您认为 Excel 工作表中的列位置是固定的,那么最简单的解决方案是仅使用列索引。例如,如果您使用 read.table 将制表符分隔的文本文件导入为 data.frame,然后决定只保留前两列,则可以执行以下操作:
If you think the column positions are going to be fixed across excel sheets, the simplest solution here is to just use column indices. For example, if you use read.table to import a tab-delimited text file as a data.frame, and then decide you'd prefer to only keep the first two columns, you might do something like this:
您可以使用(如果您已在 data.frame
df
中读取数据):或者您可以显式编写所需的列:
等等...
以下 链接非常有用;-)
You could use (if you have read your data in a data.frame
df
):or you can explicitly write the columns that you want:
etc...
The following link is quite useful;-)