Difference between revisions of "Central product classification"

From Testiwiki
Jump to: navigation, search
m
(code and ovariables updated)
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" 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))
  
print(xtable(head(CPC@output)), type = 'html')
 
 
</rcode>
 
</rcode>
  
Line 28: Line 34:
 
===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>

Revision as of 21:05, 27 December 2013



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

Rationale

UN CPC version 2 seems to be an optimal choice. [1] [2]

Dependencies

Calculations

+ Show code

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>