• Register
0 votes
212 views

Problem :

I want to use the TraMineR's (version 1.8.4) seqdef-funciton to define the sequence object, however I always face the following error message which is completely senseless to me:

Error in row.names<-.data.frame(*tmp*, value = value) : invalid 'row.names' length

My code input is as follows:

sample.sts <- seqdef(sample, var=d("jan2005", "feb2005", "mar2005", "apr2005", "may2005", 
"jun2005", "jul2005", "aug2005", "sep2005", "oct2005", "nov2005", "dec2005"),  
alphabet=d("Employee (full-time)", "Employee (part-time)", 
"Self-employed (full-time)", "Self-employed (part-time)", "unemployed", "Retired", 
"Student", "Other inactive", "Compulsory military service"), 
states=d("EF", "EP", "SF", "SP", "UE", "RE", "ST", "IA", "MS"), id="pidc")

 

The whole output says:

[>] 3266 sequences in the data set
[>] min/max sequence length: 12/12
Fehler in row.names<-.data.frame(*tmp*, value = value) :
invalid 'row.names' length

I again tried running it after re-labeling the states without "-", but it does not affect the error. Does someone knows what causes this error?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

The "id" argument of seqdef should be the vector containing only one entry per sequences (e.g. The length of id vector should be equal to the number of sequences). You should try using id=as.character(sample$pid) Or you can also try id=sample$pid but without as.character

I can see that there are some mismatch between the states in the data and the alphabet argument since the "-" was replaced by ".". Now you should probably try to change the alphabet argument

9 7 4
38,600 points

Related questions

0 votes
1 answer 63 views
63 views
Problem : Getting following error related to r error in `row.names<-.data.frame`(`*tmp*`, value = value) : duplicate 'row.names' are not allowed
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
2 answers 1.3K views
1.3K views
Problem : I am facing below error and I am unable to understand the meaning of the error. All my variable names are correct and there are no typing errors. Does anybody faced this issue before any solution on it? My erroneous code : datNewagg <- aggregate (dataNew, by = ... mean) It gives following error : Error in aggregate.data.frame(datNew, by = list("x", "y", : arguments must have same length
asked Dec 6, 2019 alecxe 7.5k points
0 votes
1 answer 1.8K views
1.8K views
Problem : I have been facing below error message and traceback: Error in FUN(X[[i]], ...) : only defined on the data frame with all numeric variables 5 stop("only defined on the data frame with all numeric variables") 4 FUN(X[[i]], ...) 3 lapply(args, ... .numeric(data[good,]) But now I get the different error message back as below : "Error: (list) object cannot be coerced to type 'double'"
asked Dec 16, 2019 alecxe 7.5k points
0 votes
1 answer 1.3K views
1.3K views
Problem : When ever i use the predict glmnet function i get the below mentioned error error in cbind2(1, newx) %*% nbeta : not-yet-implemented method for <data.frame> %*% <dgcmatrix>
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
2 answers 1.1K views
1.1K views
Problem : I am looking for the function with the parameters such as data name as (mydata), factor as (myfactor) and variable names such as (myvar) to dynamically generate the histograms as I have to use them in lattice. I tried to do as mentioned above but error appears ... of type 'character'. I think the program doesn't know where to look for this myf` string. How should I fix this issue?
asked Dec 23, 2019 alecxe 7.5k points
1 vote
1 answer 1.7K views
1.7K views
Problem : I am facing following error : formula(formula, data = data) : invalid model formula in ExtractVars I am using the below code: install.packages("rpart") library("rpart") # you must change the below from windows to work on your linux box: mydata <- read.csv(file="c ... file to commas. I guess it is unable to read the data correctly. I am very new to the R and also a very new programmer.
asked Dec 14, 2019 alecxe 7.5k points
1 vote
1 answer 729 views
729 views
Problem: I have limited knowledge of R and ggplot. I have recently written a function and trying to run the function as shown below: ggplot(datfr, aes(x = dat1[1:951,], y = dat2[1:951,])) + geom_point() After executing above function I am facing below error: Don't ... and when I try to use nrow on my two datasets it again returns the same number of rows. How can I fix above ggplot related error.
asked May 26, 2020 Martin K 6.6k points
0 votes
1 answer 716 views
716 views
Problem : I am trying to merge data in R but facing following error error in fix.by(by.x, x) : 'by' must specify one or more columns as numbers, names or logical
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
1 answer 379 views
379 views
Problem : I want to select some columns from my data frame by the use of below code: library(dplyr) dv %>% select(LGA) select(dv, LGA) Both of them are failing with below error : Unable to find an inherited method for function select' for signature ... (leaflet) library(mapview) library(RColorBrewer) library(scales) I' am very new to R, so need guidance in resolving the problems like this?
asked Dec 7, 2019 alecxe 7.5k points
0 votes
1 answer 1.1K views
1.1K views
Problem : I need answer to bellow issue don't know how to automatically pick scale for object of type data.frame. defaulting to continuous.
asked Nov 7, 2019 peterlaw 6.9k points