Skip to content

Commit

Permalink
update from july 29 meeting
Browse files Browse the repository at this point in the history
  • Loading branch information
Yousuf28 committed Jul 29, 2024
1 parent 5418601 commit 4812e84
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
33 changes: 22 additions & 11 deletions BW_R_code/01_intro_bw.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,38 @@

# load from library
library(haven)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(scales)
# library(dplyr)
# library(ggplot2)
# library(RColorBrewer)
# library(scales)

# read xpt file with haven package

bw <- haven::read_xpt("~/OneDrive - FDA/yousuf/10_DATA/Biocelerate_shared_data/data/biocelerate_all_data/1MDogA_send/bw.xpt")
## bw <- haven::read_xpt("data/mock_SEND_data/instem/bw.xpt")
# write to csv file
# read back the file in dataframe
# attribute (label) lost
# mention to read excel file

# convert to base R dataframe
bw <- as.data.frame(bw)

edit(bw)
# getting a peek at data
head(bw)

# View the whole table
View(bw)

# edit()
# know more about your dataframe/table
str(bw)

print(head(bw$BWSTRESN))
head(bw$BWSTRESN)
print(bw[[1]])
print(bw[['BWSTRESN']])
bw[1:5,]

# access one column
bw$USUBJID

Expand Down Expand Up @@ -67,23 +77,24 @@ summary(bw$BWSTRESN)
is.na(bw$BWSTRESN)
sum(is.na(bw$BWSTRESN))


# plot
# plot a single numeric variable/column
plot(bw$BWSTRESN)

###################################

# individual values of body weight
plot(bw$BWSTRESN)
# pch= plotting character
# col = color
## plot(bw$BWSTRESN, pch = 21, col='black')
## ## plot(bw$BWSTRESN, pch = 1, col='black')
## plot(bw$BWSTRESN, pch = 2, col='black')
plot(bw$BWSTRESN, pch = 19, col='red')
plot(bw$BWSTRESN, pch = 17, col='red')

plot(bw$BWSTRESN,col='red',
main = 'scatter plot for BWSTRESN',
xlab = '',
plot(bw$BWSTRESN,col='red',
main = 'scatter plot for BWSTRESN',
xlab = '',
ylab = 'BWSTRESN')

unique(bw$BWTESTCD)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SEND-Coding-Bootcamp
* Use Posit Cloud as environment for training (users have to setup a free account)
* Intro RStudio
* Intro Slides
* Body Weight Graph
* Motivating Example:
* Plot y = BW, x = DY, by SETCD/SEX
Expand Down

0 comments on commit 4812e84

Please sign in to comment.