Hi Engin,
If you know what all the levels are, you can specify these in the
format command:

Classification_Description<-factor(Classification_Description,
 levels=c("Total Surplus (+) or Deficit (-)","Borrowing from the Public",
  "By other means"))

This ensures that all the levels are encoded even if one or more
levels is missing in the incoming data.

Jim

On Thu, Jul 30, 2020 at 8:33 PM Engin Yılmaz <ispanyol...@gmail.com> wrote:
>
> * Record Date*
>
> *Classification Description*
>
> *Current Month Budget Amount*
>
>
>
> 2020-06-30
>
> Total Surplus (+) or Deficit (-)
>
>  -864,074,068,492
>
>
>
> 2020-06-30
>
> Borrowing from the Public
>
>   716,272,172,707
>
>
>
> 2020-06-30
>
> By Other Means
>
>   420,704,500,379
>
>
>
> 2020-05-31
>
> Borrowing from the Public
>
>   759,987,728,236
>
>
>
> 2020-05-31
>
> By Other Means
>
>   -92,071,767,771
>
>
>
> 2020-05-31
>
> Total Surplus (+) or Deficit (-)
>
>  -398,821,413,660
>
> Dear
>
> I have a 2 questions
>
> I have 3 different factors for every month in my dataframe.The column
> of classification description has 3 factors.
>
> Question 1:
> I need to add a new factor to the column of classification description but
> this *will be a summation* of other 3 factors in every month. How can I
> realize this?
>
> Question 2:
> How can I transpose my dataframe as the following ?
>
>
>
> Total Surplus (+) or Deficit (-)
>
> Borrowing from the Public
>
> By Other Means
>
> 2020-06-30
>
> -864,074,068,492
>
>
>
>
>
> 716,272,172,707
>
>
>
> 420,704,500,379
>
> 2020-05-31
>
>   759,987,728,236
>
>
>
>
>
> -92,071,767,771
>
>
>
> -398,821,413,660
>
> Sincerely
> Engin YILMAZ
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to