由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DataSciences版 - ask for help for R programming (转载)
相关主题
请问EXCEL大拿,请教一个R问题:怎么rbind一系列data,如data1,data2,....data1000
datascientist几个基本问题Senior Data Scientist in NC
请教一道面试题Need senior data analyst - Seattle (转载)
sort a matrix (1M rows x 100 columns) for each row in GPU如何用不同来源的Obs来fit 一个 Dist.
[Data Science Project Case] Data Monitoring波士顿保险公司工作机会 (转载)
请教proc transpose 问题 (转载)【找工作】 生物信息学 / 癌症细胞生物学 背景
Role mining请教一个面试题(已跪)
R describe datasetpyspark subtract 如何使用?
相关话题的讨论汇总
话题: ab话题: 517话题: bb话题: chr话题: aa
进入DataSciences版参与讨论
1 (共1页)
w*****1
发帖数: 473
1
【 以下文字转载自 Statistics 讨论区 】
发信人: wz99331 (dotti), 信区: Statistics
标 题: ask for help for R programming
发信站: BBS 未名空间站 (Thu Oct 16 15:25:16 2014, 美东)
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*e
发帖数: 238
2
ordered = raw[order(raw$Chr, raw$pos),]

【在 w*****1 的大作中提到】
: 【 以下文字转载自 Statistics 讨论区 】
: 发信人: wz99331 (dotti), 信区: Statistics
: 标 题: ask for help for R programming
: 发信站: BBS 未名空间站 (Thu Oct 16 15:25:16 2014, 美东)
: 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

w*****1
发帖数: 473
3
this is only to order the data, did not transpose the snp id so that each
column is for one sample id, currently each sample has many snps.
w*****1
发帖数: 473
4
there are about 1000 sample ids, I only list the first sample id.
P*****6
发帖数: 273
5
用个loop 不就行了。你又不追求速度

【在 w*****1 的大作中提到】
: there are about 1000 sample ids, I only list the first sample id.
1 (共1页)
进入DataSciences版参与讨论
相关主题
pyspark subtract 如何使用?[Data Science Project Case] Data Monitoring
急,xgboost prediction的问题请教proc transpose 问题 (转载)
python数据处理的一个问题 (转载)Role mining
R 里面random forest score新的data有new level的问题R describe dataset
请问EXCEL大拿,请教一个R问题:怎么rbind一系列data,如data1,data2,....data1000
datascientist几个基本问题Senior Data Scientist in NC
请教一道面试题Need senior data analyst - Seattle (转载)
sort a matrix (1M rows x 100 columns) for each row in GPU如何用不同来源的Obs来fit 一个 Dist.
相关话题的讨论汇总
话题: ab话题: 517话题: bb话题: chr话题: aa