Plotting Simple Data in R

后端 未结 7 1836
旧时难觅i
旧时难觅i 2021-02-01 06:28

I have a comma separated file named foo.csv containing the following data:

scale, serial, spawn, for, worker
5, 0.000178, 0.000288, 0.000292, 0.0003         


        
7条回答
  •  名媛妹妹
    2021-02-01 06:55

    I am far from being an R expert, but I think you need a data.frame:

    plot(data.frame(data[1],data[2]))
    

    It does at least plot something on my R setup!

    Following advice in luapyad's answer, I came up with this. I renamed the header "scale":

    scaling, serial, spawn, for, worker
    5, 0.000178, 0.000288, 0.000292, 0.000300
    10, 0.156986, 0.297926, 0.064509, 0.066297
    12, 2.658998, 6.059502, 0.912733, 0.923606
    15, 188.023411, 719.463264, 164.111459, 161.687982
    

    then:

    foo <- read.table("foo.csv", header=T,sep=",")
    attach(foo)
    plot( scaling, serial );
    

提交回复
热议问题