You can define the "file" argument in your call to write.csv()

## This will write out a file named "test_file.csv" to your working directory
write.csv(tableau,file = "test_file.csv", row.names=FALSE)


R. Mark Sharp, Ph.D.
msh...@txbiomed.org





> On Jan 30, 2017, at 2:26 PM, varin sacha <varinsa...@yahoo.fr> wrote:
>
> Dear R-Experts,
>
> I have generated a data.frame. Now I would like to get it (the generated 
> data.frame) saved on my desktop (desktop of my computer) in a .csv or .txt 
> file. How can I proceed ?
>
> Many thanks.
>
> Here is the reproducible example :
>
>
>
> # Génération aléatoire des colonnes
> Individu<-1:50
> Genre<-sample(c("H","F"),50,replace=T)
> Age<-sample(18:45,50,replace=T)
> Pratique<-sample(c("PI","I","TI"),50,replace=T)
> Statut<-sample(c("C","M","D"),50, replace=T)
>
> # Génération du Data.frame "tableau" contenant les colonnes précédentes
> tableau <- data.frame(Individu,Genre,Age,Pratique,Statut)
>
> # Exportation du data.frame dans un fichier csv
> write.csv(tableau,row.names=FALSE)
>
>
>
> # Sauvegarder...save(tableau, file = "saveddf.txt")
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

CONFIDENTIALITY NOTICE: This e-mail and any files and/or attachments 
transmitted, may contain privileged and confidential information and is 
intended solely for the exclusive use of the individual or entity to whom it is 
addressed. If you are not the intended recipient, you are hereby notified that 
any review, dissemination, distribution or copying of this e-mail and/or 
attachments is strictly prohibited. If you have received this e-mail in error, 
please immediately notify the sender stating that this transmission was 
misdirected; return the e-mail to sender; destroy all paper copies and delete 
all electronic copies from your system without disclosing its contents.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to