I am getting an error when trying to import tab delimited .txt file saved from Excel. I have read what is posted on the forums but still am confused. I saved my Excel file (DataTestforR.xlsx) as a tab delimited txt file (DataTestR.txt) on my Desktop. In the RGUI, I tried to import the txt file and got an error> myfile<-"C:\\Users\\jpapa\\Desktop\\DataTestR.txt" > mydf<-read.delim(myfile, header=TRUE,sep=" ", dec=".")Error in read.table(file = file, header = header, sep = sep, quote quote, : duplicate 'row.names' are not allowed The first row of my file has column names and the first column of my file has unique identifing names (not duplicated): Cu Sa Na Ci Se NM NPI IPI Seg 0090.00 15.48 1 SOM S L TX 0 0.2 0.2 7-Very 10997.00 64.62 123 B C NJ 0 0.01 0.04 7-Very Please tell me what I am doing wrong. Thank you. ****************************************************************** *Joanna Papakonstantinou, Ph.D.* [[alternative HTML version deleted]]
On Feb 20, 2013, at 10:14 AM, Joanna Papakonstantinou wrote:> I am getting an error when trying to import tab delimited .txt file saved > from Excel. > I have read what is posted on the forums but still am confused. > > I saved my Excel file (DataTestforR.xlsx) as a tab delimited txt file > (DataTestR.txt) on my Desktop. > In the RGUI, I tried to import the txt file and got an error > >> myfile<-"C:\\Users\\jpapa\\Desktop\\DataTestR.txt" >> mydf<-read.delim(myfile, header=TRUE,sep=" ", dec=".") > Error in read.table(file = file, header = header, sep = sep, quote > quote, : > duplicate 'row.names' are not allowed > > The first row of my file has column names and the first column of my file > has unique identifing names (not duplicated): > Cu Sa Na Ci Se NM NPI IPI Seg > 0090.00 15.48 1 SOM S L TX 0 0.2 0.2 7-VeryI count 11 data columns and nine column names. -- Alameda, CA, USA
Joanna Papakonstantinou
2013-Feb-24 15:57 UTC
[R] How to define variables as categorical using Gower with Daisy
> I am using the iris dataset that contains mixed variables (some columns are numeric and some categorical). > > > iris > Sepal.Length Sepal.Width Petal.Length Petal.Width Species > 1 5.1 3.5 1.4 0.2 setosa > 2 4.9 3.0 1.4 0.2 setosa > 3 4.7 3.2 1.3 0.2 setosa > 4 4.6 3.1 1.5 0.2 setosa > . > . > .> I am trying to use the Gower metric so that I may specify that some columns contain categorical data. > > iris.clust<-daisy(iris, metric = "gower", stand = FALSE, type = list(factor="Species"))But it is saying that the types= I, I, I, I, N so obviously it is not reading the variable types correctly. Could someone please tell me how to specify the variable types correctly? Thank you. Joanna>[[alternative HTML version deleted]]