Hello everyone, I just finished my Goggle Data Analytic Courses, am currently working on my Capstone Project (Bella Beat).
Here is my challenges am unable to load the data either from my computer or the Kaggle link where the data is stored.
Here is my code from R to load the Data using CSV or excel
#............Installation of Packages.........%
install.packages(c("tidyverse", "lubridate", "dplyr", "ggplot2", "tidyr"))
library(tidyverse)
library(lubridate)
library(dplyr)
library(ggplot2)
library(tidyr)
#............Reading and writing of data files.........%
install.packages(c('rjava','xlsxjars', 'xlsx'))
library(rJava)
library(xlsxjars)
library(xlsxjars)
library(xlsx) #Reading data from Excel files
installed.packages('readxl', respos="http:cran.rstudio.com")
library(readxl) #Read data from the sheet using read excel
Activity<-read_excel("C:\Users\User1\Documents\DATA ANALYSIS\Portfolio\BellaBeat_20241116_v1\2\DailyActivity.xlsx, sheet='dailyActivity')
The output it display is
Activity<-read_csv("C:\Users\User1\Documents\DATA ANALYSIS\Portfolio\BellaBeat_20241116_v1\2\dailyActivity.csv")
Error: '\U' used without hex digits in character string (:1:24)
Activity<-read_excel("C:\Users\User1\Documents\DATA ANALYSIS\Portfolio\BellaBeat_20241116_v1\2\DailyActivity.xlsx, sheet='dailyActivity')
Error: '\U' used without hex digits in character string (:1:26)
Have you tried using / instead of \ ? R uses the latter as an escape character so cannot read normal Windows paths correctly.
Warning: I have never used Windows for R, just macOS and linux.
BTW, library(tidyverse) will load dplyr, ggplot2, lubridate, and tidyr (along with forcats, purrr, stringr, readr, tibble) so there is no reason for library(dplyr), library(ggplots2)... .
Also, the readxl package has no external dependencies, unlike xlsx which needs Java.
If you are using your own computer, you only need to install packages once. They should appear in your User Library.
Thanks it worked, and I have removed the uncessary library(dplyr and the rest). But I try to use read. csv does not worked and read_excel
Here is the output for both
Did you check for typos? You have lots of spellings of "daily activity" floating around. In the error message, it says you put an an argument sheet = "DailyActivityy". Is the sheet actually called that, or did you accidentally add an extra "y"? And in your original code, you put sheet='dailyActivity', which is a different spelling. You also have DailyActivity.xlsx and dailyActivity.csv.