[R] Naming files within R code
tebert @end|ng |rom u||@edu
Sun Mar 20 23:27:38 CET 2022
Unless you want to make some transformation like tay/don it might work better to make a new variable with catchment and append one dataset to the other. If later you decide that was a bad choice, use pivot_wider to reorganize the data.
From: R-help <r-help-bounces using r-project.org> On Behalf Of Nick Wray
Sent: Sunday, March 20, 2022 6:03 PM
To: r-help using r-project.org
Subject: [R] Naming files within R code
Hello I have data from various Scottish river catchments in the form of
csv files. I want to be able to download the files in turn and refer to each one by an assigned name from a vector of names, but within R. So, for example, if my vector of names is c("tay","forth","don") I want to tell R to refer to the sequences of dataframes as a variable name, ie the table uploaded from the first csv becomes the object tay *within* R and so on, so that I could the do things like write print(tay[,1]) etc,rather than having to refer to a list eg print(riverlist[][,1]) I don't know whether this is possible but if it is I'd be grateful for any pointers Thanks, Nick Wray
[[alternative HTML version deleted]]
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=e3PR6lu4RXxbI3pz4G9YTtjhx4hngiq8Ri1ZGN8Zh1BnxmLp96ohrDR_XciLNAR5&s=h6PbgaQbzT184NTXJtdTDvmyk_W8ryszwocFp1o_yyA&e=
PLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=e3PR6lu4RXxbI3pz4G9YTtjhx4hngiq8Ri1ZGN8Zh1BnxmLp96ohrDR_XciLNAR5&s=sLKcHu2BJ_iU2JW3WjaWFLlLYQaIQMTMvlwYWwRjm9M&e=
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help