Dear all, I have a large data set which contains NA in multiple column, how can I use TS to impute these NA value.
First, I am finding a way to change the data table into TS.
Many thanks.
Dear all, I have a large data set which contains NA in multiple column, how can I use TS to impute these NA value.
First, I am finding a way to change the data table into TS.
Many thanks.
We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.
If you've never heard of a reprex before, you might want to start by reading this FAQ:
Thx for your advice as I don't know how to upload my csv file. I run a code to show the list of my datatable and uploaded for reference.
Many thanks.
Please read the link I gave you, there is no need to upload a csv file and posting screenshots of your data is not a good thing to do here.
More details, column PM_Dongsi, PM_Dongsihuan and PM_Nongzhanguan are randomly missing value, and these missing value are distributed as follows:
Sorry guys my mistake as I am new to R also forum, I should notice it first. Below is my coding after using reprex:
trialdata <-tibble::tribble(
~No, ~year, ~month, ~day, ~hour, ~season, ~PM_Dongsi, ~PM_Dongsihuan, ~PM_Nongzhanguan, ~PM_US_Post, ~HUMI, ~PRES, ~TEMP,
1, 2013, 1, 1, 0, 4, NA, NA, NA, 31, 67, 1018, -5,
2, 2013, 1, 1, 1, 4, NA, NA, NA, 32, 73, 1017, -7,
3, 2013, 1, 1, 2, 4, NA, NA, NA, 21, 73, 1017, -7,
4, 2013, 1, 1, 3, 4, NA, NA, NA, 16, 72, 1018, -10,
5, 2013, 1, 1, 4, 4, NA, NA, NA, 15, 66, 1018, -10,
6, 2013, 1, 1, 5, 4, NA, NA, NA, 9, 78, 1019, -12,
7, 2013, 1, 1, 6, 4, NA, NA, NA, 9, 72, 1020, -11,
8, 2013, 1, 1, 7, 4, NA, NA, NA, 7, 45, 1020, -6,
9, 2013, 1, 1, 8, 4, NA, NA, NA, 14, 38, 1021, -6,
10, 2013, 1, 1, 9, 4, NA, NA, NA, 11, 32, 1022, -5,
11, 2013, 1, 1, 10, 4, NA, NA, NA, 9, 21, 1023, -3,
12, 2013, 1, 1, 11, 4, NA, NA, NA, 10, 21, 1024, -3,
13, 2013, 1, 1, 12, 4, NA, NA, NA, 16, 19, 1023, -3,
14, 2013, 1, 1, 13, 4, NA, NA, NA, 17, 21, 1023, -4,
15, 2013, 1, 1, 14, 4, NA, NA, NA, 15, 21, 1024, -4,
16, 2013, 1, 1, 15, 4, NA, NA, NA, 13, 19, 1025, -5,
17, 2013, 1, 1, 16, 4, NA, NA, NA, 16, 20, 1026, -6,
18, 2013, 1, 1, 17, 4, NA, NA, NA, 15, 22, 1027, -7,
19, 2013, 1, 1, 18, 4, NA, NA, NA, 20, 20, 1028, -8,
20, 2013, 1, 1, 19, 4, NA, NA, NA, 17, 23, 1029, -9,
21, 2013, 1, 1, 20, 4, NA, NA, NA, 16, 25, 1030, -10,
22, 2013, 1, 1, 21, 4, NA, NA, NA, 19, 23, 1031, -10,
23, 2013, 1, 1, 22, 4, NA, NA, NA, 13, 25, 1032, -11,
24, 2013, 1, 1, 23, 4, NA, NA, NA, 19, 23, 1033, -11,
25, 2013, 1, 2, 0, 4, NA, NA, NA, 15, 25, 1033, -12,
26, 2013, 1, 2, 1, 4, NA, NA, NA, 19, 25, 1033, -12,
27, 2013, 1, 2, 2, 4, NA, NA, NA, 16, 25, 1034, -12,
28, 2013, 1, 2, 3, 4, NA, NA, NA, 17, 25, 1035, -12,
29, 2013, 1, 2, 4, 4, NA, NA, NA, 17, 25, 1035, -12,
30, 2013, 1, 2, 5, 4, NA, NA, NA, 17, 27, 1036, -13,
31, 2013, 1, 2, 6, 4, NA, NA, NA, 15, 27, 1036, -13,
32, 2013, 1, 2, 7, 4, NA, NA, NA, 13, 27, 1036, -13,
33, 2013, 1, 2, 8, 4, NA, NA, NA, 15, 27, 1037, -12,
34, 2013, 1, 2, 9, 4, NA, NA, NA, 15, 25, 1039, -11
)
Many thanks
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.