Introduction à R - Gestion de données
24 Questions
0 Views

Introduction à R - Gestion de données

Created by
@IngeniousOsmium

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Quelle fonction est utilisée pour supprimer tous les objets de l'espace de travail R?

  • save()
  • setwd()
  • ls()
  • rm() (correct)
  • La fonction mean() peut être utilisée pour calculer la moyenne d'un vecteur sans tenir compte des valeurs NA par défaut.

    False

    Quelle est la commande pour voir les types d'objets dans R?

    class()

    Pour importer un dataframe à partir d'un fichier texte, on utilise la fonction ______.

    <p>read.table()</p> Signup and view all the answers

    Associez les types d'objets avec leur description :

    <p>vector = Une séquence de valeurs de même type matrix = Un tableau à deux dimensions data.frame = Une structure de données tabulaire list = Une collection d'objets divers</p> Signup and view all the answers

    Comment calcule-t-on l'âge de découverte des chercheurs dans le dataframe nobel?

    <p>nobel$year_research_mid - nobel$year_birth</p> Signup and view all the answers

    La commande 'save.image' est utilisée pour enregistrer l'espace de travail actuel dans un fichier.

    <p>True</p> Signup and view all the answers

    Comment supprime-t-on les lignes contenant des valeurs manquantes (NA) dans un dataframe?

    <p>subset(nobel, subset=!is.na(duree))</p> Signup and view all the answers

    What does the function 'setwd()' do in R?

    <p>It sets the working directory to a specified path.</p> Signup and view all the answers

    The command 'mean(y, na.rm = TRUE)' calculates the mean of y while ignoring NA values.

    <p>True</p> Signup and view all the answers

    Which function would you use to load a previously saved workspace in R?

    <p>load</p> Signup and view all the answers

    To create a vector in R, you use the function _______.

    <p>c</p> Signup and view all the answers

    What does the command 'rm(list=ls(all=TRUE))' accomplish?

    <p>It removes all objects from the global environment.</p> Signup and view all the answers

    How can you calculate the average age of high creativity in the Nobel dataset?

    <p>mean(nobel$age_discovery)</p> Signup and view all the answers

    Match the following R commands with their purposes:

    <p>head(nobel) = Displays the first few rows of a dataframe tail(nobel) = Displays the last few rows of a dataframe dim(nobel) = Shows the dimensions of the dataframe colnames(nobel) = Retrieves column names of the dataframe</p> Signup and view all the answers

    The lifespan of researchers in the Nobel dataset can be calculated by subtracting the year of birth from the year of ______.

    <p>death</p> Signup and view all the answers

    What is the purpose of the command 'getwd()' in R?

    <p>To retrieve the current working directory</p> Signup and view all the answers

    The function 'load()' is used to import a dataframe into R.

    <p>False</p> Signup and view all the answers

    What command is used to create a matrix combining two vectors in R?

    <p>rbind() or cbind()</p> Signup and view all the answers

    To calculate the average lifespan, you need to subtract the year of ______ from the year of death.

    <p>birth</p> Signup and view all the answers

    What does 'na.rm = TRUE' do when calculating the mean in R?

    <p>It removes NA values from the calculation</p> Signup and view all the answers

    Match the following commands to their functions in R:

    <p>read.table() = Imports a dataframe from a file save.image() = Saves the current workspace subset() = Filters data frames based on conditions class() = Returns the class of an object</p> Signup and view all the answers

    The command 'dim(nobel)' returns the column names of the dataframe.

    <p>False</p> Signup and view all the answers

    How is the average age of high creativity calculated from the Nobel dataset?

    <p>By subtracting year of birth from year of research mid and calculating the mean.</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser