'Finding increases from 'baseline' in the graph, not sure how to do

enter image description here

I want to write an algorithm that spits out the points highlighted by arrows. I've tried using a second derivative but it returns a similar plot to the one above and not sure how to use it.

Hi, sorry about that, I don't want the peaks, I want the point where the graph starts to increase - ie I want the point where the gradient changes from ~0 to something larger, does that make sense

Example data is below.

df = structure(list(X1 = c("2729", "2730", "2731", "2732", "2733", 
"2734", "2735", "2736", "2737", "2738", "2739", "2740", "2741", 
"2742", "2743", "2744", "2745", "2746", "2747", "2748", "2749", 
"2750", "2751", "2752", "2753", "2754", "2755", "2756", "2757", 
"2758", "2759", "2760", "2761", "2762", "2763", "2764", "2765", 
"2766", "2767", "2768", "2769", "2770", "2771", "2772", "2773", 
"2774", "2775", "2776", "2777", "2778", "2779", "2780", "2781", 
"2782", "2783", "2784", "2785", "2786", "2787", "2788", "2789", 
"2790", "2791", "2792", "2793", "2794", "2795", "2796", "2797", 
"2798", "2799", "2800", "2801", "2802", "2803", "2804", "2805", 
"2806", "2807", "2808", "2809", "2810", "2811", "2812", "2813", 
"2814", "2815", "2816", "2817", "2818", "2819", "2820", "2821", 
"2822", "2823", "2824", "2825", "2826", "2827", "2828", "2829", 
"2830", "2831", "2832", "2833", "2834", "2835", "2836", "2837", 
"2838", "2839", "2840", "2841", "2842", "2843", "2844", "2845", 
"2846", "2847", "2848", "2849", "2850", "2851", "2852", "2853", 
"2854", "2855", "2856", "2857", "2858", "2859", "2860", "2861", 
"2862", "2863", "2864", "2865", "2866", "2867", "2868", "2869", 
"2870", "2871", "2872", "2873", "2874", "2875", "2876", "2877", 
"2878", "2879", "2880", "2881", "2882", "2883", "2884", "2885", 
"2886", "2887", "2888", "2889", "2890", "2891", "2892", "2893", 
"2894", "2895", "2896", "2897", "2898", "2899", "2900", "2901", 
"2902", "2903", "2904", "2905", "2906", "2907", "2908", "2909", 
"2910", "2911", "2912", "2913", "2914", "2915", "2916", "2917", 
"2918", "2919", "2920", "2921", "2922", "2923", "2924", "2925", 
"2926", "2927", "2928", "2929", "2930", "2931", "2932", "2933", 
"2934", "2935", "2936", "2937", "2938", "2939", "2940", "2941", 
"2942", "2943", "2944", "2945", "2946", "2947", "2948", "2949", 
"2950", "2951", "2952", "2953", "2954", "2955", "2956", "2957", 
"2958", "2959", "2960", "2961", "2962", "2963", "2964", "2965", 
"2966", "2967", "2968", "2969", "2970", "2971", "2972", "2973", 
"2974", "2975", "2976", "2977", "2978", "2979", "2980", "2981", 
"2982", "2983", "2984", "2985", "2986", "2987", "2988", "2989", 
"2990", "2991", "2992", "2993", "2994", "2995", "2996", "2997", 
"2998", "2999", "3000", "3001", "3002", "3003", "3004", "3005", 
"3006", "3007", "3008", "3009", "3010", "3011", "3012", "3013", 
"3014", "3015", "3016", "3017", "3018", "3019", "3020", "3021", 
"3022", "3023", "3024", "3025", "3026", "3027", "3028", "3029", 
"3030", "3031", "3032", "3033", "3034", "3035", "3036", "3037", 
"3038", "3039", "3040", "3041", "3042", "3043", "3044", "3045", 
"3046", "3047", "3048", "3049", "3050", "3051", "3052", "3053", 
"3054", "3055", "3056", "3057", "3058", "3059", "3060", "3061", 
"3062", "3063", "3064", "3065", "3066", "3067", "3068", "3069", 
"3070", "3071", "3072", "3073", "3074", "3075", "3076", "3077", 
"3078", "3079", "3080", "3081", "3082", "3083", "3084", "3085", 
"3086", "3087", "3088", "3089", "3090", "3091", "3092", "3093", 
"3094", "3095", "3096", "3097", "3098", "3099", "3100", "3101", 
"3102", "3103", "3104", "3105", "3106", "3107", "3108", "3109", 
"3110", "3111", "3112", "3113", "3114", "3115", "3116", "3117", 
"3118", "3119", "3120", "3121", "3122", "3123", "3124", "3125", 
"3126", "3127", "3128", "3129", "3130", "3131", "3132", "3133", 
"3134", "3135", "3136", "3137", "3138", "3139", "3140", "3141", 
"3142", "3143", "3144", "3145", "3146", "3147", "3148", "3149", 
"3150", "3151", "3152", "3153", "3154", "3155", "3156", "3157", 
"3158", "3159", "3160", "3161", "3162", "3163", "3164", "3165", 
"3166", "3167", "3168", "3169", "3170", "3171", "3172", "3173", 
"3174", "3175", "3176", "3177", "3178", "3179", "3180", "3181", 
"3182", "3183", "3184", "3185", "3186", "3187", "3188", "3189", 
"3190", "3191", "3192", "3193", "3194", "3195", "3196", "3197", 
"3198", "3199", "3200", "3201", "3202", "3203", "3204", "3205", 
"3206", "3207", "3208", "3209", "3210", "3211", "3212", "3213", 
"3214", "3215", "3216", "3217", "3218", "3219", "3220", "3221", 
"3222", "3223", "3224", "3225", "3226", "3227", "3228", "3229", 
"3230", "3231", "3232", "3233", "3234", "3235", "3236", "3237", 
"3238", "3239", "3240", "3241", "3242", "3243", "3244", "3245", 
"3246", "3247", "3248", "3249", "3250", "3251", "3252", "3253", 
"3254", "3255", "3256", "3257", "3258", "3259", "3260", "3261", 
"3262", "3263", "3264", "3265", "3266", "3267", "3268", "3269", 
"3270", "3271", "3272", "3273", "3274", "3275", "3276", "3277", 
"3278", "3279", "3280", "3281", "3282", "3283", "3284", "3285", 
"3286", "3287", "3288", "3289", "3290", "3291", "3292", "3293", 
"3294", "3295", "3296", "3297", "3298", "3299", "3300", "3301", 
"3302", "3303", "3304", "3305", "3306", "3307", "3308", "3309", 
"3310", "3311", "3312", "3313", "3314", "3315", "3316", "3317", 
"3318", "3319", "3320", "3321", "3322", "3323", "3324", "3325", 
"3326", "3327", "3328", "3329", "3330", "3331", "3332", "3333", 
"3334", "3335", "3336", "3337", "3338", "3339", "3340", "3341", 
"3342", "3343", "3344", "3345", "3346", "3347", "3348", "3349", 
"3350", "3351", "3352", "3353", "3354", "3355", "3356", "3357", 
"3358", "3359", "3360", "3361", "3362", "3363", "3364", "3365", 
"3366", "3367", "3368", "3369", "3370", "3371", "3372", "3373", 
"3374", "3375", "3376", "3377", "3378", "3379", "3380", "3381", 
"3382", "3383", "3384", "3385", "3386", "3387", "3388", "3389", 
"3390", "3391", "3392", "3393", "3394", "3395", "3396", "3397", 
"3398", "3399", "3400", "3401", "3402", "3403", "3404", "3405", 
"3406", "3407", "3408", "3409", "3410", "3411", "3412", "3413", 
"3414", "3415", "3416", "3417", "3418", "3419", "3420", "3421", 
"3422", "3423", "3424", "3425", "3426", "3427", "3428", "3429", 
"3430", "3431", "3432", "3433", "3434", "3435", "3436", "3437", 
"3438", "3439", "3440", "3441", "3442", "3443", "3444", "3445"
), X2 = c(-0.00385000000001254, -0.0154500000000484, -0.0277600000000007, 
-0.0154500000000279, -0.0386000000000704, -0.0154500000000329, 
-0.0115500000000053, 2.5238009638656e-15, -0.00385000000000757, 
3.60475000000867, -0.470850000000881, -0.347350000000663, -0.173700000000328, 
-0.139699999999998, -0.096500000000187, -0.0617500000001111, 
-0.0579000000001016, -0.0424500000000768, -0.050150000000105, 
-0.0579000000001191, -0.0540000000000976, -0.0579000000001924, 
-0.0270000000000563, -0.0309000000000539, -0.0231500000000468, 
-0.0270500000000538, -0.00775000000002209, -0.0193000000000404, 
-0.0131199999999931, 0.219999999999842, 0.0579000000001427, -0.061750000000126, 
-0.0617500000002055, -0.0309000000000726, -0.050150000000105, 
-0.042450000000091, -0.0193000000000293, -0.0309000000000144, 
-0.0115500000000196, -0.0116000000000154, -0.0154500000000366, 
-0.00385000000000946, -0.0193000000000305, -0.00390000000000946, 
-0.00390000000000639, -0.00771000000000015, -0.000789999999999225, 
-4.97400384373025e-15, -0.00619000000000085, -0.0116000000000265, 
-0.011550000000014, -0.00385000000000504, -0.00538999999999987, 
-0.0116000000000203, -0.011550000000014, 0.00385000000001136, 
-0.00230999999999795, 2.86419210237446e-15, -0.00230999999999954, 
-0.00770000000002508, -0.00770000000001703, -0.00390000000000449, 
-0.0085000000000008, -0.0193000000000529, -8.05101707233625e-15, 
-0.00385000000001751, -0.0146699999999988, -0.00619000000000085, 
-0.0116000000000265, 0.00153999999999996, 0.00385000000000546, 
-0.00231000000000233, -0.000780000000000314, -0.00230999999999884, 
0.0015400000000021, -8.05101707233625e-15, -0.00848000000000013, 
-0.00385000000001751, -0.00775000000003729, -0.00769999999999792, 
-1.1787959787484e-15, -0.00384999999999692, 0.00385000000001136, 
-0.00384999999999762, 0.00385000000000639, -0.00385000000001161, 
-0.000440000000001542, -0.00390000000000639, -0.000769999999999981,   
0, -0.0154500000000091, -0.0077500000000059, -0.0154500000000335, 
-0.0115500000000165, -0.00385000000000567, -0.00311000000000092, 
0.0116000000000272, -0.00230999999999994, 0.0116000000000172, 
0.00770000000001277, -0.00385000000000377, -0.00385000000001254, 
0.00385000000001136, -0.00385000000000411, -0.0038499999999997, 
-0.0116000000000215, -0.0154300000000006, -6.15348059644161e-15, 
-0.00849999999999866, -0.0015500000000003, 0.00154000000000174, 
-3.07674029821757e-15, -0.0115500000000345, -0.0115500000000165, 
-6.15348059644161e-15, -0.00385000000002247, 0.0077000000000059, 
-0.00385000000001254, -0.0115500000000315, -0.0154500000000107, 
-0.0154500000000229, -0.0309000000000733, -1.65190000000256, 
-0.258600000000477, -0.111900000000204, -0.0640499999999989, 
-0.0579000000001016, -0.0270000000000494, -0.02393, -0.0193000000000324, 
-0.0115500000000165, -0.0270000000000624, -0.0193000000000598, 
-0.0309000000000733, -0.0463000000001036, -2.19220000000482, 
-0.524900000000959, -0.189100000000636, -0.11580000000022, -0.0717700000000001, 
-0.0424500000001407, -0.057900000000101, -0.0386000000000673, 
-0.0193000000000449, -0.0277899999999995, -0.0077500000000276, 
-0.0208600000000011, -0.0193000000000293, -0.0463000000000912, 
-0.0386000000000716, -0.0501500000001031, -0.0347500000000728, 
-0.0502000000000926, -0.0424500000000836, -0.00307999999999993, 
-0.0116000000000234, 0.00389999999999833, -0.000769999999999981, 
-0.00153999999999996, -0.00153999999999996, 0.00153999999999783, 
-0.0162100000000009, -0.0386000000000797, -0.0432300000000026, 
-0.038600000000117, -0.050200000000097, -0.0309000000000527, 
-0.0231500000000593, 0.00461999999999989, -0.00385000000001064, 
-0.00385000000000757, -0.0116000000000215, 0.00770000000004104, 
0.00385000000000639, -0.941700000001459, -0.169850000000308, 
-0.100350000000196, -0.0933799999999984, -0.0617500000001154, 
-0.0579000000001165, -0.0386000000000822, -0.019300000000043, 
-0.0231500000000629, -0.0115500000000165, -0.0270000000000464, 
-0.0116000000000284, -0.00769999999999982, -2.76340000000441, 
-0.270200000000513, -0.119650000000229, -0.108100000000387, -0.0540000000001033, 
-0.0772000000001527, -0.0579000000001345, -0.0656000000001255, 
-0.0540500000001704, -0.0386000000000716, -0.0270500000000663, 
-0.0116000000000284, -0.0216200000000043, -0.00770000000001206, 
-0.0308500000000552, -0.0115500000000265, -2.4190463576414e-14, 
-0.00770000000003006, -0.0115900000000011, -0.0231500000000985, 
-0.0193000000000293, -0.033979999999999, -0.00775000000002643, 
-0.0478400000000022, -0.0231500000000412, -0.019300000000043, 
-0.00233000000000134, -0.00390000000002501, 0.00154999999999958, 
0.00384999999999991, 0.0077000000000059, -0.00770000000003193, 
-0.0200899999999983, -0.0193000000000423, -0.0347000000000634, 
-0.0540000000000927, -0.0733500000001364, -0.0501500000001637, 
-0.0424500000000886, -0.050200000000087, -0.0308500000000459, 
0.00384999999999834, -0.00231000000000208, -0.00387000000000167, 
0.0030799999999978, -0.00385000000000757, -0.00385000000001064, 
-0.0192500000000504, -0.0115500000000296, -0.0231500000001104, 
-0.0579000000001085, -0.0733500000001314, -0.0386000000000697, 
-0.0386000000000754, -0.0347500000000935, -0.00775000000001395, 
0.00385000000000881, 0.000769999999999982, 0.0115500000000203, 
0.00390000000001095, 0.00154000000000294, -0.00385000000001497, 
-0.00385000000000567, -0.0309000000001234, -0.0347500000000728, 
-0.0193000000000814, -0.0424500000000992, -0.0347500000000678, 
0.274000000000822, 0.463150000000818, 1.03820000000353, 0.636800000000563, 
-0.13663, -0.87225000000281, 0.644550000001354, -0.0579000000003174, 
-0.72560000000209, -0.115800000000169, 2.08025000000553, -0.208400000000342, 
-0.227700000000415, -0.328050000000636, -0.169850000000303, -0.104200000000212, 
-0.0656500000001349, -0.0656500000001373, -0.0424500000000712, 
-0.0347500000000697, -0.0285600000000002, -0.0193000000000324, 
-0.0270000000000538, -0.0193000000000498, -0.0270000000000513, 
-0.00849999999999724, -0.00770000000001513, -0.0162100000000009, 
-0.0339800000000025, -0.0502000000001566, -0.0501500000000907, 
-0.0193000000000454, -0.00770000000001893, 0.00385000000001136, 
0.00390000000001402, 0.00153999999999996, -0.00307999999999993, 
0.00390000000000023, 0.00384999999999834, 0.00384999999999644, 
0.00385000000002943, -0.0138899999999971, -0.0223899999999993, 
-0.0270500000000588, -0.00618999999999943, -0.0270500000000669, 
0.00153999999999892, -0.000779999999999603, -2.5238009638656e-15, 
0.00465000000000089, -0.00770000000001703, -2.91289464345889e-16, 
0.00461999999999805, -0.0115900000000011, -0.00390000000001506, 
-0.019300000000043, -0.0115899999999989, -0.0115900000000011, 
-0.00770000000003258, 0, 0.00390000000000331, 0.0193000000000281, 
0.00385000000002044, 0.00770000000002145, 0.00770000000000148, 
0.0077000000000078, 0, 0.00308000000000135, -6.15348059644161e-15, 
-0.015450000000036, -0.0309000000000726, -0.00385000000001254, 
-0.0154000000000341, -1.11274169835756e-14, -0.00923999999999978, 
-0.00234000000000107, -0.00770999999999944, 0.00385000000003251, 
0.00461999999999429, 0.00385999999999811, -0.00770000000000798, 
-0.023150000000093, -0.0154500000000348, -0.0424500000000737, 
-0.019300000000043, -0.0308500000000125, -0.0309000000001054, 
-0.0231500000000394, -1.1787959787484e-15, 0.000790000000000646, 
-0.00231000000000036, 0, -0.00307999999999851, -0.00390000000002326, 
-0.00230999999999753, -0.0193100000000022, -0.042450000000016, 
-0.0385500000000679, -0.057900000000106, -0.0347000000000627, 
-0.0386000000000922, -0.00385000000000445, 0.0077500000000097, 
0.00230999999999995, -0.00385000000000352, 0.00307999999999948, 
-0.000769999999999381, -1.1787959787484e-15, -0.015440000000001, 
-0.0193000000000099, -0.0425000000000806, -0.0386000000000829, 
-0.0424500000001675, -0.0386000000000773, -0.0463000000000192, 
-0.00385000000001562, 0, 0.00769999999999875, -3.07674029821757e-15, 
-0.00307999999999922, -0.0030799999999978, -0.0154000000000493, 
-0.00385000000001254, -0.0231500000000079, -0.0347500000000802, 
-0.0231500000000319, -0.0355200000000003, -0.0386000000000829, 
-0.0463500000000801, -0.0347500000000678, 0.00155999999999792, 
0.00385000000000639, -0.00385000000000231, 0, -0.00385000000000946, 
-0.00153999999999966, 0, -0.0285600000000002, -0.0309000000000546, 
-0.069450000000125, -0.0502000000000889, -0.0502000000000896, 
0.3898000000001, 0.0540500000001028, 0.0115500000000253, 0.0116000000000142, 
0.000769999999999981, -0.00385000000000504, -7.40090066366128e-15, 
-0.00230999999999995, 0.00385000000000141, 0.00385000000000639, 
-0.00385000000001254, -0.0270199999999981, -0.0502000000000896, 
0.409100000000679, 0.0386000000000674, -0.0116000000000445, -0.00775000000004081, 
-0.00307999999999993, -0.00385000000000757, -0.00770000000000208, 
-0.00385000000001562, -0.00385000000001064, -0.00153999999999783, 
-8.05101707233625e-15, -0.0177499999999995, -0.0424500000001796, 
-0.0509500000000003, -0.0694500000001324, -0.0424500000001587, 
-0.061750000000121, -0.0232000000000369, -0.0131299999999989, 
-0.00153999999999886, 0.0077000000000059, -0.00310999999999879, 
0.00769999999999982, 7.49841812496252e-15, -8.05101707233625e-15, 
-0.0077000000000406, -0.0424500000000787, -0.0502000000001032, 
-0.0347500000000747, -0.0656000000001262, -0.0733000000001494, 
-0.034700000000074, -0.0193000000000869, 0.0231500000000662, 
-0.00385000000000757, 0.00770000000001088, 0.0115600000000001, 
-0.957150000001501, -0.14670000000027, -0.0772000000001383, -0.0617500000002002, 
-0.0463000000000981, -0.0617500000001229, -0.0270000000000544, 
-0.0347500000000597, -0.0386000000001412, -0.0694500000001331, 
-0.0887500000001619, -0.0386000000000747, -0.0077500000000295, 
0.015400000000064, 0.355050000000611, 0.0478699999999975, -6.15348059644161e-15, 
-0.0177800000000019, -0.00385000000001064, -0.0116000000000674, 
-0.0154500000000435, -0.0524900000000017, -0.0540500000002006, 
-0.0540500000001021, -0.0617500000002394, -0.0308500000000688, 
-0.0193000000000355, -0.0154000000000216, -0.000770000000000204, 
0.00770000000001775, 0.00694000000000017, -0.00385000000001254, 
0.0116000000000123, -0.00385000000002063, -0.00385000000000757, 
-0.0270000000000743, -0.0309000000000763, -0.0926500000001775, 
-0.0887500000003161, -0.0656500000001199, -0.042450000000078, 
-0.0270000000000588, -0.0116000000000364, -0.000769999999999982, 
-0.00385000000001254, -0.015400000000026, 0.00385000000002041, 
0.0115500000000253, 0, -0.00385000000001161, -0.0386000000000723, 
-0.0154500000000693, -0.100350000000196, -0.0849000000001704, 
-0.0926500000001751, -0.0115500000000116, 0.00385000000000546, 
-0.0116000000000154, 6.87160777622118e-15, -0.00384999999999991, 
0.00231999999999886, -3.07674029821757e-15, 0.00390000000003514, 
0.000779999999996745, -3.07674029821757e-15, -0.0231500000000617, 
-0.0270500000000527, -0.0517200000000003, -0.050150000000105, 
-0.0347500000000721, -0.0347500000000142, -0.00385000000001161, 
0.00770000000000401, -0.00385000000000197, 0.000769999999999982, 
-0.00385000000001372, 0.00385000000000141, 0.0116000000000278, 
-3.71670324204166e-15, -0.0116000000000584, -0.00385000000001064, 
-0.00464999999999875, -0.00775000000004982, -0.00390000000001506, 
0.277900000000906, 0.119650000000208, 0.054000000000013, 0.0463000000000931, 
0.0154500000000168, 0.00775000000000384, 0.0115500000000154, 
0.00769999999999875, 1.89760393249092e-15, 0.00231999999999957, 
0.000769999999999304, -0.0231500000000085, -0.0270500000000402, 
0.351200000000562, -0.0231500000000833, -0.0270500000000588, 
-0.0463500000000216, -0.0139000000000062, -9.23022089465272e-15, 
-8.05101707233625e-15, 0.00385000000000546, 0.000759999999998229, 
-0.0115500000000395, 0.000769999999999982, -0.011600000000024, 
-0.00770000000001206, -0.0540500000001929, -0.0772000000001558, 
-0.0656000000000217, -0.0772000000001484, -0.0579000000001128, 
-0.0347000000000764, -0.0193000000000461, -0.00385000000000352, 
-0.00385000000002122, -0.00696000000000083, 0.000789999999999225, 
0.00384999999999834, -0.000800000000000978, -0.0116000000000234, 
-0.00775000000001088, -0.0115900000000055, -0.0193000000000218, 
-0.0347500000000808, -0.0386000000000897, -0.0501500000000858, 
-0.00233999999999881, -0.00385000000000757, 2.00000000009208e-05, 
0.308750000000515, 0.092650000000154, 0.0424500000000756, 0.0231500000000227, 
0.0154500000000312, -0.00385000000001469, 0.00538999999999237, 
0.474750000000936, 0.212300000000357, -0.0030699999999996, -0.0309000000000739, 
-0.0115500000000265, -0.0116000000000265, -3.57390000000716, 
-0.293350000001048, -0.119650000000226, -0.104200000000194, -0.0926500000001831, 
-0.0540500000001096, -0.0694500000002714, -0.0772000000001527, 
-0.0965000000001976, -0.0694500000001375, -0.100350000000182, 
-0.084950000000289, -0.061750000000121, -0.0425000000000912, 
-0.0424500000000662, -0.00770000000002011, -0.0154500000000422, 
-0.00307999999999993, -0.00230999999999994, 0.00385000000001447, 
-0.00154, -0.00385000000000567, -0.0386000000000747, -0.0695000000002463, 
-0.0772000000001664, -0.0849000000002961, -0.0887500000001668, 
-0.0193000000000504, -0.0578500000001047, -0.00775000000000708, 
-1.2095231788207e-14, 0.00848999999999485, -3.07674029821757e-15, 
-0.00541000000000057, -0.00390000000002247, 0.000769999999999981, 
-0.0293300000000002, -0.050200000000087, -0.0656000000002546, 
-0.0540500000001096, -0.069450000000138, 0.123500000000375, 0.0849000000001387, 
0.00384999999999644, 0.023200000000042, 0.0115500000000123, 0.00775000000000473, 
0.0115500000000203, 0.00385000000001447, -0.00775000000002506, 
0.00466000000000122, -0.0254699999999978, -0.054799999999998, 
-0.0231500000000444, 0.0116000000000454, 0.115800000000206, 0.030900000000046, 
0.00385000000000331, -0.00153999999999996, 0.00384999999999084, 
-0.00385000000000757, 0.00770000000001088, 1.7849988639723e-14, 
0.00230999999999994, 0.00385000000001326, -0.00153999999999882, 
-0.038600000000126, -0.0309000000000553, -0.00692999999999628, 
-0.0154000000000403, -0.0579000000001097, -0.0347500000000678, 
-0.0100400000000054, 0.00385000000000023, -0.00385000000001994, 
-2.17923926727129e-14, 0.00389999999999028, 0.00390000000001402, 
0.00384999999999084, -0.00385000000001751, 0.00770000000001399, 
-0.0308500000000632, -0.0502000000001986, -0.0695000000001394, 
-0.0501799999999982, -0.0309000000000752, -0.0270500000000557, 
-0.0100500000000011, 0.00389999999999596, 0.0116000000000117, 
1.89760393249092e-15, 0.0115500000000123, 0.00384999999998841, 
-0.00385000000002965, 0.0077000000000078, 0.00385000000000639, 
0.00770000000000283, -0.0501500000001132, -0.0617500000002242, 
-0.0710100000000004, -0.0810500000000306, -0.0540500000001891, 
-0.0386000000000617, -0.019300000000043, 0.00775000000000473, 
0.00847000000000282, 0.00462999999999951, -2.11128370304365e-14, 
0.00770000000001088, 0.00384999999999858, 9.99999999962123e-06, 
-0.00770000000001206, -0.0733000000000254, -0.0656000000001967, 
-0.111900000000213, -0.100350000000323, -0.0579000000001141, 
-0.0385500000000131, -0.0116000000000215, 0.0193000000000318, 
0.00390000000001402, 0.0270000000000452, 0.00770000000000182, 
-8.05101707233625e-15)), row.names = c(NA, -717L), class = "data.frame")


Solution 1:[1]

As others have said, it is not clear what you are looking for. specifically, it's not clear how high above "baseline" is too high.

Here's a shot at it:

df_prime <- df$X2[-1] - df$X2[-length(df$X2)]
large_rise <- which(df_prime > sd(df_prime) & df$X2[-length(df$X2)] > -sd(df$X2))
df$X1[large_rise]

enter image description here

Solution 2:[2]

It's difficult to know from the question, but aren't you just looking for something like this?

spikes <- as.numeric(df$X1[df$X2 > 0.1])
spikes <- spikes[which(diff(c(0, spikes)) > 3)]
spikes
#> [1] 2738 2758 2984 2994 3126 3139 3190 3260 3273 3309 3316 3363 3377

So, for example if you did

plot(df$X1, df$X2, type = "l")
points(spikes, rep(1, length(spikes)), col="red")

You would get enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nigelhenry
Solution 2