2016-12-04 3 views
0

hier meine Daten angewendet:strOptions sind nicht auf str

structure(list(SHOP_WEEK = c(200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L, 200607L), SHOP_DATE = c(20060415L, 20060413L, 20060416L, 20060415L, 20060415L, 20060412L, 20060413L, 20060413L, 20060413L, 20060415L, 20060415L, 20060415L, 20060415L, 20060416L, 20060412L, 20060415L, 20060415L, 20060415L, 20060413L, 20060415L), SHOP_WEEKDAY = c(7L, 5L, 1L, 7L, 7L, 4L, 5L, 5L, 5L, 7L, 7L, 7L, 7L, 1L, 4L, 7L, 7L, 7L, 5L, 7L), SHOP_HOUR = c(19L, 20L, 14L, 19L, 19L, 19L, 18L, 20L, 18L, 19L, 19L, 19L, 19L, 14L, 19L, 19L, 19L, 19L, 20L, 19L), QUANTITY = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), SPEND = c(0.93, 1.03, 0.98, 3.07, 4.81, 0.28, 1.56, 0.84, 1.09, 1.62, 1.85, 1.11, 1.49, 1.3, 2.21, 0.81, 1.25, 3.34, 3.34, 0.01), PROD_CODE = c("26", "70", "88", "99", "160", "249", "391", "393", "437", "506", "509", "531", "723", "731", "1145", "1154", "1155", "1418", "1418", "1536"), PROD_CODE_10 = c("188", "1", "61", "188", "50", "68", "74", "162", "158", "192", "161", "135", "72", "158", "10", "15", "108", "71", "71", "201"), PROD_CODE_20 = c("64", "1", "19", "64", "13", "20", "22", "55", "55", "66", "55", "48", "21", "55", "3", "4", "39", "21", "21", "68"), PROD_CODE_30 = c("20", "1", "7", "20", "5", "7", "7", "16", "16", "21", "16", "13", "7", "16", "2", "3", "10", "7", "7", "21"), PROD_CODE_40 = c("5", "1", "2", "5", "2", "2", "2", "3", "3", "5", "3", "3", "2", "3", "1", "1", "3", "2", "2", "5"), CUST_CODE = c("709", "1108", NA, "709", "709", "1108", NA, "1108", NA, "709", "709", "709", "709", NA, "1108", "709", "709", "709", "1108", "709"), CUST_PRICE_SENSITIVITY = c("3", "1", NA, "3", "3", "1", NA, "1", NA, "3", "3", "3", "3", NA, "1", "3", "3", "3", "1", "3"), CUST_LIFESTAGE = c("3", "6", NA, "3", "3", "6", NA, "6", NA, "3", "3", "3", "3", NA, "6", "3", "3", "3", "6", "3"), BASKET_ID = c("1964", "2690", "680", "1964", "1964", "2689", "687", "2690", "687", "1964", "1964", "1964", "1964", "680", "2689", "1964", "1964", "1964", "2690", "1964"), BASKET_SIZE = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L), .Label = c("L", "M", "S"), class = "factor"), BASKET_PRICE_SENSITIVITY = structure(c(2L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L), .Label = c("LA", "MM", "UM", "XX"), class = "factor"),  BASKET_TYPE = structure(c(1L, 3L, 3L, 1L, 1L, 2L, 2L, 3L,  2L, 1L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 1L), .Label = c("Full Shop",  "Small Shop", "Top Up", "XX"), class = "factor"), BASKET_DOMINANT_MISSION = structure(c(3L,  1L, 2L, 3L, 3L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 2L, 1L, 3L,  3L, 3L, 1L, 3L), .Label = c("Fresh", "Grocery", "Mixed",  "Nonfood", "XX"), class = "factor"), STORE_CODE = c("1",  "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",  "1", "1", "1", "1", "1", "1", "1"), STORE_FORMAT = structure(c(1L,  1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  1L, 1L, 1L, 1L), .Label = c("LS", "MS", "SS", "XLS"), class = "factor"),  STORE_REGION = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,  2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("E01",  "E02", "E03", "N01", "N02", "N03", "S01", "S02", "S03", "W01",  "W02", "W03"), class = "factor")), .Names = c("SHOP_WEEK", "SHOP_DATE", "SHOP_WEEKDAY", "SHOP_HOUR", "QUANTITY", "SPEND", "PROD_CODE", "PROD_CODE_10", "PROD_CODE_20", "PROD_CODE_30", "PROD_CODE_40", "CUST_CODE", "CUST_PRICE_SENSITIVITY", "CUST_LIFESTAGE", "BASKET_ID", "BASKET_SIZE", "BASKET_PRICE_SENSITIVITY", "BASKET_TYPE", "BASKET_DOMINANT_MISSION", "STORE_CODE", "STORE_FORMAT", "STORE_REGION"), row.names = c(NA, 20L), class = "data.frame") 

Hier ist meine aktuelle str:

> str(f) 
'data.frame': 25241 obs. of 22 variables: 
$ SHOP_WEEK    : int 200607 200607 200607 200607 200607 200607 200607 200607 
200607 200607 ... 
$ SHOP_DATE    : int 20060415 20060413 20060416 20060415 20060415 20060412 
20060413 20060413 20060413 20060415 ... 
$ SHOP_WEEKDAY   : int 7 5 1 7 7 4 5 5 5 7 ... 
$ SHOP_HOUR    : int 19 20 14 19 19 19 18 20 18 19 ... 
$ QUANTITY    : int 1 1 1 1 1 1 1 3 1 1 ... 
$ SPEND     : num 0.93 1.03 0.98 3.07 4.81 0.28 1.56 0.84 1.09 1.62 ... 
$ PROD_CODE    : chr "26" "70" "88" "99" ... 
$ PROD_CODE_10   : chr "188" "1" "61" "188" ... 
$ PROD_CODE_20   : chr "64" "1" "19" "64" ... 

Und so weiter ...

Ohne Erfolg, ich habe versucht, verschiedene Optionen, wie eine derartige Einstellung:

strOptions(vec.length=2,strict.width=T) # Works for factors only, not ints 
options(width=83) # Still puts the extra chars on another line 
str(f,vec.length=2) 

Wie setze ich die String-Optionen richtig?

+0

hey was ist der Wert von 'getOption ("width")' –

Antwort

0

Können Sie versuchen, die Breite Einstellung wie dieser

options(width=as.integer(value))

oder wie diese

options("width"= value)

+0

'Optionen ("width") 'setzt die Zeichen auf eine Rückkehr, begrenzt die Ausgabe nicht, auch wenn' strOptions (strict.width = T) 'gesetzt ist. Mit dem gesagt, ich habe es versucht, aber es hat nicht funktioniert. Danke für die Hilfe tho. Der Hauptpunkt in meinem Beitrag ist das Einstellen von Optionen in den 'strOptions' scheint nicht zu funktionieren. –

+0

'Optionen (width = as.integer (Wert))' hat nicht so gut funktioniert? –

+0

können Sie versuchen, dies in ~/.Rprofile zu setzen –

Verwandte Themen