I need to read the following table into R
. This table is an output from prop.table(table(x,y),2)
.
The problem is in sep ="\t"
. I tried sep =""
and sep =c("\t","")
but none of them work as some
rows have space as well.
I tried the following code:
dataMonthlyTrend<-read.table(text= " Variable Non_stopped_percentage stopped_percentage
INDIV 1.0000000 0.0000000000
INDUSTRY 0.9987045 0.0012955466
NETWORK 0.9990512 0.0009487666
OTHER 0.9997127 0.0002872679
Early Phase 1 0.9981618 0.0018382353
Not.Applicable 0.9996305 0.0003694809
Phase.1 0.9993608 0.0006392499
Phase 1, Phase 2 1.0000000 0.0000000000
Phase.2 0.9990993 0.0009006980
Phase.2, Phase 3 0.9990329 0.0009671180
Phase 3 0.9991403 0.0008596974
Phase 4 0.9995730 0.0004269855
Observational 0.9997154 0.0002846084
Expanded Access 1.0000000 0.0000000000
Interventional 0.9994374 0.0005625766
Behavioral 0.9998005 0.0001994813
Biological 0.9995493 0.0004506534
Combination Product 1.0000000 0.0000000000
Device 0.9991869 0.0008131403
Diagnostic Test 1.0000000 0.0000000000
More than 1 type 0.9992554 0.0007446016
Other 0.9996144 0.0003855546
Procedure 1.0000000 0.0000000000
Radiation 1.0000000 0.0000000000
Case-Control 0.9996120 0.0003880481
Case-Crossover 1.0000000 0.0000000000
Case-Only 0.9996069 0.0003930818
Cohort 0.9996924 0.0003075977
Defined Population 1.0000000 0.0000000000
Ecologic or Community 1.0000000 0.0000000000
Family-Based 1.0000000 0.0000000000
Natural History 1.0000000 0.0000000000
Other 1.0000000 0.0000000000
Non-Probability Sample 0.9997578 0.0002422481
Africa 1.0000000 0.0000000000
Asia 0.9998925 0.0001075038
Europe 0.9998773 0.0001227220
More than 1 continent 0.9998412 0.0001587554
North America 0.9994576 0.0005423974
Oceania 0.9969970 0.0030030030
South America 1.0000000 0.0000000000
", sep="\t", header=T);dataMonthlyTrend
This is what I am getting using the prior code
Then I used this code shown in the screenshot below and there were no columns headings although I entered them as per @G.Grothendiec 's code
My current R version is 3.6.2 (2019-12-12).
Any advice will be greatly appreciated.