+ Show code- Hide code
library(OpasnetUtils)
library(ggplot2)
objects.get("mg2Gf5eoR5FVZ8xw")
data <- objects.decode(etable, key)
titles <- c(
"Gender",
"Age",
"Country",
"Education",
"Expertise.1",
"Expertise.2",
"Expertise.3",
"Expertise.4",
"Expertise.5",
"Expertise.6",
"Expertise.7",
"Expertise.8",
"Expertise.9",
"Expertise.10",
"Expertise.11",
"Expertise.12",
"Expertise.13",
"Expertise.14",
"Expertise.15",
"Publications.scientific",
"Publications.general",
"EvolutionPublications.scientific",
"EvolutionPublications.general",
"Courses",
"Familiarity",
"Bipedalism.1",
"Bipedalism.2",
"Bipedalism.3",
"Bipedalism.4",
"Bipedalism.5",
"Bipedalism.6",
"Bipedalism.7",
"Bipedalism.8",
"Bipedalism.9",
"Bipedalism.10",
"Encephalization.1",
"Encephalization.2",
"Encephalization.3",
"Encephalization.4",
"Encephalization.5",
"Encephalization.6",
"Encephalization.7",
"Encephalization.8",
"Encephalization.9",
"Encephalization.10",
"Naked.1",
"Naked.2",
"Naked.3",
"Naked.4",
"Naked.5",
"Naked.6",
"Naked.7",
"Naked.8",
"SubcutaneousFat.1",
"SubcutaneousFat.2",
"SubcutaneousFat.3",
"SubcutaneousFat.4",
"Larynx.1",
"Larynx.2",
"Larynx.3",
"Speech.1",
"Speech.2",
"Speech.3",
"Speech.4",
"Speech.5",
"Speech.6",
"Speech.7",
"BabySwim",
"Nose",
"Smell",
"Fingerweb",
"EccrineGlands",
"Sweating",
"Swimming",
"DivingReflex",
"Bathing",
"AAH.1",
"AAH.2",
"AAH.3",
"AAH.4",
"AAH.5",
"AAH.6",
"AAH.7",
"AAH.8",
"AAH.9",
"AAH.10",
"AAH.11",
"AAH.12",
"AAH.13",
"AAH.14",
"AAH.15",
"AAH.16",
"AAH.17",
"AAH.18",
"AAH.19",
"AAH.20",
"AAHFamiliarity",
"AAHSource.1",
"AAHSource.2",
"AAHSource.3",
"AAHSource.4",
"AAHSource.5",
"AAHSource.6",
"AAHSource.7",
"AAHSource.8",
"AAHAttitude.1",
"AAHAttitude.2",
"AAHAttitude.3"
)
colnames(data) <- titles
data <- data[-(1:2) , ]
#oprint(head(data))
data <- dropall(data)
leve <- list()
leve[[1]] <- c("Male", "Female")
leve[[2]] <- c("29 or less", "30-39", "40-49", "50-59", "60 or more")
leve[[3]] <- c("None", "Bachelor's degree", "Master's degree", "Doctor's degree")
leve[[4]] <- c("Anthropology or archaeology", "Biology (animal physiology, anatomy or morphology)", "Biology (ecology)", "Biology (evolution)", "Biology (genetics or molecular biology)", "Biology (other, please specify)", "Geology", "Human cardiovascular or respiratory system", "Human musculoskeletal system", "Human nervous system", "Human nutrition", "Other aspects of human biology (please specify)", "Paleoanthropology", "Paleontology", "Other, please specify")
leve[[5]] <- c("none", "1-10", "11-40", "41 or more")
leve[[6]] <- c("Yes", "No")
leve[[7]] <- c("Not at all", "I have some idea", "I know the hypotheses well")
leve[[8]] <- c("Very likely", "Moderately likely", "No opinion", "Moderately unlikely", "Very unlikely")
leve[[9]] <- c("Fully agree", "Mostly agree", "No opinion", "Mostly disagree", "Strongly disagree")
leve[[10]] <- c("No", "Yes")
leve[[11]] <- c("Considerably", "A little", "Not at all")
leve[[12]] <- c("Common", "Rare", "Not seen")
chooselevel <- c(1, 2, NA, 3, rep(4, 15), rep(5, 4), 6, 7, rep(8, 51), rep(9, 20), 10, rep(11, 8), rep(12, 3))
for(i in 1:length(chooselevel)) {
if(!is.na(chooselevel[i])) data[[i]] <- as.factor(leve[[chooselevel[i]]][as.numeric(as.character(data[[i]]))])
}
data[[3]] <- paste(toupper(substring(data[[3]], 1, 1)), tolower(substring(data[[3]], 2)), sep = "")
data[[3]] <- ifelse(data[[3]] == "Brasil", "Brazil", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Ch", "Switzerland", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Czech republich", "Czech Republic", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Korea, south", "Korea", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Mexi", "Mexico", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Northern ireland. u.k.", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Scotland uk", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Sweden (currently, but of u.s. origin)", "Sweden", data[[3]])
data[[3]] <- ifelse(data[[3]] == "The uk", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "United kingdom", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "U,.s.", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "U. s. a.", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "U.k.", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "United states", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "United states of america", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "U.s.", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Usaf", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Wales, uk", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Usa", "USA", data[[3]])
data[[3]] <- ifelse(data[[3]] == "Uk", "UK", data[[3]])
data[[3]] <- ifelse(data[[3]] == "South africa", "South Africa", data[[3]])
data[[3]] <- as.factor(data[[3]])
data[[3]]
#MPF-731
#sininen farmariaudi
#16.40 10.3.2013
#Orivesi-Jämsä itään n. 150 km/h
oprint(head(data))
X <- colnames(data)[X]
Y <- colnames(data)[Y]
fill <- colnames(data)[fill]
ggplot(data, aes_string(x = X, weight = 1, fill = fill)) +
geom_bar(position = "fill", na.rm = TRUE) +
theme_grey(base_size = 24)
| |