全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
4579 9
2016-11-07
悬赏 20 个论坛币 已解决
RT,本人需要用下面这个函数录入数据(Polysat包中的函数)
Genotypes(mygen, loci="lG") <- list(c(120, 124, 130, 136), c(122, 120),c(128, 130, 134))

因为数据都存储在excel中,首先需要将excel中的数据导入到R中,但read.table函数默认将数据存储为数据框的形式,而且这个函数不识别NA(数据里有NA会报错),请问各位大神,有没有什么方法能把数据转化为合适的格式?


最佳答案

zhangyangsmith 查看完整内容

I would not worry about the attributes. It would not hurt and you will be able to use the elements of the list the same way as a vector without any attributes. If you insist on non-attribute vectors in the list:In your loop you will have to replacebyto make it work.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-11-7 22:23:09
jxapp_6451 发表于 2016-11-10 02:43
列表里会多出信息,
试了一下只有这样能返回需要的结果
然后尝试了这个循环无果
I would not worry about the attributes. It would not hurt and you will be able to use the elements of the list the same way as a vector without any attributes.

If you insist on non-attribute vectors in the list:
复制代码
In your loop you will have to replace
复制代码
by
复制代码
to make it work.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-8 02:26:24
可以把数据框转为list啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-8 13:01:16
johnmy 发表于 2016-11-8 02:26
可以把数据框转为list啊
那具体怎么操作?我还是小白刚接触R,,
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-9 04:14:41
as.list
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-11-9 21:17:51
johnmy 发表于 2016-11-9 04:14
as.list
那该怎么去掉list里面的NA呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群