This function creates column names (colnames), row.names (row.names), or both in an unnamed data.frame or matrix.

forceNames(dat, nameType = "row")

Arguments

dat

A vector of data

nameType,

either:

"row"

Rows (default)

"col"

Columns

"rowcol"

Both rows and columns

Value

An object of type `data.frame with labeled columns, rows, or both.

Examples

data(anolis) forceNames(anolis$dat, "row")
#> X SVL PCI_limbs PCII_head PCIII_padwidth_vs_tail #> 1 ahli 4.039125 -3.24828599 0.37225191 -1.0422187 #> 2 alayoni 3.815705 3.40888624 -1.78335850 2.2084510 #> 3 alfaroi 3.526655 2.58175921 0.77876335 -2.4463337 #> 4 aliniger 4.036557 0.12323898 -1.67467041 2.3871336 #> 5 allisoni 4.375390 2.03597967 -3.74252815 0.5203703 #> 6 allogus 4.040138 -2.84557021 0.60011341 -1.0253056 #> 7 altitudinalis 3.842994 2.86751469 -6.12805047 2.3331196 #> 8 alumina 3.588941 0.72166993 1.52514444 -2.6721669 #> 9 alutaceus 3.554891 1.17338999 -0.61493813 -1.6539883 #> 10 angusticeps 3.788595 4.58711071 -1.97673831 1.1594671 #> 11 argenteolus 3.971307 -2.92797328 2.61964493 0.9791727 #> 12 argillaceus 3.757869 -0.11307851 -1.48944374 2.3710815 #> 13 armouri 4.121684 -3.16993598 -4.08620441 -0.8883209 #> 14 bahorucoensis 3.827445 -0.04747332 -2.55694724 -3.0896949 #> 15 baleatus 5.053056 0.73766495 1.79646028 -0.5409516 #> 16 baracoae 5.042780 0.76817392 0.06987127 0.1805891 #> 17 barahonae 5.076958 0.90731040 2.33222342 -0.6158464 #> 18 barbatus 5.003946 2.25020229 -3.30818172 1.3476390 #> 19 barbouri 3.663932 -0.87536237 1.34009434 -2.6138245 #> 20 bartschi 4.280547 -3.25502168 0.80565652 1.1234288 #> 21 bremeri 4.113371 -1.81361138 2.60675012 0.6399320 #> 22 breslini 4.051111 -2.97497529 -3.34153375 -1.8978249 #> 23 brevirostris 3.874155 -3.28900081 1.38425488 2.4070756 #> 24 caudalis 3.911743 -1.78270839 1.90870776 1.7530966 #> 25 centralis 3.697941 0.73073876 -0.41683597 1.7586477 #> 26 chamaeleonides 5.042349 2.95597428 -3.69231889 1.3297304 #> 27 chlorocyanus 4.275448 0.43906343 1.35403450 1.9531470 #> 28 christophei 3.884652 -2.70596332 1.70527559 -0.1725921 #> 29 clivicola 3.758726 -1.05114421 -0.58903393 -1.2178042 #> 30 coelestinus 4.297965 -0.02721683 0.36875369 1.6364316 #> 31 confusus 3.938442 -2.49591732 0.16823269 0.1551290 #> 32 cooki 4.091535 -2.22079009 0.05979850 -0.1092647 #> 33 cristatellus 4.189820 -3.33026331 -0.62225189 1.2175309 #> 34 cupeyalensis 3.462014 2.72419698 0.48960424 -2.4795271 #> 35 cuvieri 4.875012 -1.18955124 -0.71983364 -1.0167340 #> 36 cyanopleurus 3.630161 0.43328510 0.98930100 -2.8189997 #> 37 cybotes 4.210982 -3.11637922 -2.99620854 -0.8299057 #> 38 darlingtoni 4.302036 4.06703170 -1.49378979 -0.2002259 #> 39 distichus 3.928796 -3.84343343 0.83890749 2.4922170 #> 40 dolichocephalus 3.908550 2.60131528 -2.59530770 -4.1439327 #> 41 equestris 5.113994 1.05461517 0.70720387 0.7108046 #> 42 etheridgei 3.657991 -3.81065955 -0.75340900 -2.0659201 #> 43 eugenegrahami 4.128504 -4.21209140 4.83351955 1.0228151 #> 44 evermanni 4.165605 -2.52899245 0.12548098 1.8824633 #> 45 fowleri 4.288780 -1.03667003 1.50383762 -1.7589251 #> 46 garmani 4.769473 -0.77352640 0.93712494 0.2594994 #> 47 grahami 4.154274 -2.30565354 -1.91393689 1.6852579 #> 48 guafe 3.877457 -2.61408710 0.65608676 0.6071245 #> 49 guamuhaya 5.036953 3.10947396 -4.07973423 -0.1820287 #> 50 guazuma 3.763884 8.16566506 -0.60605865 1.7597408 #> 51 gundlachi 4.188105 -2.64936274 -0.56251604 -2.2852265 #> 52 haetianus 4.316542 -3.40402925 -3.78444664 -1.7798344 #> 53 hendersoni 3.859835 1.28963045 -2.06309845 -3.4656535 #> 54 homolechis 4.032806 -2.74499346 0.87926009 0.8679694 #> 55 imias 4.099687 -3.04891725 2.33203488 0.1616442 #> 56 inexpectatus 3.537439 2.50607244 -0.52340367 -2.8057449 #> 57 insolitus 3.800471 5.03062671 0.24137669 0.9139707 #> 58 isolepis 3.657088 3.05697642 -4.34018373 2.4409248 #> 59 jubar 3.952605 -2.22414593 0.94489985 0.6600716 #> 60 krugi 3.886500 -1.68879533 -0.83128181 -1.2588892 #> 61 lineatopus 4.128612 -2.43081291 -3.12552390 -1.7564495 #> 62 longitibialis 4.242103 -3.52243048 -1.61670439 -1.6182845 #> 63 loysiana 3.701240 0.31536951 -1.08038145 2.7442074 #> 64 lucius 4.198915 -4.38139803 1.25981123 2.1899604 #> 65 luteogularis 5.101085 0.39614254 0.73584435 1.0058546 #> 66 macilentus 3.715765 3.15177391 3.26626613 -3.7238293 #> 67 marcanoi 4.079485 -2.84448243 -2.78644148 -0.8020303 #> 68 marron 3.831810 -2.84709341 -0.12032028 1.6898101 #> 69 mestrei 3.987147 -2.60261906 1.27568612 0.4640379 #> 70 monticola 3.770613 -3.25118016 0.15599344 -2.2390082 #> 71 noblei 5.083473 -0.09337994 -0.96088851 0.8905492 #> 72 occultus 3.663049 7.92078444 -0.19013968 2.4922819 #> 73 olssoni 3.793899 0.81682668 3.87442813 -2.4337310 #> 74 opalinus 3.838376 -1.77943710 -0.32453812 1.5569939 #> 75 ophiolepis 3.637962 0.79151174 1.45857603 -1.3152005 #> 76 oporinus 3.845670 3.05888289 -2.91565342 2.2875989 #> 77 paternus 3.802961 2.90637723 -0.95846093 0.9491115 #> 78 placidus 3.773967 7.38332866 0.53958973 2.7042981 #> 79 poncensis 3.820378 0.52782664 1.24062035 -1.6249761 #> 80 porcatus 4.258991 1.93193251 -3.82953305 0.9781194 #> 81 porcus 5.038034 3.50614537 -2.98667964 0.7500647 #> 82 pulchellus 3.799022 0.16238151 -2.33846103 -1.5906715 #> 83 pumilis 3.466860 0.55404946 -0.42584152 2.1572563 #> 84 quadriocellifer 3.901619 -2.26789400 0.99092075 0.3553405 #> 85 reconditus 4.482607 -2.72704156 -0.21040657 -2.3534242 #> 86 ricordii 5.013963 0.58940470 1.34670464 -0.8626956 #> 87 rubribarbus 4.078469 -2.23834859 1.11997785 -1.1929572 #> 88 sagrei 4.067162 -1.74105547 2.02282431 0.1693635 #> 89 semilineatus 3.696631 0.18403236 -0.13872022 -2.8957227 #> 90 sheplani 3.682924 10.27389091 2.27784409 1.6981742 #> 91 shrevei 3.983003 -2.25952607 -3.55788235 -1.3884348 #> 92 singularis 4.057997 0.36326789 -0.95422871 1.6562154 #> 93 smallwoodi 5.035096 -0.13770527 -1.15140405 0.4296432 #> 94 strahmi 4.274271 -3.87340303 -1.01635836 -0.9366696 #> 95 stratulus 3.869881 -1.62264165 -0.52957490 2.2166952 #> 96 valencienni 4.321524 2.94241389 -0.88460072 1.8543308 #> 97 vanidicus 3.626206 4.04436760 1.08716320 -2.4921192 #> 98 vermiculatus 4.802849 0.22783467 1.41411087 -1.8467441 #> 99 websteri 3.916546 -2.50870054 0.97482786 2.9024438 #> 100 whitemani 4.097479 -2.54584901 -3.25974024 -1.9200701 #> PCIV_lamella_num awesomeness hostility attitude ecomorph island #> 1 -2.41474228 -0.241651698 -0.173476906 0.64437708 TG Cuba #> 2 0.94969689 -0.259032167 0.127344278 0.29597325 TW Cuba #> 3 0.70036608 -0.462062012 0.178370302 -0.01958915 GB Cuba #> 4 0.58486431 0.006869282 0.144815367 0.29376432 TC Hispaniola #> 5 2.05565172 -0.132309870 0.464556617 -0.54956842 TC Cuba #> 6 -2.46331106 0.624468879 -0.500096224 0.71289104 TG Cuba #> 7 0.68195498 1.164592168 -0.865462260 0.63326685 TC Cuba #> 8 1.23487950 -1.253724344 1.308419442 -0.96110895 GB Hispaniola #> 9 1.41160228 0.325807029 -0.523648505 0.50405157 GB Cuba #> 10 0.38835687 1.713217290 -1.884387903 0.92471752 TW Cuba #> 11 2.94194227 0.490363636 -0.505416684 -0.20254651 U Cuba #> 12 0.33264142 0.007554828 -0.259421287 -0.62559912 U Cuba #> 13 -2.02129909 -0.158605136 -0.369246555 -0.26866597 TG Hispaniola #> 14 1.56271877 2.553879072 -2.337986521 2.47075117 GB Hispaniola #> 15 -0.16220546 2.727286255 -2.487661729 2.78477616 CG Hispaniola #> 16 2.66309134 1.821981086 -1.522244645 2.17591511 CG Cuba #> 17 -0.19473780 1.831370900 -1.331616706 1.70626854 CG Hispaniola #> 18 -1.64780456 2.156287540 -2.094147109 1.97196598 U Cuba #> 19 -4.30147185 1.788945648 -0.913725183 0.64025272 U Hispaniola #> 20 1.74943703 -1.189744988 1.025075387 0.25994625 U Cuba #> 21 -1.62629939 -1.754300558 1.412718374 0.18323450 TG Cuba #> 22 -2.16718706 -1.944082859 2.147925602 -2.07465046 TG Hispaniola #> 23 -0.82666991 -1.538338585 1.633533660 -1.24247895 T Hispaniola #> 24 -1.44378878 -0.601304152 0.216500950 0.85182003 T Hispaniola #> 25 -1.13869021 -0.620236225 0.330225203 -0.71777358 U Cuba #> 26 -1.51973745 -1.193993760 1.858148718 -1.43308743 U Cuba #> 27 1.80512493 -1.065610146 0.920097708 -0.93721735 TC Hispaniola #> 28 0.64693336 -0.266699615 0.220410336 1.46547483 U Hispaniola #> 29 -0.55865998 0.340444764 -0.599034616 1.78969146 GB Cuba #> 30 1.02571762 0.290926638 -0.620965953 1.28033350 TC Hispaniola #> 31 -1.39796407 0.496114209 -0.544543392 1.36010631 TG Cuba #> 32 -0.50826932 1.277956446 -1.082760383 1.37721870 TG Puerto Rico #> 33 -1.21819703 0.830658098 -0.007447027 0.39061232 TG Puerto Rico #> 34 -0.03297035 1.327984163 -0.994951781 0.04668455 GB Cuba #> 35 -0.02153073 -0.115917120 0.281153377 -0.97876663 CG Puerto Rico #> 36 0.87176931 0.413447859 0.073949884 -0.50654925 GB Cuba #> 37 -2.09049464 0.905454434 -0.262630999 0.68467864 TG Hispaniola #> 38 0.31138087 1.718720076 -1.690079016 1.02145675 TW Hispaniola #> 39 -1.03972507 1.973200862 -1.608003643 0.91461500 T Hispaniola #> 40 3.67023402 0.739483022 -0.989799476 1.09191365 GB Hispaniola #> 41 1.66043194 1.080566180 -1.266611407 0.66730260 CG Cuba #> 42 -0.74890866 0.848149691 -0.960258609 0.18291181 U Hispaniola #> 43 1.66539278 2.155800992 -2.494661307 1.11438687 U Hispaniola #> 44 1.92392086 1.871367582 -2.029729624 1.02877511 TC Puerto Rico #> 45 -1.71914111 1.456935239 -1.448418148 0.07531334 U Hispaniola #> 46 0.10511495 0.167791307 0.676756002 -0.69460080 CG Puerto Rico #> 47 1.01441926 0.410642801 -0.117462571 0.70229589 TC Puerto Rico #> 48 -1.48220834 -0.139145550 -0.310434629 -0.50480610 TG Cuba #> 49 -0.10748930 -0.137962568 0.119982369 0.04203987 U Cuba #> 50 1.55102509 -0.015197500 -0.020516523 0.08678021 TW Cuba #> 51 -2.48420519 -0.426336538 0.613014449 -0.69318262 TG Puerto Rico #> 52 -2.20379012 0.721747833 -0.969190196 0.74101761 TG Hispaniola #> 53 2.58336718 0.385454354 -0.713316425 -0.39597920 GB Hispaniola #> 54 -1.56665822 -0.085375433 0.092602997 -0.08130904 TG Cuba #> 55 -2.11260585 0.169425977 -0.410812337 0.19635800 TG Cuba #> 56 1.68036114 0.244666550 -0.307162858 0.06937286 GB Cuba #> 57 -0.42075245 0.066715596 -0.290651288 0.07286240 TW Hispaniola #> 58 -0.07418779 -0.194644197 0.001671326 0.16264659 TC Cuba #> 59 -1.65749549 2.145582200 -0.993730897 1.05775273 TG Cuba #> 60 0.24029913 0.972494741 -0.371866585 1.46109470 GB Puerto Rico #> 61 -1.43952303 0.800931449 0.170290172 0.33555714 TG Jamaica #> 62 -2.67106616 2.537213358 -1.420542767 1.71562944 TG Hispaniola #> 63 -0.52657687 2.153959487 -1.198967281 1.51422456 T Cuba #> 64 1.75435972 0.126135253 0.545903248 -0.58505782 U Cuba #> 65 1.98043577 0.194610912 0.713343825 -0.56222110 CG Cuba #> 66 1.21810218 0.868463721 -0.287882420 0.69946303 GB Cuba #> 67 -1.04842823 1.182343323 -0.167193617 0.58279004 TG Hispaniola #> 68 -1.57063776 -2.149486418 2.413050748 -2.14378229 T Hispaniola #> 69 -1.19666399 -0.228920131 0.820920959 -0.73929564 TG Cuba #> 70 0.13156827 0.628989307 0.146877669 -0.44097752 U Hispaniola #> 71 2.09456880 -0.974406590 1.602507741 -0.42228829 CG Cuba #> 72 -0.09577977 -1.191686980 1.215301402 0.03244860 TW Puerto Rico #> 73 0.62906887 -1.391771586 1.210221860 -0.29186894 GB Hispaniola #> 74 0.93665013 1.483021624 -0.908266532 0.72613483 TC Jamaica #> 75 -2.23775137 0.354418772 0.053661422 -0.09389530 GB Cuba #> 76 -0.08659903 0.573048475 -0.985921965 0.88025286 TC Cuba #> 77 1.80146660 -0.299550789 0.846263466 -0.96311064 TW Cuba #> 78 -0.31778878 0.078986096 0.504242392 -0.40436325 TW Hispaniola #> 79 -0.94924727 -0.289982852 0.510241609 -0.18543914 GB Puerto Rico #> 80 2.88538479 -0.074646660 0.148259194 -0.57178426 TC Cuba #> 81 -1.19909229 0.158971414 -0.350187677 0.45987065 U Cuba #> 82 0.68180888 0.978157532 -0.810754596 1.39277529 GB Puerto Rico #> 83 -1.12208954 0.459254083 -0.162682657 -0.47694819 U Cuba #> 84 -2.10505922 -0.257638879 0.462708058 -0.27127944 TG Cuba #> 85 -0.79929053 0.260965443 -0.271697917 0.01367143 U Jamaica #> 86 0.03516802 -0.456651495 0.663302028 -0.64625837 CG Hispaniola #> 87 -2.08743282 -0.427757376 0.480044450 -0.96742634 TG Cuba #> 88 -1.37576941 -0.630433775 0.719312962 -1.22282764 TG Cuba #> 89 0.92280509 -0.612226281 0.807322377 -0.82943161 GB Hispaniola #> 90 -0.25962432 -0.431283305 0.321955192 -0.80553288 TW Hispaniola #> 91 -2.19082487 0.257277082 0.029600473 0.39422885 TG Hispaniola #> 92 1.00756926 1.592083294 -1.701052660 1.45313446 TC Hispaniola #> 93 2.44067497 -0.018317012 -0.366531140 1.59163441 CG Cuba #> 94 -1.57843390 0.340077411 -0.690011247 2.11135720 TG Hispaniola #> 95 0.94622231 -0.314853533 0.515229477 -0.40828716 TC Puerto Rico #> 96 0.12882327 -0.088370075 0.465286788 -0.56754896 TW Jamaica #> 97 0.18942396 -1.287008036 1.023037680 -0.67591746 GB Cuba #> 98 0.71173422 0.159291276 -0.024230945 -0.31575501 U Cuba #> 99 -1.53259879 0.025584758 0.124044450 0.11758642 T Hispaniola #> 100 -2.41993928 -1.457775289 1.096071557 -0.87393333 TG Hispaniola