I'm trying to fix the NA problem and trying to dot plot the data frame from ".CSV" file.
I'm trying to get the mean median and 10% trimmed mean of the given data frame, somehow I'm getting an error. I have already tried previous suggestions and still not helping me out. I have data and I can't plot the dot chart from it.
code for mean median and 10% trimmed mean
data_val <- read.csv(file =
"~/502_repos_2019/502_Problems/health_regiment.csv", head=TRUE, sep
= " ")
as.numeric(unlist(data_val))
print(ncol(data_val))
print(nrow(data_val))
# I have used several logics but it's not helping to solve the problem
mean(data_val,data_val$cholesterol_level[data_val$Treatment_type ==
'Control_group'])
mean(data_val$cholesterol_level[data_val$Treatment_type ==
'Treatment_group'])
code for dot chart & dot plot
data_val <- read.csv(file =
"~/502_repos_2019/502_Problems/health_regiment.csv", head=TRUE, sep
= " ")
data_val
plot(data_val$Treatment_type ~ data_val$cholestrol_level, xlab =
"Health Unit Range", ylab = " ",
main = "Regiment_Health", type="p") #p for point chart
#dotchart(data_val, data_val$Treatment_type ~
data_val$cholestrol_leve, labels = row.names(data_val),
#cex = 0.6,xlab = "units")
Following is the error message
[2] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 7 3 -4 14 2 5 22 -7 9 5 -6 5 9 4 4 12 37 [38] 5 3 3 [2] 2 [2] 20 argument is not numeric or logical: returning NA[2] NA argument is not numeric or logical: returning NA[2] NA
and instead of point plot, I'm getting bar chart and dot chart syntax is not working though I have given the proper syntax.
.csv data
Treatment_type cholestrol_level
Control_group 7
Control_group 3
Control_group -4
Control_group 14
Control_group 2
Control_group 5
Control_group 22
Control_group -7
Control_group 9
Control_group 5
Treatment_group -6
Treatment_group 5
Treatment_group 9
Treatment_group 4
Treatment_group 4
Treatment_group 12
Treatment_group 37
Treatment_group 5
Treatment_group 3
Treatment_group 3
Data in dput
format.
data_val <-
structure(list(Treatment_type = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L), .Label = c("Control_group", "Treatment_group"),
class = "factor"), cholestrol_level = c(7L, 3L, -4L, 14L,
2L, 5L, 22L, -7L, 9L, 5L, -6L, 5L, 9L, 4L, 4L, 12L, 37L,
5L, 3L, 3L)), class = "data.frame", row.names = c(NA, -20L))