[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-571696-105":53,"doc-detail-571696-en":127},{"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":120,"head_meta":122,"extra_data":124,"updated_unix":126},105,"en","r-data-types-maths-functions-and-core-data-structures-cheat-sheet","R Data Types, Maths Functions, and Core Data Structures - Cheat Sheet","","Quick reference covering key R concepts: common data type conversions (logical, numeric, character, factor) and boolean/numeric representations, essential maths functions such as log/exp, max/min, rounding, significant figures, correlation, sums and summary statistics. Includes variable assignment, working with the environment, and core structures—matrices, lists, data frames, and string utilities (e.g., paste, grep, gsub, case conversion, character counts). Adds basic statistics model functions (lm, glm, t-test variants, ANOVA) and common distribution functions, plus core plotting and date pointers.",{"@graph":63,"@context":119},[64,80,102],{"@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/r-data-types-maths-functions-and-core-data-structures-cheat-sheet/571696/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/r-data-types-maths-functions-and-core-data-structures-cheat-sheet/571696.png","ImageObject",442,249,{"name":88,"@type":89},"Ivy","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":101},"InteractionCounter",{"@type":100},"ViewAction",7,{"@type":103,"mainEntity":104},"FAQPage",[105,111,115],{"name":106,"@type":107,"acceptedAnswer":108},"How do I convert between common R data types?","Question",{"text":109,"@type":110},"Use conversion functions like as.logical, as.numeric, as.character, and as.factor. R can convert higher values in the table to lower values depending on the target type.","Answer",{"name":112,"@type":107,"acceptedAnswer":113},"What are the core maths and statistics functions available in this reference?",{"text":114,"@type":110},"It lists functions such as log, exp, max, min, round, signif, cor, sum, mean, median, quantile, rank, var, and sd, plus model and testing functions like lm, glm, summary, t.test, pairwise.t.test, prop.test, and aov.",{"name":116,"@type":107,"acceptedAnswer":117},"Which R data structures are covered, and how are they commonly subset?",{"text":118,"@type":110},"Matrices, lists, and data frames are covered, including indexing patterns like selecting rows/columns or elements in matrices, using l[[2]] and l$x for lists, and using df[ , 2] / df[2, ] / df[2, 2] for data frames.","https://schema.org",{"og:url":78,"og:type":121,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":123,"canonical":78},"index,follow",{"doc_id":125,"site_id":56},571696,1792033205,{"code":4,"msg":5,"data":128},{"doc_id":125,"user_id":129,"nickname":88,"user_avatar":130,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":101,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":136,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":137,"faqs":138,"seo_title":139,"seo_description":61,"update_tm":140,"read_time":9},549758252649,"https://ap-avatar.wpscdn.com/avatar/8000253669c5317157?_k=1778319167496531819","Types  \nConverting between common data types in R. Can always go from a higher value in the table to a lower value.  \nas .logical  \nas .numeric  \nas .character  \nas .factor  \nTRUE, FALSE, TRUE  \n1, 0, 1  \n'1', '0', '1'  \n'1', '0', '1', levels: '1', '0'  \nBoolean values (TRUE or FALSE) .  \nIntegers or ﬂoating point numbers.  \nCharacter strings. Generally preferred to factors.  \nCharacter strings with preset levels. Needed for some statistical models.  \nMaths Functions  \nlog(x )  \nexp(x )  \nmax(x )  \nmin(x ) round(x , n ) signif(x , n ) cor(x , y )  \nNatural log.  \nExponential.  \nLargest element. Smallest element.  \nRound to n decimal places.  \nRound to n  \nsignificant figures.  \nCorrelation.  \nsum(x ) mean(x )  \nmedian(x ) quantile(x )  \nrank(x ) var(x ) sd(x )  \nSum.  \nMean.  \nMedian.  \nPercentage quantiles.  \nRank of elements.  \nThe variance.  \nThe standard deviation.  \nVariable Assignment  \n> a \u003C - 'apple '> a  \n[1] 'apple '  \nThe Environment  \nls() rm(x)  \nrm(list = ls())  \nList all variables in the environment.  \nRemove x from the environment.  \nRemove all variables from the environment.  \nYou can use the environment panel in RStudio to browse variables in your environment.  \nMatrices  \nm \u003C -matrix(x , n row = 3 , ncol = 3 )  \nCreate a matrix from x.  \nm [ 2 , ] -Select a row  \nm [ , 1 ] -Select a column m [ 2 , 3 ] - Select an element  \nt(m ) Transpose m %*% n  \nMatrix Multiplication solve(m , n ) Find x in: m * x = n  \nLists  \nl \u003C - list(x = 1:5 , y = c('a', 'b') ) A list is a collection of elements which can be of diﬀerent types.  \nl[[2]]  \nSecond element of l.  \nl[1]  \nNew list with only the first element.  \nl$x  \nElement named  \nx.  \nl['y']  \nNew list with only element named y.  \nAlso see the dplyr package.  \nData Frames  \ndf \u003C -data.frame(x = 1:3 , y = c('a', 'b', 'c') ) A special case of a list where all elements are the same length.  \n\n| x | y |\n| --- | --- |\n| 1 | a |\n| 2 | b |\n| 3 | c |\n\nMatrix subsetting   \ndf[ , 2]   \ndf[2, ]   \ndf[2, 2]   \nList subsetting  \ndf$x  \ndf[[2]]  \n| Understanding a data frame |  |\n| --- | --- |\n| View(df)\u003Cbr>head(df) | See the full data frame.\u003Cbr>See the first 6 rows. |\n\nn row(df) Number of rows.  \nncol(df) Number of columns.  \ndim(df) Number of columns and rows.  \nStrings  \n Also see the stringr package.   \npaste(x, y, sep = ' ') Join multiple vectors together. paste(x, collapse = ' ') Join elements of a vector together.  \ngrep(pattern, x) Find regular expression matches in x. gsub(pattern, replace, x) Replace matches in x with a string.  \ntoupper(x) Convert to uppercase.  \ntolower(x) Convert to lowercase.  \nnchar(x) Number of characters in a string.  \nFactors  \nfactor(x) Turn a vector into a factor. Can set the levels of the factor and  \nthe order.  \ncut(x, breaks = 4) Turn a numeric vector into a factor by ‘cutting’ into sections.  \nStatistics  \nlm(y ~ x, data=df)  \nLinear model.  \nglm(y ~ x, data=df) Generalised linear model.  \nsummary Get more detailed information  \nout a model.  \nt.test (x, y) Perform a t-test fordiﬀerence between means.  \npairwise.t .test Perform a t-test for paired data.  \nprop .test Test for adiﬀerence between proportions.  \naov Analysis of variance.  \nDistributions  \n\n|  | Random\u003Cbr>Variates | Density Function | Cumulative\u003Cbr>Distribution | Quantile |\n| --- | --- | --- | --- | --- |\n| Normal | rnorm | dnorm | pnorm | qnorm |\n| Poisson | rpois | dpois | ppois | qpois |\n| Binomial | rbinom | dbinom | pbinom | qbinom |\n| Uniform | runif | dunif | punif | qunif |\n\nPlotting  \nDates  \nAlso see the ggplot2 package.  \nplot(x, y) Values of x against y.  \nhist(x)  \nHistogram of  \nx.  \n See the lubridate package.   \nRStudio® is a trademark of RStudio, Inc. • CC BY  Mhairi McNeill • [mhairihmcneill@gmail.com](mhairihmcneill@gmail.com) • 844-448-1212 •  [rstudio.com](rstudio.com) Learn more at web page or vignette • package version • Updated: 3/15","cbCaiutwlGE0Rgnp","https://ap.wps.com/l/cbCaiutwlGE0Rgnp","pdf",204144,"English","# Data Types\n## Maths Functions\n## Variable Assignment and Environment\n## Matrices and Lists\n## Data Frames\n## Strings and Factors\n## Statistics and Distributions\n## Plotting and Dates","[{\"question\":\"How do I convert between common R data types?\",\"answer\":\"Use conversion functions like as.logical, as.numeric, as.character, and as.factor. R can convert higher values in the table to lower values depending on the target type.\"},{\"question\":\"What are the core maths and statistics functions available in this reference?\",\"answer\":\"It lists functions such as log, exp, max, min, round, signif, cor, sum, mean, median, quantile, rank, var, and sd, plus model and testing functions like lm, glm, summary, t.test, pairwise.t.test, prop.test, and aov.\"},{\"question\":\"Which R data structures are covered, and how are they commonly subset?\",\"answer\":\"Matrices, lists, and data frames are covered, including indexing patterns like selecting rows/columns or elements in matrices, using l[[2]] and l$x for lists, and using df[ , 2] / df[2, ] / df[2, 2] for data frames.\"}]","R Data Types, Maths Functions, and Core Data Structures - Cheat Sheet | PDF",1791923170]