美文网首页R语言的学习
R语言读入table和csv格式的表格

R语言读入table和csv格式的表格

作者: Ashu | 来源:发表于2019-05-04 09:28 被阅读0次

    第二次作业:

    1.笔记整理

    201904023的作业笔记整理在简书:
    https://www.jianshu.com/p/aeb2f74b4080

    2.R包安装 http://www.bio-info-trainee.com/3727.html

    看了曾老师的R包安装视频教程,到官网或者通过网友传输下载R包,根据电脑配置(有Window系统和Mac系统)选择匹配的R包,在安装过程中,因为自己不太熟悉电脑的软件,选默认安装途径。

    3.R markdown使用

    在RStudio中从文件夹“file”的子目录“New file”里打开R markdown:


    markerdown的打开方式.png

    了解markdown一些选项和图标的功能:

    选项及图标功能.png

    4.数据存读:数据存读:https://www.jianshu.com/p/6ba9da4e2f5b

    下载的txt文件.png
    a<-read.csv('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt')
    b<-read.csv('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt',)
    d<-read.csv('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt',comment.char = '!',sep='\t')
    f<-read.table('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt',sep = '\t',)
    ####dim(询问数据类型的维度)
    dim(d)
    dim(f)
    head(d)
    head(f)
    tail(d)
    tail(f)
    write.table(x = f,file = '0418.txt')
    
    > a<-read.csv('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt')
    > b<-read.csv('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt',)
    > d<-read.csv('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt',comment.char = '!',sep='\t')
    > f<-read.table('/Users/chenjiangshu/cjs-beginner/GSE17215_series_matrix.txt',sep = '\t',fill=T,skip=66,header=T)
    > dim(d)
    [1] 22277     7
    > dim(f)
    [1] 22278     7
    > head(d)
        ID_REF GSM431121 GSM431122  GSM431123  GSM431124  GSM431125  GSM431126
    1 1007_s_at 481.59980 596.79062 2721.83475 2566.31563 2737.76320 2629.25380
    2   1053_at 306.82972 224.97956  246.73288  251.85537  245.55677  196.34917
    3    117_at  30.32576  27.28749   40.12724   40.04009   48.14327   37.57184
    4    121_at 125.04107 147.67525  138.18675  160.26449  151.04978  143.56799
    5 1255_g_at  19.87286  18.08049   19.11944   19.19024   21.11857   18.96300
    6   1294_at  61.81515  57.12277   49.46442   45.69329   49.95233   46.70881
    > head(f)
        ID_REF GSM431121 GSM431122  GSM431123  GSM431124  GSM431125  GSM431126
    1 1007_s_at 481.59980 596.79062 2721.83475 2566.31563 2737.76320 2629.25380
    2   1053_at 306.82972 224.97956  246.73288  251.85537  245.55677  196.34917
    3    117_at  30.32576  27.28749   40.12724   40.04009   48.14327   37.57184
    4    121_at 125.04107 147.67525  138.18675  160.26449  151.04978  143.56799
    5 1255_g_at  19.87286  18.08049   19.11944   19.19024   21.11857   18.96300
    6   1294_at  61.81515  57.12277   49.46442   45.69329   49.95233   46.70881
    > tail(d)
                  ID_REF GSM431121 GSM431122 GSM431123 GSM431124 GSM431125 GSM431126
    22272  AFFX-ThrX-3_at  25.14590  25.55137  25.96761  26.44569  30.54909  24.86885
    22273  AFFX-ThrX-5_at  19.88238  19.44767  19.86274  20.04666  22.50811  19.22124
    22274  AFFX-ThrX-M_at  18.68637  18.06303  18.94539  19.43978  19.48697  18.94799
    22275 AFFX-TrpnX-3_at  19.93025  20.31343  19.57098  19.91236  20.14536  20.05193
    22276 AFFX-TrpnX-5_at  18.73988  19.09319  19.23404  18.54682  21.10093  18.34052
    22277 AFFX-TrpnX-M_at  18.91361  19.58369  19.00904  18.34500  18.64643  17.76356
    > tail(f)
                           ID_REF GSM431121 GSM431122 GSM431123 GSM431124 GSM431125 GSM431126
    22273           AFFX-ThrX-5_at  19.88238  19.44767  19.86274  20.04666  22.50811  19.22124
    22274           AFFX-ThrX-M_at  18.68637  18.06303  18.94539  19.43978  19.48697  18.94799
    22275          AFFX-TrpnX-3_at  19.93025  20.31343  19.57098  19.91236  20.14536  20.05193
    22276          AFFX-TrpnX-5_at  18.73988  19.09319  19.23404  18.54682  21.10093  18.34052
    22277          AFFX-TrpnX-M_at  18.91361  19.58369  19.00904  18.34500  18.64643  17.76356
    22278 !series_matrix_table_end        NA        NA        NA        NA        NA        NA
    > write.table(x = f,file = '0418.txt')
    

    相关文章

      网友评论

        本文标题:R语言读入table和csv格式的表格

        本文链接:https://www.haomeiwen.com/subject/rntngqtx.html