[R] the same function returning different values when called differently..
akshay kulkarni
akshay_e4 at hotmail.com
Wed Mar 14 12:42:38 CET 2018
dear members,
I have a function ygrpc which acts on the daily price increments of a stock. It returns the following values:
ygrpc(PFC.NS,"h")
[1] 2.149997 1.875000 0.750000 0.349991 2.100006 0.199997 4.000000 2.574996 0.500000 0.349999 1.500000 0.700001
[13] 0.500000 1.300003 0.449997 2.800003 2.724998 66.150002 0.550003 0.050003 1.224991 4.899994 1.375000 1.574997
[25] 1.649994 0.449997 0.975006 2.475006 0.125000 2.625000 3.649994 0.399994 1.300003 2.074997 1.025001 0.125000
[37] 3.849999 0.025002 0.824997 1.750000 1.699997 1.750000 1.699997 0.275002 2.300003 0.349998 0.750000 0.224998
[49] 0.125000 1.475006 1.599998 0.125000 0.500000 0.700005 1.099998 0.225006 1.274997 1.300003 3.000000 0.300003
[61] 0.724999 3.699997 2.424995 8.425003 1.099991 2.025009 0.850006 4.000000 1.724991 0.949997 1.825012 2.799988
[73] 0.425003 1.799995 5.700005 2.125000 0.125000 4.000000 2.350006 1.524994 1.299995 0.300003 0.949997 0.449997
[85] 1.899994 1.700005 1.150009 0.849998 2.449997 5.300003 0.19999
I also have a list of stocks called "snl" with snl[[159]] pointing to PFC.NS (above):
tail(snl[[159]])
PFC.NS.Open PFC.NS.High PFC.NS.Low PFC.NS.Close PFC.NS.Volume PFC.NS.Adjusted
2018-03-07 98.40 98.45 95.1 95.30 7854861 95.30
2018-03-08 94.90 94.95 89.3 91.90 12408061 91.90
2018-03-09 92.00 94.50 91.9 93.10 7680222 93.10
2018-03-12 93.40 93.85 86.1 88.25 12617833 88.25
2018-03-13 89.20 91.85 86.2 89.85 12792630 89.85
2018-03-14 88.65 89.30 86.1 86.70 16406495 86.70
But ygrpc(snl[[159]],"h") returns :
ygrpc(snl[[159]],"h")
[1] 1
Can you please shed some light on what is happening?
Very many thanks for your time and effort....
Yours sincerely
AKSHAY M KULKARNI
[[alternative HTML version deleted]]
More information about the R-help
mailing list