Il
set di dati galton, inizialmente contenuto nella libreria psych ma recentemente spostato nella libreria psychTools (in caso di difficoltà verificate entrambe le librerie, non si sa mai...) contiene 928 coppie di valori di altezza (misurata in pollici) di
altrettanti padri e dei relativi figli. Questa
in breve la storia del set di dati.
Francis
Galton [1] era cugino di Charles Darwin e dopo la lettura de
"L'origine delle specie" si era convinto che la preminenza
delle persone nei vari campi fosse dovuta essenzialmente a fattori
genetici. Si era quindi dedicato alla ricerca delle leggi della
genetica. E l'osservazione di fenomeni di "regressione verso la media" dell'altezza dei figli rispetto all'altezza dei padri lo portò
a concepire l'idea della necessità di opporvisi, applicando quelli
che riteneva essere i principi di una "buona" genetica
("eugenetica").
In
un suo famoso lavoro [2] Galton così si esprime:
"…
This memoir contains the data upon which the remarks on the Law of
Regression were founded ... My object is to place beyond doubt the
existence of a simple and far-reaching law that governs the
hereditary transmission of, I believe, every one of those simple
qualities which all possess, though in unequal degrees."
"It
is some years since I made an extensive series of experiments on the
produce of seeds of different size but of the same species. They
yielded results that seemed very noteworthy, and I used them as the
basis of a lecture before the Royal Institution on February 9th,
1877. It appeared from these experiments that the offspring did not
tend to resemble their parent seeds in size, but to be always more
mediocre than they - to be smaller than the parents, if the parents
were large; to be larger than the parents, if the parents were very
small."
"It
was anthropological evidence that I desired, caring only for the
seeds as means of throwing light on heredity in man ... inducing me
to make an offer of prizes for Family Records, which was largely
responded to, and furnished me last year with what I wanted ... An
analysis of the Records fully confirms and goes far beyond the
conclusions I obtained from the seeds. It gives the numerical value
of the regression towards mediocrity in the case of human
stature ... My data consisted of the heights of 930 adult children and of
their respective parentages, 205 in number..."
A
pagina 254 del lavoro Galton cita "... a
total of 928 children ..." che corrisponde al
numero delle coppie di valori riportati in R nel set di dati
galton.
L'espressione
"regressione" è quindi stata associata al metodo statistico per il calcolo dell'equazione
della retta, che è diventata così la "retta di regressione", in
seguito agli studi di Galton. Per i problemi che nascono applicando ai dati di Galton il modello tradizionale di regressione lineare, quello più largamente impiegato, vedere il post Regressione lineare semplice parametrica e il post La regressione lineare: assunti e modelli.
Per utilizzare il set di dati galton dovete scaricare e installare dal CRAN il pacchetto psych quindi caricare il set di dati con la riga di codice
Per utilizzare il set di dati galton dovete scaricare e installare dal CRAN il pacchetto psych quindi caricare il set di dati con la riga di codice
library(psychTools)
come
riportato nei vari script che impiegano questi dati.
In
alternativa per caricare il set di dati potete fare il download del file
galton.csv come indicato alla pagina Dati, salvare il file
galton.csv nella cartella
C:\Rdati\ [3] quindi negli script sostituire la riga
library(psychTools)
con
la riga
galton
<- read.table("c:/Rdati/galton.csv", header=TRUE,
sep=";", dec=",")
Da notare che invece del punto viene impiegata la virgola come
separatore delle cifre decimali (dec=",") per garantire la compatibilità con l'installazione standard in lingua italiana di Excel, OpenOffice Calc, eccetera.
Potete
anche copiare le righe riportate qui sotto e salvarle in
C:\Rdati\ nel file di testo denominato
galton.txt. Attenzione: l'ultimo carattere nel file deve
essere un ↵ Invio (cioè un "a capo") che dovete avere cura di aggiungere
immediatamente dopo il 73,7 finale prima di salvare il
file.
In questo caso come separatore tra record / righe non viene impiegato un ↵ Invio ma viene impiegato un \n che R interpreta come un ↵ Invio se nella funzione read.table() che importa i dati viene abilitato il riconoscimento dei caratteri di controllo con l'argomento allowEscapes=TRUE. Il vantaggio è rappresentato da un file di testo molto più compatto. Per importare i dati dal file galton.txt impiegate questo codice:
70,5;61,7\n68,5;61,7\n65,5;61,7\n64,5;61,7\n64;61,7\n67,5;62,2\n67,5;62,2\n67,5;62,2\n66,5;62,2\n66,5;62,2\n66,5;62,2\n64,5;62,2\n70,5;63,2\n69,5;63,2\n68,5;63,2\n68,5;63,2\n68,5;63,2\n68,5;63,2\n68,5;63,2\n68,5;63,2\n68,5;63,2\n67,5;63,2\n67,5;63,2\n67,5;63,2\n67,5;63,2\n67,5;63,2\n66,5;63,2\n66,5;63,2\n66,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n65,5;63,2\n64,5;63,2\n64,5;63,2\n64,5;63,2\n64,5;63,2\n64;63,2\n64;63,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n69,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n68,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n67,5;64,2\n66,5;64,2\n66,5;64,2\n66,5;64,2\n66,5;64,2\n66,5;64,2\n65,5;64,2\n65,5;64,2\n65,5;64,2\n65,5;64,2\n65,5;64,2\n64,5;64,2\n64,5;64,2\n64,5;64,2\n64,5;64,2\n64;64,2\n64;64,2\n64;64,2\n64;64,2\n71,5;65,2\n70,5;65,2\n69,5;65,2\n69,5;65,2\n69,5;65,2\n69,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n68,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n67,5;65,2\n66,5;65,2\n66,5;65,2\n65,5;65,2\n65,5;65,2\n65,5;65,2\n65,5;65,2\n65,5;65,2\n65,5;65,2\n65,5;65,2\n64,5;65,2\n64;65,2\n71,5;66,2\n71,5;66,2\n71,5;66,2\n70,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n69,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n68,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n67,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n66,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n65,5;66,2\n64,5;66,2\n64,5;66,2\n64,5;66,2\n64,5;66,2\n64,5;66,2\n64;66,2\n64;66,2\n71,5;67,2\n71,5;67,2\n71,5;67,2\n71,5;67,2\n70,5;67,2\n70,5;67,2\n70,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n69,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n68,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n67,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n66,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n65,5;67,2\n64,5;67,2\n64,5;67,2\n64,5;67,2\n64,5;67,2\n64,5;67,2\n64;67,2\n64;67,2\n72,5;68,2\n71,5;68,2\n71,5;68,2\n71,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n70,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n69,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n68,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n67,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n66,5;68,2\n65,5;68,2\n65,5;68,2\n65,5;68,2\n65,5;68,2\n65,5;68,2\n65,5;68,2\n65,5;68,2\n64;68,2\n72,5;69,2\n72,5;69,2\n71,5;69,2\n71,5;69,2\n71,5;69,2\n71,5;69,2\n71,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n70,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n69,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n68,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n67,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n66,5;69,2\n65,5;69,2\n65,5;69,2\n65,5;69,2\n65,5;69,2\n65,5;69,2\n65,5;69,2\n65,5;69,2\n64,5;69,2\n64,5;69,2\n64;69,2\n72,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n71,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n70,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n69,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n68,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n67,5;70,2\n66,5;70,2\n66,5;70,2\n66,5;70,2\n66,5;70,2\n65,5;70,2\n65,5;70,2\n65,5;70,2\n65,5;70,2\n65,5;70,2\n72,5;71,2\n72,5;71,2\n71,5;71,2\n71,5;71,2\n71,5;71,2\n71,5;71,2\n70,5;71,2\n70,5;71,2\n70,5;71,2\n70,5;71,2\n70,5;71,2\n70,5;71,2\n70,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n69,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n68,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n67,5;71,2\n65,5;71,2\n65,5;71,2\n73;72,2\n72,5;72,2\n72,5;72,2\n72,5;72,2\n72,5;72,2\n72,5;72,2\n72,5;72,2\n72,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n71,5;72,2\n70,5;72,2\n70,5;72,2\n70,5;72,2\n70,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n69,5;72,2\n68,5;72,2\n68,5;72,2\n68,5;72,2\n68,5;72,2\n67,5;72,2\n67,5;72,2\n67,5;72,2\n67,5;72,2\n65,5;72,2\n73;73,2\n73;73,2\n73;73,2\n72,5;73,2\n72,5;73,2\n71,5;73,2\n71,5;73,2\n70,5;73,2\n70,5;73,2\n70,5;73,2\n69,5;73,2\n69,5;73,2\n69,5;73,2\n69,5;73,2\n68,5;73,2\n68,5;73,2\n68,5;73,2\n72,5;73,7\n72,5;73,7\n72,5;73,7\n72,5;73,7\n71,5;73,7\n71,5;73,7\n70,5;73,7\n70,5;73,7\n70,5;73,7\n69,5;73,7\n69,5;73,7\n69,5;73,7\n69,5;73,7\n69,5;73,7
In questo caso come separatore tra record / righe non viene impiegato un ↵ Invio ma viene impiegato un \n che R interpreta come un ↵ Invio se nella funzione read.table() che importa i dati viene abilitato il riconoscimento dei caratteri di controllo con l'argomento allowEscapes=TRUE. Il vantaggio è rappresentato da un file di testo molto più compatto. Per importare i dati dal file galton.txt impiegate questo codice:
galton
<- read.table("c:/Rdati/galton.txt", header=TRUE,
col.names=c("parent","child"), sep=";",
dec=",", allowEscapes=TRUE)
#
ESPORTA DA R IN UN FILE .csv IL SET DI DATI galton DEL PACCHETTO
psychTools
#
impiega come separatore di campo il punto e virgola (;)
#
impiega come separatore delle cifre decimali la virgola (,)
#
library(psychTools)
# carica il pacchetto incluso il set di dati galton
write.table(galton,
file="C:/Rdati/galton.csv", quote=FALSE, sep=";",
dec=",", na="", col.names=TRUE, row.names=FALSE)
# esporta i dati, notare / invece di \ su windows
#
----------
[1]
Francis Galton. MacTutor History of Mathematics archive.
School of Mathematics and Statistics. University of St Andrews,
Scotland. URL consultato il 29/11/2018: https://goo.gl/BVMXGn
[2]
Francis Galton. Regression Towards Mediocrity in Hereditary
Stature. The Journal of the Anthropological Institute of Great
Britain and Ireland, 1886, Vol. 15, pp. 246-263. URL consultato il
29/11/2018: https://goo.gl/VWvBau
[3] Se non esiste, la cartella C:\Rdati\ va creata.
Nessun commento:
Posta un commento