Share a script in R language [time record]

Source: Internet
Author: User
I shared a script in the r language and recently learned the script in the r language. I wonder if you have read the book "Fantastic Life". After reading it in high school, in the third year of high school, he copied the method of the great god of Liu bixifu and recorded the time overhead. I personally think it is quite useful.

The script imports the following Excel file and automatically converts it into a pie chart to output the image to the local device.

 

 







The code is here:

Record <-read. Table ("book1.csv", header = true, SEP = ",", fill = true );
Library (ggplot2 );


New_sum <-na. Omit (record $ sum );
Rm (new_detail );
Rm (detail );


New_detail <-na. Omit (record $ );
Start <-paste (record $ start ,"-");
End <-record $ end;
Period <-paste (START, end );


Hours <-record $ X;
Detail_sum <-paste ('[', hours );
Detail_sum <-paste (detail_sum, ']');
Detail_sum <-paste (period, detail_sum );
Detail <-paste (new_detail, detail_sum );


Today <-SYS. Date ();
Today <-today-1;
Today <-paste (today, weekdays (today ));


Qplot (detail, new_sum, Geom = "bar", xlab = "things", ylab = "time", stat = "Identity ");


Filename <-paste (today, ". BMP ");
Path <-"d :\\ My Documents \ tools \ Desktop \\";
Path <-paste (path, filename );
BMP (path, width = 1600, Height = 900 );
Pie (new_sum, detail, main = today, Col. main = "red", cex. main = 2.6, radius = 1, cex = 1.5, edges = 100, clockwise = true, font = 1 );


Dev. Off ();




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.