1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| > setwd("/Users/zerohertz/Downloads") > x1=read.table("Data.txt");x1 V1 V2 V3 1 Name Score Gender 2 Kim 23 m 3 Oh 42 f 4 zd 21 f 5 Chat 31 m 6 Asd 23 m > x2=read.table("Data2.txt");x2 V1 1 Name,Score,Gender 2 Kim,23,m 3 Oh,42,f 4 zd,21,f 5 Chat,31,m 6 Asd,23,m > x3=read.table("Data.txt",header=T);x3 Name Score Gender 1 Kim 23 m 2 Oh 42 f 3 zd 21 f 4 Chat 31 m 5 Asd 23 m > x4=read.table("Data.txt",header=T,stringsAsFactors=F);x4 Name Score Gender 1 Kim 23 m 2 Oh 42 f 3 zd 21 f 4 Chat 31 m 5 Asd 23 m > str(x1) 'data.frame': 6 obs. of 3 variables: $ V1: Factor w/ 6 levels "Asd","Chat","Kim",..: 4 3 5 6 2 1 $ V2: Factor w/ 5 levels "21","23","31",..: 5 2 4 1 3 2 $ V3: Factor w/ 3 levels "f","Gender","m": 2 3 1 1 3 3 > str(x2) 'data.frame': 6 obs. of 1 variable: $ V1: Factor w/ 6 levels "Asd,23,m","Chat,31,m",..: 4 3 5 6 2 1 > str(x3) 'data.frame': 5 obs. of 3 variables: $ Name : Factor w/ 5 levels "Asd","Chat","Kim",..: 3 4 5 2 1 $ Score : int 23 42 21 31 23 $ Gender: Factor w/ 2 levels "f","m": 2 1 1 2 2 > str(x4) 'data.frame': 5 obs. of 3 variables: $ Name : chr "Kim" "Oh" "zd" "Chat" ... $ Score : int 23 42 21 31 23 $ Gender: chr "m" "f" "f" "m" ...
|