csv - reading a table/data frame into R that has both x and y axis labels -
i'm new r, , don't know if possible. i've been using read.csv() read table r comma separated.
i keep getting error message telling me: "more column column names"
i believe issue involves fact files have both x , y axis labels.
so this:
,y1,y2,y3,
x1,data,data,data,
x2,data,data,data,
x3,data,data,data,
the y , x different labels depending on actual file, demonstration.
is there way read r? or have remove x axis labels files...
thanks
you getting error because r sees 4 columns, , 3 column names.
the argument row.names = 1
tell r first column of file vector of row names, , apply them accordingly.
> read.csv(text = ",y1,y2,y3, x1,data,data,data, x2,data,data,data, x3,data,data,data,", row.names = 1)[-4] ## results in ## y1 y2 y3 ## x1 data data data ## x2 data data data ## x3 data data data
the [-4]
removes na
column gets added using process (due comma in column names, think). differ in complete data set (try without see).
so, suggest
read.csv("yourfile.csv", row.names = 1)
and remove last column.
Comments
Post a Comment