ggseqplot with subset of data and adjusting x-axis

Hi,

I am trying to use -ggseqiplot- to plot sequence analysis data. I am new to R and having some trouble.

  1. grouping within subset of the data

    I have managed to plot the full sample, but would like to group by race/ethnicity groups within each age 
    group. This would create 4 separate race/ethnicity graphs for each of the 4 age groups. 
    
  2. Adjusting the x-axis

    Currently I have my x-axis in months (1-120) I would like these to be in years and labeled 1-10
    

Any help is appreciated.

Can you provide the code you are using and some sample data?

See FAQ Asking Questions

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here.

With a bit of data it should be fairly straight-forward to [0lsee what you need.

I cannot share my data because it is restricted, but here is sample data. I would like to use this data to produce faceted sequence index plots for each marital status ("single, never married", "married", "separated", "divorced", "widower/widow") within each age group (18-44, 45-64, 65-74, & 75+)

dput(head(actcal, 100))
structure(list(idhous00 = c(76241, 130451, 86531, 68201, 49581,
46521, 117761, 84491, 4641, 118531, 40161, 114481, 23581, 25521,
111411, 71921, 55521, 14551, 103471, 81621, 29581, 128181, 134981,
111201, 96871, 66831, 25661, 71471, 18461, 29271, 43181, 40151,
106971, 44381, 9611, 91041, 89611, 115121, 120371, 99561, 62101,
88901, 27611, 19541, 2101, 121901, 34111, 108021, 62061, 20941,
94851, 117271, 43831, 89231, 110591, 17661, 108821, 89971, 98221,
24401, 102341, 51091, 76361, 87811, 2341, 49341, 89971, 101781,
34091, 125511, 110891, 101051, 112441, 13731, 76031, 65311, 121971,
14961, 90311, 6211, 122031, 22961, 80511, 17731, 20911, 86381,
125621, 25691, 44671, 67011, 63271, 126421, 86831, 116941, 58171,
136961, 115251, 7751, 119771, 141931), age00 = c(57L, 39L, 25L,
54L, 42L, 62L, 18L, 54L, 14L, 33L, 47L, 20L, 43L, 33L, 30L, 41L,
38L, 64L, 21L, 34L, 41L, 47L, 35L, 43L, 59L, 65L, 76L, 68L, 47L,
18L, 31L, 75L, 55L, 47L, 42L, 39L, 14L, 55L, 45L, 46L, 26L, 70L,
41L, 45L, 37L, 53L, 16L, 14L, 35L, 30L, 59L, 58L, 47L, 50L, 34L,
64L, 41L, 40L, 64L, 17L, 66L, 86L, 42L, 50L, 77L, 63L, 38L, 34L,
32L, 35L, 21L, 44L, 57L, 75L, 63L, 53L, 38L, 41L, 31L, 61L, 52L,
46L, 40L, 53L, 34L, 23L, 36L, 45L, 35L, 57L, 75L, 52L, 17L, 45L,
31L, 15L, 48L, 39L, 34L, 51L), educat00 = structure(c(17L, 13L,
15L, 13L, 15L, 13L, 10L, 13L, 9L, 14L, 16L, 10L, 16L, 13L, 18L,
18L, 15L, 13L, 15L, 19L, 13L, 15L, 13L, 19L, 10L, 15L, 15L, 14L,
13L, 10L, 13L, 10L, 13L, 15L, 18L, 15L, 10L, 10L, 13L, 13L, 13L,
14L, 15L, 13L, 13L, 19L, 10L, 9L, 15L, 15L, 13L, 19L, 13L, 13L,
13L, 13L, 11L, 16L, 14L, 10L, 13L, 13L, 11L, 19L, 15L, 13L, 15L,
17L, 13L, 19L, 13L, 10L, 15L, 11L, 13L, 16L, 16L, 10L, 13L, 14L,
19L, 10L, 14L, 13L, 10L, 13L, 19L, 17L, 19L, 13L, 10L, 11L, 10L,
14L, 13L, 9L, 18L, 13L, 15L, 13L), levels = c("other error",
"filter error", "specialized school, handicapped", "pre-obligatory schooling",
"not yet school age", "inapplicable", "no answer", "does not know",
"incomplete compulsory school", "compulsory school, elementary vocational training",
"domestic science course, 1 year school of commerce", "general training school",
"apprenticeship", "full-time vocational school", "maturity",
"vocational high education", "technical or vocational school",
"vocational high school", "university, higher specialized school"
), class = "factor"), civsta00 = structure(c(7L, 6L, 6L, 7L,
7L, 7L, 6L, 7L, 6L, 7L, 7L, 6L, 7L, 7L, 7L, 7L, 7L, 10L, 6L,
7L, 7L, 7L, 9L, 7L, 7L, 7L, 7L, 9L, 7L, 6L, 7L, 7L, 9L, 7L, 9L,
7L, 6L, 7L, 6L, 7L, 7L, 7L, 6L, 9L, 6L, 7L, 6L, 6L, 7L, 6L, 7L,
7L, 7L, 8L, 6L, 8L, 6L, 7L, 7L, 6L, 6L, 10L, 7L, 9L, 7L, 7L,
7L, 7L, 9L, 7L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 6L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 6L, 7L, 9L, 7L, 7L, 7L, 7L, 6L, 7L, 7L, 6L, 7L, 7L,
6L, 10L), levels = c("other error", "filter error", "inapplicable",
"no answer", "does not know", "single, never married", "married",
"separated", "divorced", "widower/widow"), class = "factor"),
nbadul00 = c(4L, 2L, 3L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 2L,
4L, 2L, 2L, 2L, 2L, 2L, 1L, 3L, 2L, 2L, 3L, 2L, 3L, 2L, 1L,
2L, 1L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 5L, 2L, 1L, 3L, 2L,
3L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 4L, 3L, 2L, 2L, 1L, 2L,
1L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 3L,
3L, 2L, 2L, 2L, 5L, 2L, 3L, 2L, 2L, 3L, 4L, 2L, 3L, 2L, 5L,
2L, 2L, 2L, 3L, 2L, 2L, 3L, 2L, 2L, 2L, 3L, 2L, 2L, 3L),
nbkid00 = c(0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 2L, 0L, 0L,
0L, 2L, 1L, 1L, 3L, 0L, 0L, 2L, 3L, 2L, 2L, 1L, 0L, 0L, 0L,
0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 3L, 1L, 0L, 0L, 0L, 2L, 0L,
0L, 1L, 0L, 0L, 2L, 2L, 1L, 0L, 0L, 0L, 2L, 0L, 0L, 0L, 0L,
2L, 0L, 2L, 0L, 0L, 2L, 0L, 0L, 0L, 2L, 1L, 2L, 0L, 0L, 3L,
0L, 0L, 0L, 0L, 2L, 0L, 2L, 0L, 0L, 0L, 4L, 0L, 2L, 0L, 2L,
2L, 1L, 0L, 0L, 0L, 1L, 2L, 2L, 4L, 1L, 3L, 0L, 0L), aoldki00 = c(-3L,
-3L, -3L, -3L, 9L, -3L, 16L, -3L, 14L, 5L, -3L, -3L, -3L,
2L, 1L, 12L, 14L, -3L, -3L, 4L, 11L, 17L, 13L, 15L, -3L,
-3L, -3L, -3L, 17L, 14L, -3L, -3L, -3L, -3L, -3L, 10L, 14L,
-3L, -3L, -3L, 2L, -3L, -3L, 14L, -3L, -3L, 17L, 15L, 0L,
-3L, -3L, -3L, 9L, -3L, -3L, -3L, -3L, 7L, -3L, 17L, -3L,
-3L, 15L, -3L, -3L, -3L, 7L, 4L, 9L, -3L, -3L, 17L, -3L,
-3L, -3L, -3L, 8L, -3L, 2L, -3L, -3L, -3L, 7L, -3L, 7L, -3L,
7L, 17L, 2L, -3L, -3L, -3L, 17L, 17L, 5L, 16L, 16L, 11L,
-3L, -3L), ayouki00 = c(-3L, -3L, -3L, -3L, 9L, -3L, 16L,
-3L, 14L, 2L, -3L, -3L, -3L, 0L, 1L, 12L, 8L, -3L, -3L, 2L,
6L, 13L, 9L, 15L, -3L, -3L, -3L, -3L, 17L, 14L, -3L, -3L,
-3L, -3L, -3L, 6L, 14L, -3L, -3L, -3L, 0L, -3L, -3L, 14L,
-3L, -3L, 16L, 14L, 0L, -3L, -3L, -3L, 7L, -3L, -3L, -3L,
-3L, 5L, -3L, 12L, -3L, -3L, 13L, -3L, -3L, -3L, 5L, 4L,
7L, -3L, -3L, 16L, -3L, -3L, -3L, -3L, 5L, -3L, 1L, -3L,
-3L, -3L, 5L, -3L, 2L, -3L, 3L, 14L, 2L, -3L, -3L, -3L, 17L,
14L, 2L, 11L, 16L, 5L, -3L, -3L), region00 = structure(c(9L,
9L, 10L, 8L, 6L, 6L, 6L, 10L, 6L, 6L, 11L, 6L, 8L, 9L, 9L,
8L, 7L, 7L, 8L, 9L, 9L, 9L, 10L, 9L, 7L, 7L, 9L, 8L, 7L,
9L, 12L, 11L, 8L, 12L, 7L, 11L, 11L, 6L, 6L, 7L, 7L, 10L,
9L, 8L, 6L, 7L, 10L, 8L, 7L, 8L, 12L, 6L, 12L, 10L, 9L, 7L,
8L, 11L, 7L, 8L, 7L, 6L, 9L, 10L, 6L, 6L, 11L, 7L, 10L, 6L,
9L, 7L, 9L, 7L, 9L, 7L, 7L, 7L, 11L, 6L, 7L, 8L, 9L, 7L,
8L, 10L, 6L, 9L, 12L, 7L, 7L, 6L, 10L, 6L, 7L, 10L, 6L, 6L,
6L, 11L), levels = c("other error", "filter error", "inapplicable",
"no answer", "does not know", "Lake Geneva (VD, VS, GE)",
"Middleland (BE, FR, SO, NE, JU)", "North-west Switzerland (BS, BL, AG)",
"Zurich", "East Switzerland (GL, SH, AR, AI, SG, GR, TG)",
"Central Switzerland (LU, UR, SZ, OW, NW, ZG)", "Ticino"
), class = "factor"), com2.00 = structure(c(7L, 8L, 11L,
7L, 11L, 6L, 9L, 9L, 8L, 7L, 12L, 10L, 7L, 6L, 8L, 7L, 12L,
7L, 6L, 7L, 9L, 12L, 13L, 7L, 12L, 7L, 7L, 6L, 9L, 7L, 6L,
13L, 7L, 8L, 6L, 6L, 11L, 11L, 7L, 9L, 6L, 6L, 8L, 8L, 7L,
6L, 6L, 11L, 11L, 7L, 9L, 7L, 8L, 9L, 7L, 6L, 13L, 11L, 7L,
7L, 7L, 7L, 9L, 6L, 9L, 11L, 11L, 14L, 6L, 7L, 8L, 13L, 7L,
6L, 6L, 13L, 11L, 12L, 13L, 11L, 7L, 9L, 7L, 6L, 7L, 11L,
9L, 12L, 8L, 7L, 13L, 11L, 13L, 7L, 6L, 10L, 9L, 12L, 8L,
6L), levels = c("other error", "filter error", "inapplicable",
"no answer", "does not know", "Centres", "Suburban communes",
"Wealthy communes", "Peripheral urban communes", "Tourist communes",
"Industrial and tertiary sector communes", "Rural commuter communes",
"Mixed agricultural communes", "Peripheral agricultural communes"
), class = "factor"), sex = structure(c(6L, 7L, 6L, 7L, 7L,
6L, 6L, 7L, 7L, 7L, 7L, 6L, 6L, 7L, 6L, 7L, 7L, 6L, 7L, 6L,
6L, 7L, 7L, 7L, 7L, 6L, 7L, 7L, 7L, 6L, 7L, 7L, 7L, 6L, 6L,
6L, 6L, 6L, 7L, 6L, 7L, 6L, 6L, 7L, 6L, 7L, 7L, 6L, 7L, 7L,
6L, 7L, 6L, 6L, 6L, 6L, 7L, 6L, 7L, 6L, 7L, 7L, 7L, 7L, 7L,
6L, 7L, 6L, 7L, 6L, 7L, 7L, 6L, 7L, 6L, 7L, 6L, 6L, 6L, 6L,
6L, 6L, 7L, 6L, 7L, 6L, 7L, 7L, 6L, 7L, 6L, 7L, 6L, 7L, 6L,
6L, 6L, 6L, 7L, 7L), levels = c("other error", "filter error",
"inapplicable", "no answer", "does not know", "man", "woman"
), class = "factor"), birthy = c(1943L, 1961L, 1975L, 1946L,
1958L, 1938L, 1982L, 1946L, 1986L, 1967L, 1953L, 1980L, 1957L,
1967L, 1970L, 1959L, 1962L, 1936L, 1979L, 1966L, 1959L, 1953L,
1965L, 1957L, 1941L, 1935L, 1924L, 1932L, 1953L, 1982L, 1969L,
1925L, 1945L, 1953L, 1958L, 1961L, 1986L, 1945L, 1955L, 1954L,
1974L, 1930L, 1959L, 1955L, 1963L, 1947L, 1984L, 1986L, 1965L,
1970L, 1941L, 1942L, 1953L, 1950L, 1966L, 1936L, 1959L, 1960L,
1936L, 1983L, 1934L, 1914L, 1958L, 1950L, 1923L, 1937L, 1962L,
1966L, 1968L, 1965L, 1979L, 1956L, 1943L, 1925L, 1937L, 1947L,
1962L, 1959L, 1969L, 1939L, 1948L, 1954L, 1960L, 1947L, 1966L,
1977L, 1964L, 1955L, 1965L, 1943L, 1925L, 1948L, 1983L, 1955L,
1969L, 1985L, 1952L, 1961L, 1966L, 1949L), jan00 = structure(c(6L,
9L, 8L, 7L, 7L, 6L, 9L, 7L, 9L, 7L, 8L, 9L, 6L, 9L, 6L, 7L,
8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 9L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 6L, 8L,
6L, 7L, 6L, 6L, 7L, 9L, 8L, 9L, 7L, 6L, 9L, 6L, 6L, 6L, 9L
), levels = c("-8", "-7", "-3", "-2", "-1", "A", "B", "C",
"D"), class = "factor"), jun00 = structure(c(6L, 9L, 8L,
7L, 7L, 6L, 8L, 7L, 9L, 7L, 8L, 9L, 6L, 9L, 6L, 7L, 8L, 9L,
8L, 6L, 6L, 8L, 8L, 7L, 9L, 6L, 9L, 8L, 7L, 9L, 7L, 9L, 6L,
6L, 6L, 6L, 9L, 6L, 6L, 6L, 9L, 9L, 6L, 7L, 6L, 7L, 9L, 9L,
9L, 6L, 6L, 7L, 6L, 6L, 6L, 8L, 7L, 6L, 9L, 6L, 9L, 9L, 8L,
8L, 9L, 9L, 9L, 6L, 7L, 6L, 6L, 9L, 6L, 9L, 9L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 7L, 6L, 8L, 6L, 7L, 6L, 6L, 7L, 9L, 8L, 9L,
7L, 6L, 9L, 6L, 6L, 6L, 9L), levels = c("-8", "-7", "-3",
"-2", "-1", "A", "B", "C", "D"), class = "factor"), jul00 = structure(c(6L,
9L, 8L, 7L, 7L, 6L, 8L, 7L, 9L, 7L, 8L, 9L, 6L, 9L, 6L, 7L,
8L, 9L, 8L, 6L, 6L, 8L, 8L, 7L, 9L, 6L, 9L, 8L, 7L, 9L, 7L,
9L, 6L, 6L, 6L, 6L, 8L, 6L, 6L, 6L, 8L, 9L, 6L, 7L, 6L, 7L,
9L, 9L, 9L, 6L, 6L, 7L, 6L, 6L, 6L, 9L, 7L, 6L, 9L, 6L, 9L,
9L, 8L, 8L, 9L, 9L, 9L, 6L, 7L, 6L, 6L, 9L, 6L, 9L, 9L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 7L, 6L, 8L, 6L, 9L, 6L, 6L, 7L, 9L,
8L, 9L, 7L, 6L, 9L, 6L, 6L, 6L, 9L), levels = c("-8", "-7",
"-3", "-2", "-1", "A", "B", "C", "D"), class = "factor"),
aug00 = structure(c(6L, 9L, 8L, 7L, 7L, 6L, 8L, 7L, 9L, 7L,
9L, 9L, 6L, 9L, 6L, 7L, 8L, 9L, 8L, 6L, 6L, 8L, 8L, 7L, 9L,
6L, 9L, 8L, 7L, 9L, 7L, 9L, 6L, 6L, 6L, 6L, 9L, 6L, 6L, 6L,
9L, 9L, 6L, 7L, 6L, 7L, 9L, 9L, 8L, 6L, 6L, 7L, 6L, 6L, 6L,
9L, 7L, 6L, 9L, 6L, 9L, 9L, 8L, 8L, 9L, 9L, 9L, 6L, 7L, 6L,
6L, 9L, 6L, 9L, 9L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 6L, 8L,
6L, 9L, 6L, 6L, 7L, 9L, 8L, 9L, 7L, 6L, 9L, 6L, 6L, 6L, 9L
), levels = c("-8", "-7", "-3", "-2", "-1", "A", "B", "C",
"D"), class = "factor"), sep00 = structure(c(6L, 9L, 8L,
7L, 7L, 6L, 8L, 7L, 9L, 7L, 9L, 9L, 6L, 9L, 6L, 7L, 8L, 9L,
8L, 6L, 6L, 8L, 8L, 7L, 9L, 6L, 9L, 8L, 7L, 9L, 7L, 9L, 6L,
6L, 6L, 6L, 9L, 6L, 6L, 6L, 9L, 9L, 6L, 7L, 6L, 7L, 9L, 9L,
8L, 6L, 6L, 6L, 6L, 6L, 6L, 8L, 7L, 6L, 9L, 6L, 9L, 9L, 8L,
8L, 9L, 9L, 9L, 6L, 7L, 6L, 6L, 9L, 6L, 9L, 9L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 7L, 6L, 8L, 6L, 9L, 6L, 6L, 7L, 9L, 8L, 9L,
7L, 6L, 9L, 6L, 6L, 6L, 9L), levels = c("-8", "-7", "-3",
"-2", "-1", "A", "B", "C", "D"), class = "factor"), oct00 = structure(c(6L,
9L, 8L, 7L, 7L, 6L, 9L, 7L, 9L, 7L, 9L, 9L, 6L, 9L, 6L, 7L,
8L, 9L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9L, 9L,
8L, 9L, 6L, 7L, 6L, 6L, 6L, 6L, 7L, 6L, 9L, 6L, 9L, 9L, 8L,
8L, 9L, 9L, 9L, 6L, 7L, 6L, 6L, 9L, 6L, 9L, 9L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 7L, 6L, 8L, 6L, 9L, 6L, 6L, 7L, 9L, 8L, 9L,
7L, 6L, 9L, 6L, 6L, 6L, 8L), levels = c("-8", "-7", "-3",
"-2", "-1", "A", "B", "C", "D"), class = "factor")), row.names = c(3649L,
6274L, 4130L, 3236L, 2302L, 2172L, 5671L, 4039L, 153L, 5712L,
1879L, 5506L, 1139L, 1238L, 5378L, 3438L, 2581L, 680L, 4960L,
3907L, 1417L, 6181L, 6453L, 5369L, 4581L, 3158L, 1248L, 3412L,
892L, 1405L, 2004L, 1878L, 5138L, 2070L, 400L, 4342L, 4276L,
5517L, 5788L, 4740L, 2928L, 4225L, 1339L, 956L, 45L, 5877L, 1600L,
5200L, 2925L, 1019L, 4504L, 5644L, 2039L, 4254L, 5345L, 843L,
5248L, 4294L, 4653L, 1188L, 4899L, 2365L, 3659L, 4186L, 57L,
2289L, 4295L, 4874L, 1597L, 6055L, 5358L, 4839L, 5424L, 648L,
3634L, 3064L, 5879L, 706L, 4317L, 226L, 5881L, 1102L, 3854L,
847L, 1017L, 4114L, 6062L, 1250L, 2088L, 3168L, 2967L, 6109L,
4140L, 5629L, 2724L, 6533L, 5531L, 306L, 5766L, 6793L), class = "data.frame")

Thanks. It is too late here for me to look at it but with any luck some one will have a solution in no time.

I definitely was not awake last night. We really need your code. I have loaded the sample data and it seems fine.

Just copy the code and paste it here between
```

```

Hi,

Thank you for your help. I have managed to figured out the first question I had, but could still use some help on the second. Currently the x-axis is in months (e.g. mon1-mon120). I would like to adjust it so the tick marks are every 12 months and be labeled in years (1, 2, 3, etc.). I will post my current code and an example graph.

  ggseqiplot(age1seq, sortv = "from.end", group = agegrp1$race4cat)

Someone may be able to help from that code snippet but we really need to see the complete code for the plot command.

Sorry, Iā€™m not sure what other plot command you are talking about. The only other code I have is loading the data and defining the sequence.

I meant the ggseqiplot command IIRC. Sorry to be so late responding.

Below you find a suggestion for a scenario similar to yours. You have to use ggplot2's scale_x_discrete function to adjust the labeling of the axis. In the code snippet, I break the axis in the middle of each quarter and apply the according labels. You could proceed in a similar fashion with your data (e.g. breaks = seq(6,120,12), labels = 2010:2019).

library(TraMineR)
#> Warning: package 'TraMineR' was built under R version 4.2.3
#> 
#> TraMineR stable version 2.2-7 (Built: 2023-05-01)
#> Website: http://traminer.unige.ch
#> Please type 'citation("TraMineR")' for citation information.
library(ggseqplot)
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.2.3

# actcal data set
data(actcal)

# We use only a sample of 300 cases
set.seed(1)
actcal <- actcal[sample(nrow(actcal), 300), ]
actcal.lab <- c("> 37 hours", "19-36 hours", "1-18 hours", "no work")
actcal.seq <- seqdef(actcal, 13:24, labels = actcal.lab)
#>  [>] 4 distinct states appear in the data:
#>      1 = A
#>      2 = B
#>      3 = C
#>      4 = D
#>  [>] state coding:
#>        [alphabet]  [label]  [long label]
#>      1  A           A        > 37 hours
#>      2  B           B        19-36 hours
#>      3  C           C        1-18 hours
#>      4  D           D        no work
#>  [>] 300 sequences in the data set
#>  [>] min/max sequence length: 12/12

ggseqiplot(actcal.seq, group = actcal$sex, sortv = actcal$age00) +
  scale_x_discrete(breaks = seq(2,12,3),
                   labels = paste0("Q",1:4))
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.

rGkOGII

Created on 2023-09-15 with reprex v2.0.2

Thank you so much! I was actually going to reach out to you personally! Have a wonderful day!

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.