How to Build matrix in R -


i have samples a:z , want make matrix have sample column , value column 1's.

result should this.

samples values        1 b        1 c        1 d        1 .        . .        . z        1 

use cbind create matrix

 cbind(samples, values=1) 

but matrix can hold single class output columns 'character'

i suggest use data.frame hold columns of different class.

 data.frame(samples, values=1) 

if want 'samples' column character class, use option stringsasfactors=false. default true.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -