[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573760-105":53,"doc-detail-573760-en":125},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":118,"head_meta":120,"extra_data":122,"updated_unix":124},105,"en","data-import-cheat-sheet","Data Import - cheat sheet","","Concise cheat sheet focused on importing and saving tabular data in R using tidyverse tools. Covers reading text files with readr, creating tibbles with tibble, and shaping tidy data with tidyr. Provides guidance for multiple file formats (CSV, TSV, fixed-width, arbitrary delimiters), handling headers, skipping rows, and managing missing values. Includes read_* function arguments, parsing strategies, column type guessing, and example write_* workflows for exporting R objects.",{"@graph":63,"@context":117},[64,80,100],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/data-import-cheat-sheet/573760/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":94,"encodingFormat":93,"isAccessibleForFree":95,"interactionStatistic":96},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/data-import-cheat-sheet/573760.png","ImageObject",442,249,{"name":88,"@type":89},"GGG","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-14",true,{"@type":97,"interactionType":98,"userInteractionCount":73},"InteractionCounter",{"@type":99},"ViewAction",{"@type":101,"mainEntity":102},"FAQPage",[103,109,113],{"name":104,"@type":105,"acceptedAnswer":106},"Which tidyverse components does the cheat sheet use for data import and cleaning?","Question",{"text":107,"@type":108},"It uses readr for reading text files, tibble for creating tibbles, and tidyr for laying out tidy data.","Answer",{"name":110,"@type":105,"acceptedAnswer":111},"How are multiple delimited text formats handled when reading data?",{"text":112,"@type":108},"It shows read_csv/read_csv2 for comma or semicolon-separated files, read_delim for arbitrary delimiters, and read_tsv/read_table for tab-delimited data.",{"name":114,"@type":105,"acceptedAnswer":115},"How does readr determine column data types and how can parsing be customized?",{"text":116,"@type":108},"readr guesses types for each column and reports the parsed types. The cheat sheet also shows using col_types/col_* helpers or parsing as character first with parse_* functions.","https://schema.org",{"og:url":78,"og:type":119,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":121,"canonical":78},"index,follow",{"doc_id":123,"site_id":56},573760,1792014492,{"code":4,"msg":5,"data":126},{"doc_id":123,"user_id":127,"nickname":88,"user_avatar":128,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":129,"file_id":130,"file_url":131,"file_type":132,"file_size":133,"view_count":73,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":134,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":135,"faqs":136,"seo_title":137,"seo_description":61,"update_tm":138,"read_time":9},962093532725,"https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","Data Import : : CHEAT SHEET  \nR’s tidyverse is built around tidy data stored in tibbles, which are enhanced data frames.  \nThe front side of this sheet showshow to read text files into R with readr.  \nThe reverse side shows how to create tibbles with tibble and to layout tidy data with tidyr.  \nOTHER TYPES OF DATA  \nTry one of the following packages to import other types of files  \n• haven-SPSS, Stata, and SAS files  \n• readxl-excel files ( .xls and .xlsx)  \n• DBI-databases  \n• jsonlite-json  \n• xml2-XML  \n• httr-Web APIs  \n• rvest-HTML (Web Scraping)  \nSave Data  \nSave x, an R object, to path, a file path, as:  \nComma delimited file  \nwrite_csv(x, path, na = \"NA\", append = FALSE, col_names = !append)  \nFile with arbitrary delimiter  \nwrite_delim(x, path, delim = \" \", na = \"NA\", append = FALSE, col_names = !append)  \nCSV for excel  \nwrite_excel_csv(x, path, na = \"NA\", append = FALSE, col_names = !append)  \nString to file  \nwrite_file(x, path, append = FALSE)  \nString vector to file, one element per line  \nwrite_lines(x, path, na = \"NA\", append = FALSE)  \nObject to RDS file  \nwrite_rds(x, path, compress = c(\"none\", \"gz\",\"bz2\", \"xz\"), ...)  \nTab delimited files  \nwrite_tsv(x, path, na = \"NA\", append = FALSE, col_names = !append)  \nRead Tabular Data -These functions share the common arguments:  \nread_*(file, col_names = TRUE, col_types = NULL, locale = default_locale(), na = c(\"\", \"NA\"), quoted_na = TRUE, comment = \"\", trim_ws = TRUE, skip = 0, n_max = Inf, guess_max = min(1000, n_max), progress = interactive())  \n| A | B | C |\n| --- | --- | --- |\n| 1 | 2 | 3 |\n| 4 | 5 | NA |\n\nComma Delimited Files  \nread_csv(\"file.csv\") To make file.csv run:  \nwrite_file(x = \"a,b,c\\n1,2,3\\n4,5,NA\", path = \"file.csv\")  \nSemi-colon Delimited Files  \nread_csv2(\"file2.csv\")  \nwrite_file(x = \"a;b;c\\n1;2;3\\n4;5;NA\", path = \"file2.csv\")  \nFiles with Any Delimiter  \nread_delim(\"file.txt\", delim = \"|\")  \nwrite_file(x = \"a|b|c\\n1|2|3\\n4|5|NA\", path = \"file.txt\")  \nFixed Width Files  \nread_fwf(\"file.fwf\", col_positions = c(1, 3, 5)) write_file(x = \"a b c\\n1 2 3\\n4 5 NA\", path = \"file.fwf\")  \nTab Delimited Files  \nread_tsv(\"file.tsv\") Also read_table().  \nwrite_file(x = \"a\\tb\\tc\\n1\\t2\\t3\\n4\\t5\\tNA\", path = \"file.tsv\")  \nUSEFUL ARGUMENTS  \n| A | B | C |\n| --- | --- | --- |\n| 1 | 2 | 3 |\n| 4 | 5 | NA |\n\nx  \nA  \n1  \n4  \ny  \nB  \n2  \n5  \nz  \nC  \n3  \nNA  \nExample file  \nwrite_file(\"a,b,c\\n1,2,3\\n4,5,NA\",\"file.csv\") f \u003C - \"file.csv\"  \nNo header  \nread_csv(f, col_names = FALSE)  \nProvide header  \nread_csv(f, col_names = c(\"x\", \"y\", \"z\"))  \nSkip lines  \nread_csv(f, skip = 1)  \nRead in a subset  \nread_csv(f, n_max = 1)  \nMissing Values  \nread_csv(f, na = c(\"1\", \".\"))  \nRead Non-Tabular Data  \nRead a file into a single string  \nread_file(file, locale = default_locale())  \nRead each line into its own string  \nread_lines(file, skip = 0, n_max = -1L, na = character(), locale = default_locale(), progress = interactive())  \nRead a file into a raw vector  \nread_file_raw(file)  \nRead each line into a raw vector  \nread_lines_raw(file, skip = 0, n_max = -1L, progress = interactive())  \nRead Apache style log files  \nread_log(file, col_names = FALSE, col_types = NULL, skip = 0, n_max = -1, progress = interactive())  \nData types  \nreadr functions guess the types of each column and  \nconvert types when appropriate (but will NOT convert strings to factors automatically) .  \nA message shows the type of each column in the result.  \n\n| \\#\\#\u003Cbr>\\#\\#\u003Cbr>\\#\\#\u003Cbr>\\#\\#\u003Cbr>\\#\\#\u003Cbr>\\#\\# | Parsed with column specification:\u003Cbr>cols(\u003Cbr>age = col_integer() , sex = col_character(), earn = col_double()\u003Cbr>)\u003Cbr>age is an integer\u003Cbr>|\n| --- | --- |\n\nsex is a  \nearn is a double (numeric) character  \n1. Use problems() to diagnose problems  \nx \u003C-read_csv(\"file.csv\"); problems(x)  \n2. Use a col_ function to guide parsing  \n• col_guess() -the default  \n• col_character()  \n• col_double(), col_euro_double()  \n• col_datetime(format = \"\") Also col_date(format = \"\"), col_time(format = \"\")  \n• col_factor(leve","cbCaieB7fnWyo21P","https://ap.wps.com/l/cbCaieB7fnWyo21P","pdf",1832066,"English","# Data Import\n## Read text files with readr\n## Create tibbles with tibble\n## Layout tidy data with tidyr\n## Import other data types\n## Save data\n## Read tabular data: common arguments\n## CSV and delimited files\n## Fixed-width and logs\n## Useful parsing arguments\n## Data types and parsing functions","[{\"question\":\"Which tidyverse components does the cheat sheet use for data import and cleaning?\",\"answer\":\"It uses readr for reading text files, tibble for creating tibbles, and tidyr for laying out tidy data.\"},{\"question\":\"How are multiple delimited text formats handled when reading data?\",\"answer\":\"It shows read_csv/read_csv2 for comma or semicolon-separated files, read_delim for arbitrary delimiters, and read_tsv/read_table for tab-delimited data.\"},{\"question\":\"How does readr determine column data types and how can parsing be customized?\",\"answer\":\"readr guesses types for each column and reports the parsed types. The cheat sheet also shows using col_types/col_* helpers or parsing as character first with parse_* functions.\"}]","Data Import - cheat sheet | PDF",1791945051]