Categories:
Cloud (204)
Entertainment (11)
Facebook (43)
General (50)
Life (31)
Programming (64)
Technology (430)
Testing (4)
Tools (488)
Twitter (5)
Wearable (26)
Web Design (44)
Collections:
Other Resources:
Data Structure - Factor
What is a Factor?
✍: FYIcenter.com
A factor is a data structure that stores a vector
and its distinct values as categories.
1. Create a factor object with the factor() function -
> f = factor( c("Bike", "Car", "Truck", "Car", "Bike", "Truck") )
> f
[1] Bike Car Truck Car Bike Truck
Levels: Bike Car Truck
> typeof(f)
[1] "integer"
> is.factor(f)
[1] TRUE
2. Get factor length and members -
> f = factor( c("Bike", "Car", "Truck", "Car", "Bike", "Truck") )
> length(f)
[1] 6
> f[4]
[1] Car
Levels: Bike Car Truck
2023-05-31, 1197🔥, 0💬
Popular Posts:
Why the "dir" command hangs when using the FTP command-line tool on Windows? when you run the "dir" ...
How to use MomoCast with Safari on iPhone and iPad to cast Website and video to Chromecast on TV? If...
How headers and footers are repeated in Microsoft Word? Why I see some headers and footers are repea...
How to create a command button to run my macro in slide show in PowerPoint? I have created a macro t...
How to configure Mozilla Firefox to use Notepad to edit Web page source code? By default, when you u...