row names were found from a short variable and have been discarded

Dear All,

I am using rstudio.cloud project, for analysis of dissolusion data, please help me solve the following error,

library(xlsx)

excel_path <- "/cloud/project/Disso2.xlsx"

type <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 1)

type=as.factor(type)
#> Warning in xtfrm.data.frame(x): cannot xtfrm data frames
is.factor(type)
#> [1] TRUE

tablet <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 2)
t.5 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 3)
t.10 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 4)
t.15 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 5)
t.20 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 6)
t.30 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 7)
t.45 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 8)
t.60 <- read.xlsx(excel_path, sheetName = "Sheet1", colIndex = 9)
Disso3 <- data.frame(type,tablet,t.5,t.10,t.15,t.20,t.30,t.45,t.60)
#> Warning in data.frame(type, tablet, t.5, t.10, t.15, t.20, t.30, t.45, t.60):
#> row names were found from a short variable and have been discarded
print(Disso3)
#>    type tablet t.5 t.10 t.15 t.20 t.30 t.45 t.60
#> 1  <NA>      1 2.4  5.0  5.0  5.4  3.1  6.0  6.1
#> 2  <NA>      2 4.3  5.1  5.5  5.6  5.8  6.3  6.5
#> 3  <NA>      3 4.3  5.1  5.4  5.6  6.0  6.2  6.3
#> 4  <NA>      4 4.6  4.9  5.1  5.3  6.0  6.1  6.5
#> 5  <NA>      5 4.5  5.0  5.3  5.6  6.0  5.9  6.4
#> 6  <NA>      6 4.3  4.8  5.2  5.5  6.0  6.1  6.1
#> 7  <NA>      7 6.0  4.8  5.3  3.5  5.8  6.1  6.0
#> 8  <NA>      8 3.9  4.9  5.3  5.3  6.0  6.3  6.5
#> 9  <NA>      9 4.6  4.9  5.3  5.6  6.0  6.0  6.3
#> 10 <NA>     10 4.3  5.0  5.1  5.7  5.9  6.2  6.4
#> 11 <NA>     11 4.1  4.8  5.2  5.7  5.9  5.9  6.2
#> 12 <NA>     12 4.3  4.9  5.3  5.9  5.8  5.9  6.4
#> 13 <NA>      1 1.4  4.7  5.6  5.7  5.9  6.5  6.6
#> 14 <NA>      2 4.2  5.0  5.3  5.9  6.4  6.4  6.8
#> 15 <NA>      3 3.9  4.9  5.8  6.0  6.5  6.4  6.8
#> 16 <NA>      4 4.1  5.2  5.5  5.9  6.4  6.4  7.1
#> 17 <NA>      5 4.3  5.4  5.8  6.1  6.4  6.5  6.9
#> 18 <NA>      6 4.2  4.9  5.6  5.8  6.2  6.5  6.9
#> 19 <NA>      7 2.1  4.8  5.4  5.7  6.3  6.2  6.7
#> 20 <NA>      8 4.0  5.0  5.9  5.9  6.4  6.2  6.8
#> 21 <NA>      9 4.1  5.2  5.7  6.1  6.4  6.6  6.9
#> 22 <NA>     10 4.2  5.2  5.7  6.2  6.6  6.5  6.9
#> 23 <NA>     11 4.3  5.3  5.7  6.0  6.4  6.5  6.9
#> 24 <NA>     12 4.5  5.4  5.7  6.1  6.3  6.7  7.2
library(disprofas)
mimcr(data = Disso3, tcol = 3:9, grouping = "type")
#> Error in mimcr(data = Disso3, tcol = 3:9, grouping = "type"): The number of levels in column type differs from 2.

Created on 2022-12-01 with reprex v2.0.2

library(xlsx)

this has a java/Rjava dependency I dont like, so I recommend using a non Java dependent pacakges ; "openxlsx" works well.
Why run a read function 9 times, for one column a pop ? At least with openxlsx you can tell it a vector of cols to read, i.e. one statement.

thanks for your suggestion, i tried with openxlsx as below,

library(openxlsx)
Disso3 <- openxlsx::read.xlsx("/cloud/project/Disso2.xlsx")
print(Disso3)
#>    type tablet t.5 t.10 t.15 t.20 t.30 t.45 t.60
#> 1     R      1 2.4  5.0  5.0  5.4  3.1  6.0  6.1
#> 2     R      2 4.3  5.1  5.5  5.6  5.8  6.3  6.5
#> 3     R      3 4.3  5.1  5.4  5.6  6.0  6.2  6.3
#> 4     R      4 4.6  4.9  5.1  5.3  6.0  6.1  6.5
#> 5     R      5 4.5  5.0  5.3  5.6  6.0  5.9  6.4
#> 6     R      6 4.3  4.8  5.2  5.5  6.0  6.1  6.1
#> 7     R      7 6.0  4.8  5.3  3.5  5.8  6.1  6.0
#> 8     R      8 3.9  4.9  5.3  5.3  6.0  6.3  6.5
#> 9     R      9 4.6  4.9  5.3  5.6  6.0  6.0  6.3
#> 10    R     10 4.3  5.0  5.1  5.7  5.9  6.2  6.4
#> 11    R     11 4.1  4.8  5.2  5.7  5.9  5.9  6.2
#> 12    R     12 4.3  4.9  5.3  5.9  5.8  5.9  6.4
#> 13    T      1 1.4  4.7  5.6  5.7  5.9  6.5  6.6
#> 14    T      2 4.2  5.0  5.3  5.9  6.4  6.4  6.8
#> 15    T      3 3.9  4.9  5.8  6.0  6.5  6.4  6.8
#> 16    T      4 4.1  5.2  5.5  5.9  6.4  6.4  7.1
#> 17    T      5 4.3  5.4  5.8  6.1  6.4  6.5  6.9
#> 18    T      6 4.2  4.9  5.6  5.8  6.2  6.5  6.9
#> 19    T      7 2.1  4.8  5.4  5.7  6.3  6.2  6.7
#> 20    T      8 4.0  5.0  5.9  5.9  6.4  6.2  6.8
#> 21    T      9 4.1  5.2  5.7  6.1  6.4  6.6  6.9
#> 22    T     10 4.2  5.2  5.7  6.2  6.6  6.5  6.9
#> 23    T     11 4.3  5.3  5.7  6.0  6.4  6.5  6.9
#> 24    T     12 4.5  5.4  5.7  6.1  6.3  6.7  7.2
library(disprofas)
mimcr(data = Disso3, tcol = 3:9, grouping = "type")
#> Error in mimcr(data = Disso3, tcol = 3:9, grouping = "type"): The grouping variable's column in data must be a factor.

Created on 2022-12-01 with reprex v2.0.2

Disso3$type <- as.factor(Disso3$type)
mimcr(data = Disso3, tcol = 3:9, grouping = "type")
1 Like

dear nirgrahamuk,

thank you very much, now its working

This topic was automatically closed 7 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.