Difference between revisions of "Central product classification"
From Testiwiki
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) | ||
− | |||
− | objects. | + | objects.latest("Op_en5914", code_name = "initiate") |
+ | |||
+ | CPC <- EvalOutput(CPC) | ||
+ | |||
+ | oprint(CPC@output[CPC@output$CPC.level < 3 , ]) | ||
+ | |||
+ | oprint(head(CPC@output)) | ||
− | |||
</rcode> | </rcode> | ||
Line 28: | Line 34: | ||
===Calculations=== | ===Calculations=== | ||
− | <rcode name=" | + | <rcode name="initiate" label="Initiate variable" embed=1> |
library(OpasnetUtils) | library(OpasnetUtils) | ||
− | |||
− | CPC <- | + | dat <- opbase.data("Op_en5914") |
− | CPC | + | dat$CPC.name <- dat$Result |
− | objects. | + | 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") | ||
− | |||
− | |||
</rcode> | </rcode> |
Revision as of 21:05, 27 December 2013
This page is a variable.
The page identifier is Op_en5914 |
---|
Moderator:Jouni (see all) |
Give your opinion to the peer rating of the content of this page. |
Upload data
|
Contents
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)
Rationale
UN CPC version 2 seems to be an optimal choice. [1] [2]
Dependencies
Calculations
See also
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>