如果您的一条列有不均匀的行,如何在R中分开列?
我有一个.csv文件,其中我有一个列,每行25-30个字符。我需要将一列分为25列,每个列在每个列中都有自己的特征(或核苷酸)。因此,我将忽略每一行的额外0-5个核苷酸。
.csv文件看起来与此相似:
序列
- atcggtcggggggat
- tgctggcaaa accgtcgaa
- accgtcgaa
- actggtaattg
我需要表看起来与此相似:
sequence sequence
- atgct gtact
- ggtact ggtact
- ggtcc
- atggtg
ggtcc 对我来说,目标是试图找到每一列的核苷酸频率,这就是为什么我需要分开列的原因。
我是R的新手,因此,任何帮助都将不胜感激!
I have a .csv file where I have one column with 25-30 characters per row. I need to separate the one column into 25 columns each with its own character (or nucleotide) inside each. Thus, I will be ignoring the extra 0-5 nucleotides in each row.
The .csv files looks similar to this:
Sequence
- ATCGGTCGGGGGAT
- TGCTGGCAAA
- ACCGTCGAA
- ACTGGTAATTG
I need the table to look similar to this:
Sequence
- A T G C T
- G T A C T
- G G T C C
- A T G T G
If this information helps: the end goal for me is trying to find the nucleotide frequencys of each column that is why I need the columns to be separated.
I am very new to R so any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先使用
dput()
提供我们可以剪切/粘贴的数据。切碎您不需要的碎片,然后将其拆分:
First use
dput()
to provide data that we can cut/paste.The chop off the bits you don't need and split the rest: