Sei sulla pagina 1di 2

R version 3.5.

3 (2019-03-11) -- "Great Truth"


Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.


You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.


Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or


'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> mydata <- read.csv("data_seminar.csv", header=TRUE, sep=",")


> # Descrierea multimii de date
> mydata$V7 <- as.factor(mydata$V7)
> mydata$genul <- as.factor(mydata$genul)
> str(mydata)
'data.frame': 51 obs. of 8 variables:
$ Nr..Intrebare : int 1 2 3 4 5 6 7 8 9 10 ...
$ V7 : Factor w/ 2 levels "1","2": 1 1 1 1 2 2 1 1 2 2 ...
$ varsta : int 2 2 6 3 1 3 3 2 2 2 ...
$ genul : Factor w/ 2 levels "1","2": 2 1 1 2 1 2 2 2 2 2 ...
$ mediul : int 1 1 2 1 1 1 1 1 1 1 ...
$ studii : int 3 4 3 4 3 3 4 3 3 4 ...
$ angajabilitate: int 1 1 1 1 1 1 1 3 3 1 ...
$ venit : int 5 4 4 5 4 4 4 4 4 4 ...
> mydata$angajabilitate <- as.factor(mydata$angajabilitate)
> mydata$mediul <- as.factor(mydata$mediul)
> mydata$varsta <- as.factor(mydata$varsta)
> str(mydata)
'data.frame': 51 obs. of 8 variables:
$ Nr..Intrebare : int 1 2 3 4 5 6 7 8 9 10 ...
$ V7 : Factor w/ 2 levels "1","2": 1 1 1 1 2 2 1 1 2 2 ...
$ varsta : Factor w/ 6 levels "1","2","3","4",..: 2 2 6 3 1 3 3 2 2 2
...
$ genul : Factor w/ 2 levels "1","2": 2 1 1 2 1 2 2 2 2 2 ...
$ mediul : Factor w/ 2 levels "1","2": 1 1 2 1 1 1 1 1 1 1 ...
$ studii : int 3 4 3 4 3 3 4 3 3 4 ...
$ angajabilitate: Factor w/ 3 levels "1","3","4": 1 1 1 1 1 1 1 2 2 1 ...
$ venit : int 5 4 4 5 4 4 4 4 4 4 ...
> mydata$venit <- as.factor(mydata$venit)
> summary(mydata)
Nr..Intrebare V7 varsta genul mediul studii
Min. : 1.0 1:36 1: 2 1:29 1:41 Min. :3.000
1st Qu.:13.5 2:15 2:28 2:22 2:10 1st Qu.:3.000
Median :26.0 3:13 Median :4.000
Mean :26.0 4: 2 Mean :3.686
3rd Qu.:38.5 5: 5 3rd Qu.:4.000
Max. :51.0 6: 1 Max. :5.000
angajabilitate venit
1:39 1: 2
3:11 3: 5
4: 1 4:24
5:16
6: 2
7: 2
> # Modelul de baza:
> table(mydata$V7)/nrow(mydata)

1 2
0.7058824 0.2941176

Potrebbero piacerti anche