{"id":229,"date":"2013-06-09T00:50:07","date_gmt":"2013-06-09T05:50:07","guid":{"rendered":"http:\/\/homepages.uc.edu\/~yaozo\/wordpress\/?p=229"},"modified":"2013-06-09T00:50:07","modified_gmt":"2013-06-09T05:50:07","slug":"factors-in-r","status":"publish","type":"post","link":"https:\/\/zhuoyao.net\/index.php\/2013\/06\/09\/factors-in-r\/","title":{"rendered":"Factors in R"},"content":{"rendered":"<h1 align=\"center\">Factors in R<\/h1>\n<p>Conceptually, factors are variables in R which take on a limited number of different values; such variables are often refered to as categorical variables. One of the most important uses of factors is in statistical modeling; since categorical variables enter into statistical models differently than continuous variables, storing data as factors insures that the modeling functions will treat such data correctly.<\/p>\n<div><\/div>\n<p>Factors in R are stored as a vector of integer values with a corresponding set of character values to use when the factor is displayed. The\u00a0<tt>f<\/tt>actor function is used to create a factor. The only required argument to\u00a0<tt>factor<\/tt>\u00a0is a vector of values which will be returned as a vector of factor values. Both numeric and character variables can be made into factors, but a factor&#8217;s levels will always be character values. You can see the possible levels for a factor through the\u00a0<tt>levels<\/tt>\u00a0command.<\/p>\n<div><\/div>\n<p>To change the order in which the levels will be displayed from their default sorted order, the\u00a0<tt>levels=<\/tt>\u00a0argument can be given a vector of all the possible values of the variable in the order you desire. If the ordering should also be used when performing comparisons, use the optional\u00a0<tt>ordered=TRUE<\/tt>\u00a0argument. In this case, the factor is known as an ordered factor.<\/p>\n<div><\/div>\n<p>The levels of a factor are used when displaying the factor&#8217;s values. You can change these levels at the time you create a factor by passing a vector with the new values through the\u00a0<tt>labels=<\/tt>\u00a0argument. Note that this actually changes the internal levels of the factor, and to change the labels of a factor after it has been created, the assignment form of the<tt>levels<\/tt>\u00a0function is used. To illustrate this point, consider a factor taking on integer values which we want to display as roman numerals.<\/p>\n<pre>&gt;\u00a0data\u00a0=\u00a0c(1,2,2,3,1,2,3,3,1,2,3,3,1)\n&gt;\u00a0fdata\u00a0=\u00a0factor(data)\n&gt;\u00a0fdata\n\u00a0[1]\u00a01\u00a02\u00a02\u00a03\u00a01\u00a02\u00a03\u00a03\u00a01\u00a02\u00a03\u00a03\u00a01\nLevels:\u00a01\u00a02\u00a03\n&gt;\u00a0rdata\u00a0=\u00a0factor(data,labels=c(\"I\",\"II\",\"III\"))\n&gt;\u00a0rdata\n\u00a0[1]\u00a0I\u00a0\u00a0\u00a0II\u00a0\u00a0II\u00a0\u00a0III\u00a0I\u00a0\u00a0\u00a0II\u00a0\u00a0III\u00a0III\u00a0I\u00a0\u00a0\u00a0II\u00a0\u00a0III\u00a0III\u00a0I\nLevels:\u00a0I\u00a0II\u00a0III<\/pre>\n<p>To convert the default factor\u00a0<tt>fdata<\/tt>\u00a0to roman numerals, we use the assignment form of the\u00a0<tt>levels<\/tt>\u00a0function:<\/p>\n<pre>&gt;\u00a0levels(fdata)\u00a0=\u00a0c('I','II','III')\n&gt;\u00a0fdata\n\u00a0[1]\u00a0I\u00a0\u00a0\u00a0II\u00a0\u00a0II\u00a0\u00a0III\u00a0I\u00a0\u00a0\u00a0II\u00a0\u00a0III\u00a0III\u00a0I\u00a0\u00a0\u00a0II\u00a0\u00a0III\u00a0III\u00a0I\nLevels:\u00a0I\u00a0II\u00a0III<\/pre>\n<div><\/div>\n<p>Factors represent a very efficient way to store character values, because each unique character value is stored only once, and the data itself is stored as a vector of integers. Because of this,\u00a0<tt>read.table<\/tt>\u00a0will automatically convert character variables to factors unless the\u00a0<tt>as.is=<\/tt>\u00a0argument is specified. See Section\u00a0 for details.<\/p>\n<div><\/div>\n<p>As an example of an ordered factor, consider data consisting of the names of months:<\/p>\n<pre>&gt;\u00a0mons\u00a0=\u00a0c(\"March\",\"April\",\"January\",\"November\",\"January\",\n+\u00a0\"September\",\"October\",\"September\",\"November\",\"August\",\n+\u00a0\"January\",\"November\",\"November\",\"February\",\"May\",\"August\",\n+\u00a0\"July\",\"December\",\"August\",\"August\",\"September\",\"November\",\n+\u00a0\"February\",\"April\")\n&gt;\u00a0mons\u00a0=\u00a0factor(mons)\n&gt;\u00a0table(mons)\nmons\n\u00a0\u00a0\u00a0\u00a0April\u00a0\u00a0\u00a0\u00a0August\u00a0\u00a0December\u00a0\u00a0February\u00a0\u00a0\u00a0January\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0July\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\n\u00a0\u00a0\u00a0\u00a0March\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0May\u00a0\u00a0November\u00a0\u00a0\u00a0October\u00a0September\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03<\/pre>\n<p>Although the months clearly have an ordering, this is not reflected in the output of the\u00a0<tt>table<\/tt>\u00a0function. Additionally, comparison operators are not supported for unordered factors. Creating an ordered factor solves these problems:<\/p>\n<pre>&gt;\u00a0mons\u00a0=\u00a0factor(mons,levels=c(\"January\",\"February\",\"March\",\n+\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\n+\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"October\",\"November\",\"December\"),ordered=TRUE)\n&gt;\u00a0mons[1]\u00a0&lt;\u00a0mons[2]\n[1]\u00a0TRUE\n&gt;\u00a0table(mons)\nmons\n\u00a0\u00a0January\u00a0\u00a0February\u00a0\u00a0\u00a0\u00a0\u00a0March\u00a0\u00a0\u00a0\u00a0\u00a0April\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0May\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0June\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a00\n\u00a0\u00a0\u00a0\u00a0\u00a0July\u00a0\u00a0\u00a0\u00a0August\u00a0September\u00a0\u00a0\u00a0October\u00a0\u00a0November\u00a0\u00a0December\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01<\/pre>\n<div><\/div>\n<p>While it may be necessary to convert a numeric variable to a factor for a particular application, it is often very useful to convert the factor back to its original numeric values, since even simple arithmetic operations will fail when using factors. Since the\u00a0<tt>as.numeric<\/tt>\u00a0function will simply return the internal integer values of the factor, the conversion must be done using the\u00a0<tt>levels<\/tt>\u00a0attribute of the factor.<\/p>\n<div><\/div>\n<p>Suppose we are studying the effects of several levels of a fertilizer on the growth of a plant. For some analyses, it might be useful to convert the fertilizer levels to an ordered factor:<\/p>\n<pre>&gt;\u00a0fert\u00a0=\u00a0c(10,20,20,50,10,20,10,50,20)\n&gt;\u00a0fert\u00a0=\u00a0factor(fert,levels=c(10,20,50),ordered=TRUE)\n&gt;\u00a0fert\n[1]\u00a010\u00a020\u00a020\u00a050\u00a010\u00a020\u00a010\u00a050\u00a020\nLevels:\u00a010\u00a0&lt;\u00a020\u00a0&lt;\u00a050<\/pre>\n<p>If we wished to calculate the mean of the original numeric values of the\u00a0<tt>fert<\/tt>\u00a0variable, we would have to convert the values using the\u00a0<tt>levels<\/tt>\u00a0function:<\/p>\n<pre>&gt;\u00a0mean(fert)\n[1]\u00a0NA\nWarning\u00a0message:\nargument\u00a0is\u00a0not\u00a0numeric\u00a0or\u00a0logical:\u00a0\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0returning\u00a0NA\u00a0in:\u00a0mean.default(fert)\n&gt;\u00a0mean(as.numeric(levels(fert)[fert]))\n[1]\u00a023.33333<\/pre>\n<p>Indexing the return value from the\u00a0<tt>levels<\/tt>\u00a0function is the most reliable way to convert numeric factors to their original numeric values.<\/p>\n<div><\/div>\n<p>When a factor is first created, all of its levels are stored along with the factor, and if subsets of the factor are extracted, they will retain all of the original levels. This can create problems when constructing model matrices and may or may not be useful when displaying the data using, say, the\u00a0<tt>table<\/tt>\u00a0function. As an example, consider a random sample from the\u00a0<tt>letters<\/tt>\u00a0vector, which is part of the base R distribution.<\/p>\n<pre>&gt;\u00a0lets\u00a0=\u00a0sample(letters,size=100,replace=TRUE)\n&gt;\u00a0lets\u00a0=\u00a0factor(lets)\n&gt;\u00a0table(lets[1:5])\n\na\u00a0b\u00a0c\u00a0d\u00a0e\u00a0f\u00a0g\u00a0h\u00a0i\u00a0j\u00a0k\u00a0l\u00a0m\u00a0n\u00a0o\u00a0p\u00a0q\u00a0r\u00a0s\u00a0t\u00a0u\u00a0v\u00a0w\u00a0x\u00a0y\u00a0z\n1\u00a00\u00a00\u00a00\u00a00\u00a00\u00a00\u00a00\u00a00\u00a00\u00a01\u00a00\u00a00\u00a00\u00a00\u00a00\u00a01\u00a00\u00a01\u00a00\u00a00\u00a00\u00a00\u00a00\u00a00\u00a01<\/pre>\n<p>Even though only five of the levels were actually represented, the\u00a0<tt>table<\/tt>\u00a0function shows the frequencies for all of the levels of the original factors. To change this, we can simply use another call to\u00a0<tt>factor<\/tt><\/p>\n<pre>&gt;\u00a0table(factor(lets[1:5]))\n\na\u00a0k\u00a0q\u00a0s\u00a0z\n1\u00a01\u00a01\u00a01\u00a01<\/pre>\n<div><\/div>\n<p>To exclude certain levels from appearing in a factor, the\u00a0<tt>exclude=<\/tt>\u00a0argument can be passed to\u00a0<tt>factor<\/tt>. By default, the missing value (<tt>NA<\/tt>) is excluded from factor levels; to create a factor that inludes missing values from a numeric variable, use\u00a0<tt>exclude=NULL<\/tt>.<\/p>\n<div><\/div>\n<p>Care must be taken when combining variables which are factors, because the\u00a0<tt>c<\/tt>\u00a0function will interpret the factors as integers. To combine factors, they should first be converted back to their original values (through the\u00a0<tt>levels<\/tt>\u00a0function), then catenated and converted to a new factor:<\/p>\n<pre>&gt;\u00a0l1\u00a0=\u00a0factor(sample(letters,size=10,replace=TRUE))\n&gt;\u00a0l2\u00a0=\u00a0factor(sample(letters,size=10,replace=TRUE))\n&gt;\u00a0l1\n\u00a0[1]\u00a0o\u00a0b\u00a0i\u00a0v\u00a0q\u00a0n\u00a0q\u00a0w\u00a0e\u00a0z\nLevels:\u00a0b\u00a0e\u00a0i\u00a0n\u00a0o\u00a0q\u00a0v\u00a0w\u00a0z\n&gt;\u00a0l2\n\u00a0[1]\u00a0b\u00a0a\u00a0s\u00a0b\u00a0l\u00a0r\u00a0g\u00a0m\u00a0z\u00a0o\nLevels:\u00a0a\u00a0b\u00a0g\u00a0l\u00a0m\u00a0o\u00a0r\u00a0s\u00a0z\n&gt;\u00a0l12\u00a0=\u00a0factor(c(levels(l1)[l1],levels(l2)[l2]))\n&gt;\u00a0l12\n\u00a0[1]\u00a0o\u00a0b\u00a0i\u00a0v\u00a0q\u00a0n\u00a0q\u00a0w\u00a0e\u00a0z\u00a0b\u00a0a\u00a0s\u00a0b\u00a0l\u00a0r\u00a0g\u00a0m\u00a0z\u00a0o\nLevels:\u00a0a\u00a0b\u00a0e\u00a0g\u00a0i\u00a0l\u00a0m\u00a0n\u00a0o\u00a0q\u00a0r\u00a0s\u00a0v\u00a0w\u00a0z<\/pre>\n<div><\/div>\n<p>The\u00a0<tt>cut<\/tt>\u00a0function is used to convert a numeric variable into a factor. The\u00a0<tt>breaks=<\/tt>\u00a0argument to\u00a0<tt>cut<\/tt>\u00a0is used to describe how ranges of numbers will be converted to factor values. If a number is provided through the\u00a0<tt>breaks=<\/tt>\u00a0argument, the resulting factor will be created by dividing the range of the variable into that number of equal length intervals; if a vector of values is provided, the values in the vector are used to determine the breakpoint. Note that if a vector of values is provided, the number of levels of the resultant factor will be one less than the number of values in the vector.<\/p>\n<div><\/div>\n<p>For example, consider the\u00a0<tt>women<\/tt>\u00a0data set, which contains height and weights for a sample of women. If we wanted to create a factor corresponding to\u00a0<tt>weight<\/tt>, with three equally-spaced levels, we could use the following:<\/p>\n<pre>&gt;\u00a0wfact\u00a0=\u00a0cut(women$weight,3)\n&gt;\u00a0table(wfact)\nwfact\n(115,131]\u00a0(131,148]\u00a0(148,164]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a06\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04<\/pre>\n<p>Notice that the default label for factors produced by\u00a0<tt>cut<\/tt>\u00a0contains the actual range of values that were used to divide the variable into factors. The\u00a0<tt>pretty<\/tt>\u00a0function can be used to make nicer default labels, but it may not return the number of levels that&#8217;s actually desired:<\/p>\n<pre>&gt;\u00a0wfact\u00a0=\u00a0cut(women$weight,pretty(women$weight,3))\n&gt;\u00a0wfact\n\u00a0[1]\u00a0(100,120]\u00a0(100,120]\u00a0(100,120]\u00a0(120,140]\u00a0(120,140]\u00a0(120,140]\u00a0(120,140]\n\u00a0[8]\u00a0(120,140]\u00a0(120,140]\u00a0(140,160]\u00a0(140,160]\u00a0(140,160]\u00a0(140,160]\u00a0(140,160]\n[15]\u00a0(160,180]\nLevels:\u00a0(100,120]\u00a0(120,140]\u00a0(140,160]\u00a0(160,180]\n&gt;\u00a0table(wfact)\nwfact\n(100,120]\u00a0(120,140]\u00a0(140,160]\u00a0(160,180]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a06\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01<\/pre>\n<p>The\u00a0<tt>labels=<\/tt>\u00a0argument to\u00a0<tt>cut<\/tt>\u00a0allows you to specify the levels of the factors:<\/p>\n<pre>&gt;\u00a0wfact\u00a0=\u00a0cut(women$weight,3,labels=c('Low','Medium','High'))\n&gt;\u00a0table(wfact)\nwfact\n\u00a0\u00a0\u00a0Low\u00a0Medium\u00a0\u00a0\u00a0High\n\u00a0\u00a0\u00a0\u00a0\u00a06\u00a0\u00a0\u00a0\u00a0\u00a0\u00a05\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04<\/pre>\n<div><\/div>\n<p>To produce factors based on percentiles of your data (for example quartiles or deciles), the\u00a0<tt>quantile<\/tt>\u00a0function can be used to generate the\u00a0<tt>breaks=<\/tt>\u00a0argument, insuring nearly equal numbers of observations in each of the levels of the factor:<\/p>\n<pre>&gt;\u00a0wfact\u00a0=\u00a0cut(women$weight,quantile(women$weight,(0:4)\/4))\n&gt;\u00a0table(wfact)\nwfact\n(115,124]\u00a0(124,135]\u00a0(135,148]\u00a0(148,164]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a03\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04<\/pre>\n<div><\/div>\n<p>As mentioned in Section\u00a0, there are a number of ways to create factors from date\/time objects. If you wish to create a factor based on one of the components of that date, you can extract it with\u00a0<tt>strftime<\/tt>\u00a0and convert it to a factor directly. For example, we can use the\u00a0<tt>seq<\/tt>\u00a0function to create a vector of dates representing each day of the year:<\/p>\n<pre>&gt;\u00a0everyday\u00a0=\u00a0seq(from=as.Date('2005-1-1'),to=as.Date('2005-12-31'),by='day')<\/pre>\n<p>To create a factor based on the month of the year in which each date falls, we can extract the month name (full or abbreviated) using\u00a0<tt>format<\/tt>:<\/p>\n<pre>&gt;\u00a0cmonth\u00a0=\u00a0format(everyday,'%b')\n&gt;\u00a0months\u00a0=\u00a0factor(cmonth,levels=unique(cmonth),ordered=TRUE)\n&gt;\u00a0table(months)\nmonths\nJan\u00a0Feb\u00a0Mar\u00a0Apr\u00a0May\u00a0Jun\u00a0Jul\u00a0Aug\u00a0Sep\u00a0Oct\u00a0Nov\u00a0Dec\n\u00a031\u00a0\u00a028\u00a0\u00a031\u00a0\u00a030\u00a0\u00a031\u00a0\u00a030\u00a0\u00a031\u00a0\u00a031\u00a0\u00a030\u00a0\u00a031\u00a0\u00a030\u00a0\u00a031<\/pre>\n<p>Since\u00a0<tt>unique<\/tt>\u00a0returns unique values in the order they are encountered, the levels argument will provide the month abbreviations in the correct order to produce an properly ordered factor.<\/p>\n<div><\/div>\n<p>For more details on formatting dates, see Section<\/p>\n<div><\/div>\n<p>Sometimes more flexibility can be acheived by using the\u00a0<tt>cut<\/tt>\u00a0function, which understands time units of\u00a0<tt>months<\/tt>,\u00a0<tt>days<\/tt>,\u00a0<tt>weeks<\/tt>\u00a0and\u00a0<tt>years<\/tt>\u00a0through the\u00a0<tt>breaks=<\/tt>\u00a0argument. (For date\/time values, units of\u00a0<tt>hours<\/tt>,\u00a0<tt>minutes<\/tt>, and\u00a0<tt>seconds<\/tt>\u00a0can also be used.) For example, to format the days of the year based on the week in which they fall, we could use<tt>cut<\/tt>\u00a0as follows:<\/p>\n<pre>&gt;\u00a0wks\u00a0=\u00a0cut(everyday,breaks='week')\n&gt;\u00a0head(wks)\n[1]\u00a02004-12-27\u00a02004-12-27\u00a02005-01-03\u00a02005-01-03\u00a02005-01-03\u00a02005-01-03\n53\u00a0Levels:\u00a02004-12-27\u00a02005-01-03\u00a02005-01-10\u00a02005-01-17\u00a0...\u00a02005-12-26<\/pre>\n<p>Note that the first observation had a date earlier than any of the dates in the\u00a0<tt>everyday<\/tt>\u00a0vector, since the first date was in middle of the week. By default,\u00a0<tt>cut<\/tt>\u00a0starts weeks on Mondays; to use Sundays instead, pass the\u00a0<tt>start.on.monday=FALSE<\/tt>\u00a0argument to\u00a0<tt>cut<\/tt>.<\/p>\n<div><\/div>\n<p>Multiples of units can also be specified through the\u00a0<tt>breaks=<\/tt>\u00a0argument. For example, create a factor based on the quarter of the year an observation is in, we could use\u00a0<tt>cut<\/tt>\u00a0as follows:<\/p>\n<pre>&gt;\u00a0qtrs\u00a0=\u00a0cut(everyday,\"3\u00a0months\",labels=paste('Q',1:4,sep=''))\n&gt;\u00a0head(qtrs)\n[1]\u00a0Q1\u00a0Q1\u00a0Q1\u00a0Q1\u00a0Q1\u00a0Q1\nLevels:\u00a0Q1\u00a0Q2\u00a0Q3\u00a0Q4<\/pre>\n<div><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Factors in R Conceptually, factors are variables in R which take on a limited number of different values; such variables are often refered to as&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-229","post","type-post","status-publish","format-standard","hentry","category-r"],"_links":{"self":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/comments?post=229"}],"version-history":[{"count":0,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/posts\/229\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/media?parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/categories?post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuoyao.net\/index.php\/wp-json\/wp\/v2\/tags?post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}