简体   繁体   中英

How to read tab separated files in R to generate Scatterplot

I have a tab separated text file that has some data I saved in it from a python script. Is there an easy way to import this data file to R and generate a scatterplot using this data with ageX column is on the X-axis and the memesY column is on the Y-axis?

I am looking for a simple scatterplot with points, and/or lines to include with my report.

Thanks!

This is a sample of the data saved in the file memesvsage.txt:

ageX    memesY
51  16

1255    1010

14  55

50  245

28  103

12  1

43  111

90  1

0   1

50  80

4   10

To read a tab separated file:

mydf <- read.csv2('file.txt', sep = '\t', header = T)

To plot a simple scatter plot:

plot(x = mydf$ageX, y = mydf$memesY)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM