0
$\begingroup$

I am trying to pull data from my .csv file. I am using this command:

mydata[mydata$Model_Data>3.0,c("Model_Data","Date")]

As you can see from the results below, it is counting ALL instances, however, I wish to set this to a 64 line ignore upon first matching instance. How would you suggest I go about adding this 'ignore 'n' line function' ?

Snippet of data here:

      Model_Data     Date
1       8.788927 19670103
2       5.625603 19670104
3       4.853577 19670105
4       4.558040 19670106
5       4.322114 19670109
6       3.011257 19670110
7       6.234991 19670111
8       3.970446 19670112
9       3.144710 19670113
11      3.121524 19670117
15      3.659759 19670123
314     5.034324 19680401
316     4.395672 19680403
320     4.042018 19680410
485     3.647299 19690113
750     3.632671 19700203
785     4.167759 19700325
809     4.520325 19700429
829     4.116661 19700527
1138    7.950606 19710816
1139    3.260332 19710817
1493    3.929633 19730111
1502    3.094216 19730124
1515    3.728929 19730213
1570    3.369889 19730503
1934    3.254718 19741010
2008    3.845721 19750127
2021    3.039563 19750213
2714    4.134147 19771110
2820    6.223156 19780414
2821    7.745218 19780417
2827    4.743293 19780425
2828    3.033731 19780426
2896    4.192446 19780802
2897    4.422611 19780803
2958    4.189009 19781030
2960    4.180385 19781101
3183    3.427686 19790920
3196    4.392758 19791009
3197    6.126659 19791010
3259    3.585480 19800109
3264    3.165421 19800116
3275    3.521842 19800131
3314    3.699859 19800327
3468    5.436180 19801105
3510    4.302425 19810107
3917    3.917657 19820817
3918    4.391777 19820818
3920    3.173933 19820820
3921    3.354431 19820823
3924    3.382543 19820826
3930    3.257510 19820903
3953    3.201376 19821007
3955    3.558906 19821011
3957    3.060809 19821013
3972    3.596346 19821103
4414    4.728832 19840802
4415    6.362526 19840803
4416    3.995445 19840806
4419    3.081986 19840809
4420    3.271267 19840810
4468    3.220568 19841018
4510    3.585172 19841218
4759    3.046736 19851213
4775    5.164241 19860108
4818    3.460404 19860311
4899    3.051578 19860707
4946    5.638514 19860911
4947    3.806834 19860912
5039    6.066431 19870123
5095    3.536616 19870414
5224    5.730824 19871016
5225   11.180750 19871019
5226    6.897399 19871020
5227    4.537756 19871021
5228    3.229374 19871022
5582    3.155970 19890317
5728    6.600688 19891013
5729    6.704284 19891016
5931    4.177266 19900803
6046    4.380562 19910117
6257    3.193782 19911115
6480    3.983774 19921005
6533    3.139862 19921218
6572    4.023227 19930216
6574    3.056474 19930218
6605    3.035592 19930402
6637    3.505759 19930519
6819    3.674848 19940204
6857    3.853518 19940331
6858    3.048781 19940404
7150    3.038139 19950531
7184    5.645942 19950719
7242    3.910097 19951010
7301    3.255512 19960104
7305    3.574967 19960110
7346    5.189287 19960308
7435    5.112708 19960716
7568    3.238173 19970123
7577    3.007577 19970205
7760    5.930298 19971027
7761    7.836272 19971028
7953    3.613173 19980804
7970    3.899849 19980827
7972    5.255132 19980831
7973    5.310272 19980901
7999    3.806758 19981008
8130    3.407432 19990419
8265    3.204466 19991028
8311    3.483312 20000104
8314    3.101274 20000107
8324    3.273686 20000124
8361    3.905785 20000316
8374    5.991309 20000404
8382    4.642381 20000414
8563    4.287756 20010103
8635    3.294676 20010418
8736    3.260459 20010917
8738    3.009326 20010919
8947    3.005049 20020719
8950    4.684101 20020724
9830    3.024372 20060120
9926    3.253976 20060608
10106   6.153445 20070227
10108   3.018874 20070301
10208   3.016551 20070724
10210   5.810003 20070726
10213   3.048170 20070731
10214   3.093512 20070801
10216   3.203759 20070803
10217   3.358139 20070806
10220   3.897666 20070809
10225   4.290941 20070816
10333   3.479401 20080122
10334   4.699377 20080123
10497   3.575420 20080915
10498   3.417303 20080916
10499   3.578305 20080917
10500   4.763519 20080918
10501   3.362684 20080919
10507   4.354753 20080929
10512   3.611450 20081006
10515   3.786056 20081009
10516   4.791725 20081010
10517   3.406449 20081013
10910   7.382690 20100506
10911   3.423236 20100507
10912   3.022318 20100510
11225   4.906076 20110804
11226   4.635050 20110805
11227   6.636959 20110808
11228   5.464225 20110809
11229   4.077466 20110810
11230   3.956520 20110811
11235   3.315989 20110818
11852   3.357452 20140203
12029   4.794625 20141015
12243   3.784646 20150821
12244   6.559546 20150824
12245   4.181079 20150825
12246   3.869772 20150826
12344   3.089881 20160115
12346   3.519323 20160120
12455   3.676909 20160624
$\endgroup$
1
$\begingroup$

You almost had everything.

Taking example from iris

n <- 10
iris[iris$Sepal.Length>5.5, c("Sepal.Length", "Species")][1:n,]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.