Keywords: manip
### ** Examples c(1,7:9)
[1] 1 7 8 9
c(1:5, 10.5, "next")
[1] "1" "2" "3" "4" "5" "10.5" "next"
## uses with a single argument to drop attributes x <- 1:4 names(x) <- letters[1:4] x
a b c d 1 2 3 4
c(x) # has names
a b c d 1 2 3 4
as.vector(x) # no names
[1] 1 2 3 4
dim(x) <- c(2,2) x
[,1] [,2] [1,] 1 3 [2,] 2 4
c(x)
[1] 1 2 3 4
as.vector(x)
[1] 1 2 3 4
## append to a list: ll <- list(A = 1, c = "C") ## do *not* use c(ll, d = 1:3) # which is == c(ll, as.list(c(d = 1:3)))
$A [1] 1 $c [1] "C" $d1 [1] 1 $d2 [1] 2 $d3 [1] 3
## but rather c(ll, d = list(1:3)) # c() combining two lists
$A [1] 1 $c [1] "C" $d [1] 1 2 3
c(list(A = c(B = 1)), recursive = TRUE)
A.B 1
c(options(), recursive = TRUE)
$add.smooth [1] TRUE $bitmapType [1] "cairo" $browser [1] "/usr/bin/xdg-open" $browserNLdisabled [1] FALSE $CBoundsCheck [1] FALSE $check.bounds [1] FALSE $citation.bibtex.max [1] 1 $continue [1] "+ " $contrasts.unordered [1] "contr.treatment" $contrasts.ordered [1] "contr.poly" $defaultPackages1 [1] "datasets" $defaultPackages2 [1] "utils" $defaultPackages3 [1] "grDevices" $defaultPackages4 [1] "graphics" $defaultPackages5 [1] "stats" $defaultPackages6 [1] "methods" $demo.ask [1] "default" $deparse.cutoff [1] 60 $device function (width = 7, height = 7, ...) { grDevices::pdf(NULL, width, height, ...) } <bytecode: 0x55ccff41f008> <environment: namespace:knitr> $device.ask.default [1] FALSE $digits [1] 7 $dvipscmd [1] "dvips" $echo [1] TRUE $editor [1] "vi" $encoding [1] "native.enc" $example.ask [1] "default" $expressions [1] 5000 $help.search.types1 [1] "vignette" $help.search.types2 [1] "demo" $help.search.types3 [1] "help" $help.try.all.packages [1] FALSE $HTTPUserAgent [1] "R (4.2.3 x86_64-pc-linux-gnu x86_64 linux-gnu) - RCloud (http://github.com/att/rcloud)" $httr_oauth_cache [1] NA $httr_oob_default [1] FALSE $internet.info [1] 2 $keep.parse.data [1] TRUE $keep.parse.data.pkgs [1] FALSE $keep.source [1] TRUE $keep.source.pkgs [1] FALSE $knitr.in.progress [1] TRUE $locatorBell [1] TRUE $mailer [1] "mailto" $matprod [1] "default" $max.print [1] 99999 $menu.graphics [1] TRUE $na.action [1] "na.omit" $nwarnings [1] 50 $OutDec [1] "." $pager [1] "/usr/local/R/4.2/bin/pager" $papersize [1] "a4" $PCRE_limit_recursion [1] NA $PCRE_study [1] FALSE $PCRE_use_JIT [1] TRUE $pdfviewer [1] "/usr/bin/xdg-open" $pkgType [1] "source" $printcmd [1] "" $prompt [1] "> " $repos.CRAN [1] "@CRAN@" $rl_word_breaks [1] " \t\n\"\\'`><=%;,|&{()}" $scipen [1] 0 $show.coef.Pvalues [1] TRUE $show.error.messages [1] TRUE $show.signif.stars [1] TRUE $str.strict.width [1] "no" $str.digits.d [1] 3 $str.vec.len [1] 4 $str.list.len [1] 99 $str.drop.deparse.attr [1] TRUE $str.formatNum function (x, ...) format(x, trim = TRUE, drop0trailing = TRUE, ...) <environment: 0x55ccfc5fed48> $str.dendrogram.last [1] "`" $stringsAsFactors [1] FALSE $texi2dvi [1] "texi2dvi" $timeout [1] 60 $try.outFile [1] 4 $ts.eps [1] 1e-05 $ts.S.compat [1] FALSE $unzip [1] "/usr/bin/unzip" $useFancyQuotes [1] FALSE $verbose [1] FALSE $warn [1] 0 $warning.length [1] 1000 $width [1] 80
c(list(A = c(B = 1, C = 2), B = c(E = 7)), recursive = TRUE)
A.B A.C B.E 1 2 7