---
title: "Data Curation Fellowship - Mental Health Dataset"
output: html_document
date: "2024-05-15"
---

```{r}
setwd("~/Desktop/Desktop Files/Data Curation Fellowship")
mydata <- read.csv("Mental Health Dataset.csv")

head(mydata)

```

#clean and remove NAs
```{r}
mydata[mydata == ""] <- NA
mydata[is.na(mydata)] <- "Unknown"

na_count <- colSums(is.na(mydata))
print(na_count)

unique(mydata$Days_Indoors)

#remove the time from the Timestamp
mydata$Timestamp <- sub(" .*", "", mydata$Timestamp)


```

#check for blanks in each column, remove rows with blanks
```{r}
mydata <- mydata %>%
  filter(!apply(mydata, 1, function(row) any(row == "")))

print("Number of blank values in each column:")
print(blank_values)

```

#make all header of columns Xxxx_Yyyy
```{r}
names(mydata) <- sapply(names(mydata), function(x) {
  paste0(toupper(substr(x, 1, 1)), tolower(substr(x, 2, nchar(x))))
})

head(mydata)

```

#write CSV to export new file
```{r}
write.csv(mydata, "~/Desktop/Desktop Files/Data Curation Fellowship/The Final Dataset - Mental Health.csv")
```

