R for healthscience

 type of variables: 

integer: definite numbers with no .5 .6 examples: 1 ,2 ,3 

charecter: u should put it between " " 

u put things and give them values 

r<- 1

p <- portugal 

# 5 big mistakes

1- a is not A " capital is different"

2- when combining different values use c() to make a vector:  c(1,2,3) not (1,2,3)

3- "a==b" means "is a equal to b?" while "a=b" means make a equal to b: BIG DIFFERENCE

4- Be aware of NA ( non existing data " data: they can ruin everything

" to name a vector"

vec_aux<-c(3,4)

  • List: is a collection of vectors that can be of different length or type, e.g.  make a list

then name it :

  1. names(l)<-c("one","two") then l$one or l[2]
    1. difference between l[1] and l[[1]] is the first one also returns u the name and the element not exactly the element like in the second one

      > lapply(c, mean)

    1. if u create like vec<-c(1,2,3,4)
    2. and then
    3. l<-list(vec)
    4. and then do lapply(l,mean)

Comments

Popular posts from this blog

Adults children

when you know more than your parents

Atomic Habits: Tiny Changes, Remarkable Results by James Clear