fdata | R Documentation |
fdata
This function will format dataset for Varialbes to factors.
fdata(data, faS = NULL, FtN = FALSE, ped = FALSE)
data |
dataset. |
faS |
The column location of factor Variables. |
FtN |
Change factoric indexs to numeric indexs, default (F). |
ped |
Change factoric pedigree to numeric type, default (F). |
This function formats dataset Varialbes between factor and numeric type.
When using for factor to numeric, faS
should be a list of sites for
characteric and numeric type factor respectively, i.e., faS=list(c(2:4),c(1,5:8)),
with site 2:4 (character factors) and site c(1,5:8) (numeric factors), one of
them can be 0.
this returned a formated dataset.
Yuanzhen Lin <yzhlinscau@163.com>
Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016 AFfR website:https://github.com/yzhlinscau/AFfR
See Also as read.file
, read.example
library(AFEchidna)
names(mtcars)
mtcars1<-fdata(mtcars,faS=c(2,8,9))
data(sp,package='RSTAT2D')
sp1<-fdata(sp,faS=list(c(2:4),c(1,5:8)),FtN=TRUE)
str(sp1) # or head(sp1)
# list reformed levels
sp1$rf$Mum # or sp1$rf[[1]]
# only change numeric-factor to numeric index
sp1a<-fdata(sp,faS=list(0,c(1,5:8)),FtN=TRUE)
# only change characteric-factor to numeric index
sp1b<-fdata(sp,faS=list(c(2:4),0),FtN=TRUE)
sp2<-fdata(sp[,1:3],ped=TRUE)
sp3<-fdata(sp2,faS=1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.