


a<-4
b<-6

a+2*b



# Így lehet kommentelni


getwd()

# (Session/Working directory) menü elérés mellett a következő paranccsal is
#beállítható a working directory


setwd("")



a<-1:5

a

mode(a)



b<-c(  1,2,2,4,5,1  )

b

mode(b)

length(b)


b[3]

e<-b[2:4]

e

e<-b[c(2,3,4)]

e

b

b>3

d<-b[b>3]

d

b[c(TRUE,TRUE,FALSE,TRUE,FALSE,FALSE)]



ourlist<-list( 1,"hello",TRUE )



if(ourlist[3]){
  print("success")  
}

if(ourlist[[3]]){
  print("success")  
}

ourlist[3]

ourlist[[3]]



?matrix

something<-matrix(1:6,2,3)

something


something2<-matrix(data=1:6,ncol=3,nrow=2)

something2

nrow

something3<-matrix(1:6,ncol=3,nrow<-2)

something3

nrow



?runif


auxiliary1<-runif(500,0.5,6.5)

auxiliary1

round(3.3)

dice<-round(auxiliary1)

dice





toexport<-data.frame(auxiliary1,dice)

View(toexport)


names(toexport)

names(toexport)<-c("apple","orange")


toexport[3,2]

toexport[3,]

toexport[,2]

toexport$orange

write.table(toexport,file="oraimunka.csv", sep=";",row.names=FALSE)



?read.table

cholesterol<-read.table("cholestr.txt",header=TRUE)

View(cholesterol)

library(psych)

describe(cholesterol)

result<-describe(cholesterol)

result[[3]]

names(result)

result$mean

result$skew

result$skew[1]

result[1,11]




?t.test

t.test(cholesterol$Day2,mu=260)

savetheresult<-t.test(cholesterol$Day2,mu=260)


savetheresult[[3]]

names(savetheresult)
savetheresult$p.value

#ha marad ido

normalis<-rnorm(200,0,1)
exp<-rexp(200,1)
unif<-runif(200,0,1)

egyesit<-data.frame(normalis,exp,unif)

head(egyesit)

library(rgl)

plot3d(egyesit[,1],egyesit[,2],egyesit[,3], col="red", size=3)

ownfunction<-function(a,b){
  c<-2*a+b
  return(c)
}

ownfunction(2,-1)










