Here's the reprex, it seems it can't locate the files, yet both crx and data frame are in the environment:
# Import the data
# Read the data set
Data <- read.table ('crx.data', header=FALSE, sep=',', na.strings=c('?'))
#> Warning in file(file, "rt"): cannot open file 'crx.data': No such file or
#> directory
#> Error in file(file, "rt"): cannot open the connection
# Create dataframe
crx.data <- data.frame(crx)
#> Error in data.frame(crx): object 'crx' not found
# Add names to the dataset
names(crx) <- c("Gender", "Age", "MonthlyExpenses", "MaritalStatus", "HomeStatus", "Occupation", "BankingInstitution", "YearsEmployed", "NoPriorDefault", "Employed", "CreditScore", "DriversLicense", "AccountType", "MonthlyIncome", "AccountBalance", "Approved")
#> Error in names(crx) <- c("Gender", "Age", "MonthlyExpenses", "MaritalStatus", : object 'crx' not found
# Manually define the variables
crx$Gender <- as.factor(crx$Gender)
#> Error in is.factor(x): object 'crx' not found
crx$Age <- as.numeric(crx$Age)
#> Error in eval(expr, envir, enclos): object 'crx' not found
crx$MonthlyExpenses <- as.integer(crx$MonthlyExpenses)
#> Error in eval(expr, envir, enclos): object 'crx' not found
crx$MaritalStatus <- as.factor(crx$MaritalStatus)
#> Error in is.factor(x): object 'crx' not found
crx$HomeStatus <- as.factor(crx$HomeStatus)
#> Error in is.factor(x): object 'crx' not found
crx$Occupation <- as.factor(crx$Occupation)
#> Error in is.factor(x): object 'crx' not found
crx$BankingInstitution <- as.factor(crx$BankingInstitution)
#> Error in is.factor(x): object 'crx' not found
crx$YearsEmployed <- as.numeric(crx$YearsEmployed)
#> Error in eval(expr, envir, enclos): object 'crx' not found
crx$NoPriorDefault <- as.factor(crx$NoPriorDefault)
#> Error in is.factor(x): object 'crx' not found
crx$Employed <- as.factor(crx$Employed)
#> Error in is.factor(x): object 'crx' not found
crx$CreditScore <- as.numeric(crx$CreditScore)
#> Error in eval(expr, envir, enclos): object 'crx' not found
crx$DriversLicense <- as.factor(crx$DriversLicense)
#> Error in is.factor(x): object 'crx' not found
crx$AccountType <- as.factor(crx$AccountType)
#> Error in is.factor(x): object 'crx' not found
crx$MonthlyIncome <- as.integer(crx$MonthlyIncome)
#> Error in eval(expr, envir, enclos): object 'crx' not found
crx$AccountBalance <- as.numeric(crx$AccountBalance)
#> Error in eval(expr, envir, enclos): object 'crx' not found
crx$Approved <- as.factor(crx$Approved)
#> Error in is.factor(x): object 'crx' not found
# Use the function summary() to determine total number of missing values
summary(crx)
#> Error in summary(crx): object 'crx' not found
# Remove the records with missing values from the dataset
crx <- na.omit(crx)
#> Error in na.omit(crx): object 'crx' not found
# How many missing values in total are there? 0
# Use the function summary()
summary(crx)
#> Error in summary(crx): object 'crx' not found
# How many records are removed by using the function na.omit()? 0
# The dataset contains variables with mixed types.
# Use R function daisy() from package cluster to compute a Gower dissimilarity (distance) matrix between the data records, and refer to the result as “Dist”
# Library call
library(cluster)
#daisy(crx, metric = "gower", stand = FALSE, type = list(), weights = rep.int(1, p), warnBin = warnType, warnAsym = warnType, warnConst = warnType, warnType = TRUE)
Dist <- daisy(crx, metric = c("gower"))
#> Error in daisy(crx, metric = c("gower")): object 'crx' not found
# Convert the Gower dissimilarity object into a distance matrix
Dist <- as.matrix(Dist)
#> Error in as.matrix(Dist): object 'Dist' not found
# Using the new distance matrix, what is the Gower similarity measure between the 10th and the 60th observation (row)?
Dist <- daisy(crx, metric = "gower", crx_frame (10,60))
#> Error in daisy(crx, metric = "gower", crx_frame(10, 60)): object 'crx' not found
# Visualise the distance matrix
dim <- ncol(Dist) # used to define axis in image
#> Error in ncol(Dist): object 'Dist' not found
image(1:dim, 1:dim, Dist, axes = FALSE, xlab="", ylab="", col = rainbow(100))
#> Error in 1:dim: NA/NaN argument
Created on 2019-05-24 by the reprex package (v0.3.0)