Documentation for Eidos function type, which is a method of Eidos. Note that the R function is a stub, it does not do anything in R (except bring up this documentation). It will only do anything useful when used inside a slim_block function further nested in a slim_script function call, where it will be translated into valid SLiM code as part of a full SLiM script.

eidos_type(x)

Arguments

x

An object of type any. See details for description.

Value

An object of type string. Return will be of length 1 (a singleton)

Details

Documentation for this function can be found in the official SLiM manual: page NA.

Returns the type of x, as a string: "NULL", "logical", "integer", "float", "string", or "object". Contrast this with elementType(). (lis)grep(string$ pattern, string x, [logical$ ignoreCase = F], [string$ grammar = "ECMAScript"], [string$ value = "indices"], [logical$ fixed = F], [logical$ invert = F]) Searches for regular expression matches in the string-elements of x. Regular expressions (regexes) express patterns that strings can either match or not match; they are very widely used in programming languages and terminal shells. The topic of regexes is very complex, and a great deal of information about them can be found online, including examples and tutorials; this manual will not attempt to document the topic in detail. The grep() function uses a regex supplied in pattern, looking for matches for the regex in each element of x. If ignoreCase is F (the default), the pattern matching will be case sensitive (i.e., uppercase versus lowercase will matter); if it is T, the pattern matching will be case-insensitive. 68 The grammar parameter determines the regex grammar used to find matches. Several options are available. The default, "ECMAScript", is a straightforward regex grammar, the specification for which can be found at https://www.cplusplus.com/reference/regex/ECMAScript/ among many other links. The "basic" grammar uses POSIX basic regular expressions, often called BRE; this is documented at https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions. The "extended" grammar uses POSIX extended regular expressions, often called ERE; this is documented at https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions. The "awk" grammar is based upon the "extended" grammar, with more escapes for non-printing characters. The "grep" and "egrep" grammars are based upon the "basic" and "extended" grammars, respectively, but also allow newline characters ("\n") to separate alternations. If you are not sure which grammar you want to use, "ECMAScript" is recommended. All of these grammars are implemented internally in Eidos using the C++ <regex> library, so if you need clarification on the details of a grammar, you can search for related C++ materials online. Information about the matches found is returned in one of four ways. If value is "indices" (the default), an integer vector is returned containing the index in x for each match. If value is "elements", a string vector is returned containing the actual string-elements of x for each match. If value is "matches", a string vector is returned containing only the substring that matched, within each string-element in x that matched (if more than one substring in a given element matched, the first match is returned). Finally, if value is "logical" a logical vector is returned, of the same length as x, containing T where the corresponding element of x matched, or F where it did not match. This function therefore encapsulates the functionality of both the grep() and grepl() functions of R; use value="logical" for functionality like that of R's grepl(). If fixed is F (the default), matching is determined using pattern following the specified regex grammar as described above. If fixed is T, matching is instead determined using pattern as a string value to be matched "as is", rather than as a regular expression; the grammar specified does not matter in this case, but ignoreCase still applies. This could be thought of as another grammar value, really, meaning "no grammar", but it is supplied as a separate flag following R. Finally, if invert if F (the default) matching proceeds as normal for the chosen regex grammar, whereas if invert if T matching is inverted: indices, elements, or logical values are returned for the elements of x that did not match. If invert is T, the value parameter may not be "matches". Note that there is not presently any way to extract subpattern matches, nor is there any way to perform replacements of matches.

See also

Other Eidos: Eidos, eidos_abs(), eidos_acos(), eidos_all(), eidos_any(), eidos_apply(), eidos_array(), eidos_asFloat(), eidos_asInteger(), eidos_asLogical(), eidos_asString(), eidos_asin(), eidos_assert(), eidos_atan2(), eidos_atan(), eidos_beep(), eidos_catn(), eidos_cat(), eidos_cbind(), eidos_ceil(), eidos_citation(), eidos_clock(), eidos_cmColors(), eidos_color2rgb(), eidos_colors(), eidos_cor(), eidos_cos(), eidos_cov(), eidos_createDirectory(), eidos_cumProduct(), eidos_cumSum(), eidos_c(), eidos_date(), eidos_dbeta(), eidos_debugIndent(), eidos_defineConstant(), eidos_defineGlobal(), eidos_deleteFile(), eidos_dexp(), eidos_dgamma(), eidos_diag(), eidos_dim(), eidos_dmvnorm(), eidos_dnorm(), eidos_drop(), eidos_elementType(), eidos_exists(), eidos_exp(), eidos_fileExists(), eidos_filesAtPath(), eidos_findInterval(), eidos_float(), eidos_floor(), eidos_flushFile(), eidos_format(), eidos_functionSignature(), eidos_functionSource(), eidos_getSeed(), eidos_getwd(), eidos_heatColors(), eidos_hsv2rgb(), eidos_identical(), eidos_ifelse(), eidos_integerDiv(), eidos_integerMod(), eidos_integer(), eidos_isFinite(), eidos_isFloat(), eidos_isInfinite(), eidos_isInteger(), eidos_isLogical(), eidos_isNAN(), eidos_isNULL(), eidos_isObject(), eidos_isString(), eidos_length(), eidos_license(), eidos_log10(), eidos_log2(), eidos_logical(), eidos_log(), eidos_lowerTri(), eidos_ls(), eidos_match(), eidos_matrixMult(), eidos_matrix(), eidos_max(), eidos_mean(), eidos_min(), eidos_nchar(), eidos_ncol(), eidos_nrow(), eidos_object(), eidos_order(), eidos_paste0(), eidos_paste(), eidos_pmax(), eidos_pmin(), eidos_pnorm(), eidos_print(), eidos_product(), eidos_qnorm(), eidos_quantile(), eidos_rainbow(), eidos_range(), eidos_rank(), eidos_rbeta(), eidos_rbind(), eidos_rbinom(), eidos_rcauchy(), eidos_rdunif(), eidos_readCSV(), eidos_readFile(), eidos_repEach(), eidos_rep(), eidos_rev(), eidos_rexp(), eidos_rf(), eidos_rgamma(), eidos_rgb2color(), eidos_rgb2hsv(), eidos_rgeom(), eidos_rlnorm(), eidos_rmvnorm(), eidos_rm(), eidos_rnbinom(), eidos_rnorm(), eidos_round(), eidos_rpois(), eidos_runif(), eidos_rweibull(), eidos_sample(), eidos_sapply(), eidos_sd(), eidos_seqAlong(), eidos_seqLen(), eidos_seq(), eidos_setDifference(), eidos_setIntersection(), eidos_setSeed(), eidos_setSymmetricDifference(), eidos_setUnion(), eidos_setwd(), eidos_sin(), eidos_size(), eidos_sortBy(), eidos_sort(), eidos_source(), eidos_sqrt(), eidos_stop(), eidos_strcontains(), eidos_strfind(), eidos_string(), eidos_strprefix(), eidos_strsplit(), eidos_strsuffix(), eidos_str(), eidos_substr(), eidos_sumExact(), eidos_sum(), eidos_suppressWarnings(), eidos_sysinfo(), eidos_system(), eidos_tabulate(), eidos_tan(), eidos_tempdir(), eidos_terrainColors(), eidos_time(), eidos_trunc(), eidos_ttest(), eidos_t(), eidos_unique(), eidos_upperTri(), eidos_usage(), eidos_var(), eidos_version(), eidos_whichMax(), eidos_whichMin(), eidos_which(), eidos_writeFile(), eidos_writeTempFile()

Author

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)