Difference between revisions of "Central product classification"

From Testiwiki
Jump to: navigation, search
m
(some description of CPC added)
 
(2 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
== Answer ==
 
== Answer ==
  
<rcode>
+
{{attack|#|Something wrong with the first-level codes (there is a leading zero although should not be). This was corrected, but is there more problems with the data?|--[[User:Jouni|Jouni]] ([[User talk:Jouni|talk]]) 23:05, 27 December 2013 (EET)}}
 +
 
 +
<rcode name="answer" label="Show classification levels 1-2" embed=1>
 
library(OpasnetUtils)
 
library(OpasnetUtils)
library(xtable)
 
  
objects.get("K4nyB3vNg9yQvtdy")
+
objects.latest("Op_en5914", code_name = "initiate")
 +
 
 +
CPC <- EvalOutput(CPC)
 +
 
 +
oprint(CPC@output[CPC@output$CPC.level < 3 , ])
 +
 
 +
oprint(head(CPC@output))
 +
 
 +
</rcode>
 +
 
 +
 
 +
<rcode name="subclasses" label="Show lower classification levels" embed=1 variables="
 +
name:class|description:Which class do you want to see in detail?|type:text|default:011
 +
">
 +
library(OpasnetUtils)
 +
 
 +
objects.latest("Op_en5914", code_name = "initiate")
 +
 
 +
CPC <- EvalOutput(CPC)
 +
 
 +
oprint(CPC@output[regexpr(class, CPC@output$CPC.code) == 1 , ])
  
print(xtable(head(CPC@output)), type = 'html')
 
 
</rcode>
 
</rcode>
  
 
== Rationale ==
 
== Rationale ==
  
UN CPC version 2 seems to be an optimal choice.  
+
UN CPC version 2 seems to be an optimal choice. It contains a hierarchical system for products, 4408 rows in total. It is organised in five hierarchical levels. It is based on ten categories at the top level, numbered from 0 to 9:
 
[http://unstats.un.org/unsd/cr/registry/cpc-2.asp]
 
[http://unstats.un.org/unsd/cr/registry/cpc-2.asp]
 
[http://unstats.un.org/unsd/cr/registry/regdntransfer.asp?f=130]
 
[http://unstats.un.org/unsd/cr/registry/regdntransfer.asp?f=130]
 +
* Agriculture, forestry and fishery products
 +
* Ores and minerals; electricity, gas and water
 +
* Food products, beverages and tobacco; textiles, apparel and leather products
 +
* Other transportable goods, except metal products, machinery and equipment
 +
* Metal products, machinery and equipment
 +
* Constructions and construction services
 +
* Distributive trade services; accommodation, food and beverage serving services; transport services; and electricity, gas and water distribution services
 +
* Financial and related services; real estate services; and rental and leasing services
 +
* Business and production services
 +
* Community, social and personal services
  
 
=== Dependencies ===
 
=== Dependencies ===
Line 28: Line 58:
 
===Calculations===
 
===Calculations===
  
<rcode name="calculations" label="Initiate variable">
+
<rcode name="initiate" label="Initiate variable" embed=1>
 
library(OpasnetUtils)
 
library(OpasnetUtils)
library(xtable)
 
  
CPC <- Ovariable("CPC", ddata = "Op_en5914")
+
dat <- opbase.data("Op_en5914")
CPC@output <- CPC@data
+
dat$CPC.name <- dat$Result
objects.put(CPC)
+
temp <- levels(dat$CPC.name)
 +
temp <- gsub("\r", "", temp)
 +
levels(dat$CPC.name) <- temp
 +
dat$Result <- 1
 +
temp2 <- as.character(levels(dat$CPC.code)[dat$CPC.code])
 +
temp2[c(318, 416, 1016, 1734)] <- c("1", "2", "3", "4")
 +
dat$CPC.code <- as.factor(temp2)
 +
dat$CPC.level <- nchar(temp2)
 +
 
 +
CPC <- Ovariable("CPC", data = dat)
 +
 
 +
objects.store(CPC)
  
 
cat("Ovariable CPC created.\n")
 
cat("Ovariable CPC created.\n")
 
print(xtable(head(CPC@output)), type = 'html')
 
  
 
</rcode>
 
</rcode>

Latest revision as of 13:09, 13 March 2014



Question

What is a good classification system for products?

Answer

#: Something wrong with the first-level codes (there is a leading zero although should not be). This was corrected, but is there more problems with the data? --Jouni (talk) 23:05, 27 December 2013 (EET)

+ Show code


Which class do you want to see in detail?:

+ Show code

Rationale

UN CPC version 2 seems to be an optimal choice. It contains a hierarchical system for products, 4408 rows in total. It is organised in five hierarchical levels. It is based on ten categories at the top level, numbered from 0 to 9: [1] [2]

  • Agriculture, forestry and fishery products
  • Ores and minerals; electricity, gas and water
  • Food products, beverages and tobacco; textiles, apparel and leather products
  • Other transportable goods, except metal products, machinery and equipment
  • Metal products, machinery and equipment
  • Constructions and construction services
  • Distributive trade services; accommodation, food and beverage serving services; transport services; and electricity, gas and water distribution services
  • Financial and related services; real estate services; and rental and leasing services
  • Business and production services
  • Community, social and personal services

Dependencies

Calculations

+ Show code

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>