[R] Reading two-cloumn CSV file into a hash table
ggrothendieck at gmail.com
Mon Sep 26 22:48:43 CEST 2011
On Mon, Sep 26, 2011 at 4:16 PM, Khanvilkar, Shashank
<skhanvil at qualcomm.com> wrote:
> Sending it again, with correct subject line.
> Hello All,
> Thanks in advance for all help,
> I am trying to read a two column csv file in R, which looks like:
> I am using R commands:
> tmp = read.csv("test.csv", colClasses=c("character", "character"))
> How can make this into a hash table, so that I can access, tmp["X"] and it will return me "1"?
Lines <- "letters,numbers
cat(Lines, "\n", file = "data.txt")
DF <- read.csv("data.txt")
v <- setNames(DF[,2], DF[,1])
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
email: ggrothendieck at gmail.com
More information about the R-help