由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - ask for help for R programming
相关主题
读入 1000 - 2000 个CSV 文件help for a sas question
请教sas高人(数据读入)请教大家bioinformatics一个问题
求教 SAS数据转化【求助】Large Dataset Management
怎样用R定位变量的位置新手请SAS合并数据集问题
请教个用SAS读数据的问题。SAS problem ask for help!
which route in SAS is faster?怎么用SAS做加减乘除
Ask help for R data restructure, Thanks!!! (转载)双包子求教:sas data manipulation问题
[合集] 不是统计专业的, 问个excel的问题sas大牛们这个要怎么实现呀
相关话题的讨论汇总
话题: ab话题: 517话题: bb话题: chr话题: aa
进入Statistics版参与讨论
1 (共1页)
w*****1
发帖数: 473
1
I need to transpose a file to example.txt
the final dataset should be sorted by chr first then by position. Could
anyone help me to write the R code? Thank you very much!
raw data:
snp Chr pos Sample.ID Allele1 Allele2
rs6269442 1 1.614 517 A B
rs13475701 1 1.744 517 A B
rs13475706 1 1.889 517 A B
rs3684358 1 2.06 517 A B
rs13475729 1 3.749 517 A B
rs3671256 1 5.009 517 A B
rs13475750 1 6.153 517 A B
rs6404446 1 6.442 517 A B
rs31949292 1 8.486 517 A B
rs6173215 1 8.692 517 A B
rs31917015 1 10.425 517 A B
rs6166266 1 10.731 517 A B
rs3677683 1 10.932 517 A B
rs3695988 1 11.345 517 A B
rs4137502 1 11.461 517 A B
.
.
.
example.txt
snp chr pos sampel.id1 sample.id2 .........
rs6269442 1 1.614 AB AB
rs13475701 1 1.744 AA AB
rs13475706 1 1.889 AA AB
rs3684358 1 2.06 AB BB
rs13475729 1 3.749 AB BB
rs3671256 1 5.009 AB BB
rs13475750 1 6.153 AB AB
rs6404446 1 6.442 AB AB
rs31949292 1 8.486 AB AB
rs6173215 1 8.692 AB AB
rs31917015 1 10.425 AB AB
rs6166266 1 10.731 AB AB
rs3677683 1 10.932 AB AB
rs3695988 1 11.345 AB AB
rs4137502 1 11.461 AB AB
.
.
.
k*******a
发帖数: 772
2
try reshape function
or reshape2 R package
v*******e
发帖数: 11604
3
假定你数据已经读入为,名为rawdata
rawdata[order(rowdata$Chr, rowdata$pos),]
w*****1
发帖数: 473
4
I tried reshape and it works! Thank you very much!

【在 k*******a 的大作中提到】
: try reshape function
: or reshape2 R package

1 (共1页)
进入Statistics版参与讨论
相关主题
sas大牛们这个要怎么实现呀请教个用SAS读数据的问题。
one quick question about concatenating data in SASwhich route in SAS is faster?
怎么用SAS transpose这两dataset呀?Ask help for R data restructure, Thanks!!! (转载)
Python:请问如何把list变成structured array。 (转载)[合集] 不是统计专业的, 问个excel的问题
读入 1000 - 2000 个CSV 文件help for a sas question
请教sas高人(数据读入)请教大家bioinformatics一个问题
求教 SAS数据转化【求助】Large Dataset Management
怎样用R定位变量的位置新手请SAS合并数据集问题
相关话题的讨论汇总
话题: ab话题: 517话题: bb话题: chr话题: aa