[R] generate ordered categorical variable in R

Rui Barradas ruipbarradas at sapo.pt
Wed Sep 16 19:30:05 CEST 2015


Hello,

Try ?sample.

Hope this helps,

Rui Barradas

Em 16-09-2015 18:11, thanoon younis escreveu:
> Dear R- users
>
> I want to generate ordered categorical variable vector with 200x1 dimension
> and from 1 to 4 categories and i tried with this code
>
> Q1=runif(200,1,4) the results are not just 1 ,2 3,4, but the results with
> decimals like 1.244, 2.342,4,321 and so on ... My question how can i
> generate a vector and also a matrix with orered categorical variables and
> without decimals just 1,2,3 ,4 ,1,2,3,4, ....
>
> Many thanks in advance
>
>
>
>
>



More information about the R-help mailing list