Skip to main content
deleted 11 characters in body
Source Link
dat <- data.frame(matrix(sample(0:13, 300 * 26, replace = TRUE), ncol = 26))
dat$age50 <- sample(c("yes", "no"), 300, replace = TRUE)

# Create state sequence object
cci.seq <- seqdef(dat, 
                  var = 1:26, 
                  alphabet = c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "99"))

# Recode the sequence object
cci.new <- seqrecode(cci.seq, 
                     recodes = list("0 CCI" = "0", 
                                    "1-2 CCI" = c("1", "2"), 
                                    "3-4 CCI" = c("3", "4"), 
                                    "5-6 CCI" = c("5", "6"),
                                    "7-8 CCI" = c("7", "8"), 
                                    "10+ CCI" = c("9", "10", "11", "12", "13"), 
                                    "death" = c("99")))

# Define color palette
cpal(cci.new) <- c("#CAE1EE", "#0772b4", "#f2c673", "#df3337", "#f29862", "#2fa791", "#8A2BE2")

# Basic plot
seqIplot(cci.new, 
         with.legend = TRUE,
         bty = "n",
         idxs = 1:300,
         group = dat$disability_age50dat$age50,
         legend.prop = 0.1,
ncol=2,
         main = "300 individual sequences by disability status")
dat <- data.frame(matrix(sample(0:13, 300 * 26, replace = TRUE), ncol = 26))
dat$age50 <- sample(c("yes", "no"), 300, replace = TRUE)

# Create state sequence object
cci.seq <- seqdef(dat, 
                  var = 1:26, 
                  alphabet = c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "99"))

# Recode the sequence object
cci.new <- seqrecode(cci.seq, 
                     recodes = list("0 CCI" = "0", 
                                    "1-2 CCI" = c("1", "2"), 
                                    "3-4 CCI" = c("3", "4"), 
                                    "5-6 CCI" = c("5", "6"),
                                    "7-8 CCI" = c("7", "8"), 
                                    "10+ CCI" = c("9", "10", "11", "12", "13"), 
                                    "death" = c("99")))

# Define color palette
cpal(cci.new) <- c("#CAE1EE", "#0772b4", "#f2c673", "#df3337", "#f29862", "#2fa791", "#8A2BE2")

# Basic plot
seqIplot(cci.new, 
         with.legend = TRUE,
         bty = "n",
         idxs = 1:300,
         group = dat$disability_age50,
         legend.prop = 0.1,
ncol=2,
         main = "300 individual sequences by disability status")
dat <- data.frame(matrix(sample(0:13, 300 * 26, replace = TRUE), ncol = 26))
dat$age50 <- sample(c("yes", "no"), 300, replace = TRUE)

# Create state sequence object
cci.seq <- seqdef(dat, 
                  var = 1:26, 
                  alphabet = c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "99"))

# Recode the sequence object
cci.new <- seqrecode(cci.seq, 
                     recodes = list("0 CCI" = "0", 
                                    "1-2 CCI" = c("1", "2"), 
                                    "3-4 CCI" = c("3", "4"), 
                                    "5-6 CCI" = c("5", "6"),
                                    "7-8 CCI" = c("7", "8"), 
                                    "10+ CCI" = c("9", "10", "11", "12", "13"), 
                                    "death" = c("99")))

# Define color palette
cpal(cci.new) <- c("#CAE1EE", "#0772b4", "#f2c673", "#df3337", "#f29862", "#2fa791", "#8A2BE2")

# Basic plot
seqIplot(cci.new, 
         with.legend = TRUE,
         bty = "n",
         idxs = 1:300,
         group = dat$age50,
         legend.prop = 0.1,
ncol=2,
         main = "300 individual sequences by disability status")
added 1105 characters in body
Source Link

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend command but I do not understand how I would integrate the separate legend into my plots. I have 7 different states in my sequence.

i<dat <- data.frame(matrix(sample(0:13, 300 * 26, replace = TRUE), ncol = 26))
dat$age50 <- sample(c("yes", "no"), 300, replace = TRUE)

