How to split a data frame?

后端 未结 8 2271
臣服心动
臣服心动 2020-11-22 03:08

I want to split a data frame into several smaller ones. This looks like a very trivial question, however I cannot find a solution from web search.

8条回答
  •  臣服心动
    2020-11-22 03:13

    You could also use

    data2 <- data[data$sum_points == 2500, ]
    

    This will make a dataframe with the values where sum_points = 2500

    It gives :

    airfoils sum_points field_points   init_t contour_t   field_t
    ...
    491        5       2500         5625 0.000086  0.004272  6.321774
    498        5       2500         5625 0.000087  0.004507  6.325083
    504        5       2500         5625 0.000088  0.004370  6.336034
    603        5        250        10000 0.000072  0.000525  1.111278
    577        5        250        10000 0.000104  0.000559  1.111431
    587        5        250        10000 0.000072  0.000528  1.111524
    606        5        250        10000 0.000079  0.000538  1.111685
    ....
    > data2 <- data[data$sum_points == 2500, ]
    > data2
    airfoils sum_points field_points   init_t contour_t   field_t
    108        5       2500          625 0.000082  0.004329  0.733109
    106        5       2500          625 0.000102  0.004564  0.733243
    117        5       2500          625 0.000087  0.004321  0.733274
    112        5       2500          625 0.000081  0.004428  0.733587
    

提交回复
热议问题