New game
Download
Get Academic Plan
Share game
Integrate it into your platform

You can integrate the game into an LMS compatible with LTI 1.1 or LTI 1.3 such as Canvas, Moodle, or Blackboard. This way, the scores will be automatically saved into the platform’s gradebook.
Download
You have exceeded the maximum number of games you can integrate into Google Classroom with your current Plan.

To integrate as many games as you want in Google Classroom, you need an Academic Plan or a Commercial Plan.

You have exceeded the maximum number of games you can integrate into Microsoft Teams with your current Plan.

To integrate as many games as you want in Microsoft Teams, you need an Academic Plan or a Commercial Plan.

Downloading games is an exclusive feature for users with an Academic Plan or a Commercial Plan.

Get your Academic Plan or your Commercial Plan now and start integrating your games into your LMS, website or blog.

If you wish, you can download a demo game here and test its integration:

7 Operaciones: Creación (y eliminación) de variables

Fill in the Blanks

Played 2 %Accuracy 169 Average time 16:34

About this activity

Operaciones: Creación (y eliminación) de variables

Created by

Spain

Download the paper version to play

Make your own free game from our game creator
Compete against your friends to see who gets the best score in this game

Top Games

%
%
%
%
You have exceeded the maximum number of games you can print with your current Plan.

To print as many games as you want, you need an Academic Plan or a Commercial Plan.

Print your game
 
game-icon

Fill in the Blanks

7 Operaciones: Creación (y eliminación) de variablesOnline version

Operaciones: Creación (y eliminación) de variables

by María Dolores 1 Lage Veiga
1

help frame cars data observaciones notación variables nombre

7 Operaciones : Creación ( y eliminación ) de variables
Si tenemos un una base de datos car que está incluida en un paquete datasetsconsideremos la base de datos cars incluida en el paquete datasets :
data ( cars )
# str ( cars )
head ( cars )
## speed dist
## 1 4 2
## 2 4 10
## 3 7 4
## 4 7 22
## 5 8 16
## 6 9 10
Utilizando el comando ( ) se obtiene que cars es un . con 50 y dos :
? speed : Velocidad ( millas por hora )
? dist : tiempo hasta detenerse ( pies )
para acceder a la variable speed se puede hacer directamente con su o bien utilizando " matricial . "
cars$speed
## [ 1 ] 4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15
## [ 26 ] 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25
cars [ , 1 ] # Equivalente
## [ 1 ] 4 4 7 7 8 9 10 10 10 11 11 12 12 12 12 13 13 13 13 14 14 14 14 15 15
## [ 26 ] 15 16 16 17 17 17 18 18 18 18 19 19 19 20 20 20 20 20 22 23 24 24 24 24 25


2

dist frame cars$velocidad cars$dis speed head frame speed data write Excel file csv frame velocidad cars$speed data cars dist cars$speed csv2 velocidad head cars$distancia data

Si queremos transformar
la variable original ( millas por hora )
en una nueva variable ( kilómetros por hora ) y añadir esta nueva variable al . cars .

La transformación que permite pasar millas a kilómetros es kilómetros = millas / 0 . 62137 que en R se hace directamente con :
/ 0 . 62137
Finalmente , incluimos la nueva variable que llamaremos en cars :
< - / 0 . 62137
( cars )
## speed dist velocidad
## 1 4 2 6 . 437388
## 2 4 10 6 . 437388
## 3 7 4 11 . 265430
## 4 7 22 11 . 265430
## 5 8 16 12 . 874777
## 6 9 10 14 . 484124
También transformaremos la variable ( en pies ) en una nueva variable distancia ( en metros ) . Ahora la transformación deseada es metros = pies / 3 . 2808 :
< - / 3 . 2808
( )
## speed dist velocidad distancia
## 1 4 2 6 . 437388 0 . 6096074
## 2 4 10 6 . 437388 3 . 0480371
## 3 7 4 11 . 265430 1 . 2192148
## 4 7 22 11 . 265430 6 . 7056815
## 5 8 16 12 . 874777 4 . 8768593
## 6 9 10 14 . 484124 3 . 0480371
Ahora , eliminaremos las variables originales y , y guardaremos el . resultante con el nombre coches . En primer lugar , veamos varias formas de acceder a las variables de interés :
cars [ , c ( 3 , 4 ) ]
cars [ , c ( " velocidad " , " distancia " ) ]
cars [ , - c ( 1 , 2 ) ]
Utilizando alguna de las opciones anteriores se obtiene el . deseado :
coches < - cars [ , c ( " velocidad " , " distancia " ) ]
# head ( coches )
str ( coches )
## 'data . frame' : 50 obs . of 2 variables :
## $ velocidad : num 6 . 44 6 . 44 11 . 27 11 . 27 12 . 87 . . .
## $ distancia : num 0 . 61 3 . 05 1 . 22 6 . 71 4 . 88 . . .
Finalmente los datos anteriores podrían ser guardados en un fichero exportable a con el siguiente comando : . ( coches , = " coches . " )