# Create state sequence object
cci.seq <- seqdef(dat, 
                  var = 1:26, 
                  alphabet = c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "99"))

# Recode the sequence object
cci.new <- seqrecode(cci.seq, 
                     recodes = list("0 CCI" = "0", 
                                    "1-2 CCI" = c("1", "2"), 
                                    "3-4 CCI" = c("3", "4"), 
                                    "5-6 CCI" = c("5", "6"),
                                    "7-8 CCI" = c("7", "8"), 
                                    "10+ CCI" = c("9", "10", "11", "12", "13"), 
                                    "death" = c("99")))

# Define color palette
cpal(cci.new) <- c("#CAE1EE", "#0772b4", "#f2c673", "#df3337", "#f29862", "#2fa791", "#8A2BE2")

# Basic plot
seqIplot(cci.new, 
         with.legend="TRUE",legend = TRUE,
         bty="n"bty = "n",
         idxs=1idxs = 1:300,
         group=dat$disability_age50group = dat$disability_age50,
         legend.prop = 0.1,
ncol=2,
         main = "300 individual sequences by disability status")

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend command but I do not understand how I would integrate the separate legend into my plots. I have 7 different states in my sequence.

i<- seqIplot(cci.new, 
         with.legend="TRUE", 
         bty="n",
         idxs=1:300,
         group=dat$disability_age50)

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend command but I do not understand how I would integrate the separate legend into my plots.

dat <- data.frame(matrix(sample(0:13, 300 * 26, replace = TRUE), ncol = 26))
dat$age50 <- sample(c("yes", "no"), 300, replace = TRUE)

# Create state sequence object
cci.seq <- seqdef(dat, 
                  var = 1:26, 
                  alphabet = c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "99"))

# Recode the sequence object
cci.new <- seqrecode(cci.seq, 
                     recodes = list("0 CCI" = "0", 
                                    "1-2 CCI" = c("1", "2"), 
                                    "3-4 CCI" = c("3", "4"), 
                                    "5-6 CCI" = c("5", "6"),
                                    "7-8 CCI" = c("7", "8"), 
                                    "10+ CCI" = c("9", "10", "11", "12", "13"), 
                                    "death" = c("99")))

# Define color palette
cpal(cci.new) <- c("#CAE1EE", "#0772b4", "#f2c673", "#df3337", "#f29862", "#2fa791", "#8A2BE2")

# Basic plot
seqIplot(cci.new, 
         with.legend = TRUE,
         bty = "n",
         idxs = 1:300,
         group = dat$disability_age50,
         legend.prop = 0.1,
ncol=2,
         main = "300 individual sequences by disability status")
deleted 28 characters in body
Source Link
Adriaan
  • 18.2k
  • 7
  • 43
  • 79

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend command but I do not understand how I would integrate the separate legend into my plots. I have 7 different states in my sequence.

    i<- seqIplot(cci.new, 
             with.legend="TRUE", 
             bty="n",
             idxs=1:300,
             group=dat$disability_age50)

Thank you!

i<- seqIplot(cci.new, 
         with.legend="TRUE", 
         bty="n",
         idxs=1:300,
         group=dat$disability_age50)

I have tried adjusting the cex.legend but it makes the text too small to read.

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend command but I do not understand how I would integrate the separate legend into my plots. I have 7 different states in my sequence.

    i<- seqIplot(cci.new, 
             with.legend="TRUE", 
             bty="n",
             idxs=1:300,
             group=dat$disability_age50)

Thank you!

I have tried adjusting the cex.legend but it makes the text too small to read.

I am new to using TramineR and I just cannot seem to figure out how to arrange the legend in any of the plot types. The legend keeps being cut off by the plots. I have tried to use the seqlegend command but I do not understand how I would integrate the separate legend into my plots. I have 7 different states in my sequence.

i<- seqIplot(cci.new, 
         with.legend="TRUE", 
         bty="n",
         idxs=1:300,
         group=dat$disability_age50)

I have tried adjusting the cex.legend but it makes the text too small to read.

Source Link
Loading