Skip to content
Back to formatted view

Raw Message

Message-ID: <BN6PR2201MB15538F0ACD134DA90496A406CF159@BN6PR2201MB1553.namprd22.prod.outlook.com>
Date: 2022-03-20T22:27:38Z
From: Ebert,Timothy Aaron
Subject: Naming files within R code
In-Reply-To: <CABxY9BPHrObmrUZ80QxATSSzigohnwQFLRfd7cmXHQxuqfRE4w@mail.gmail.com>

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.
Tim

-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Nick Wray
Sent: Sunday, March 20, 2022 6:03 PM
To: r-help at r-project.org
Subject: [R] Naming files within R code

[External Email]

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]][,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 at 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.