Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

how to produce scatterplot of .txt file in R

$
0
0

I am currently trying to produce a scatterplot of a .txt file that is structured like this in 25 rows:

age income weight

33 63 180

25 72 220

however, when I try to convert it to a csv and then produce a scatterplot with the following code:

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

plot(x = my_input$ageX, y = my_input$weightY)

I get an error message. I also notice that there is now a period between 'age''income' and 'weight', which I don't understand since I would expect to get a comma between them. the error message is as follows:

Error in plot.window(...) : need finite 'xlim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf 3: In min(x) : no non-missing arguments to min; returning Inf 4: In max(x) : no non-missing arguments to max; returning -Inf

Any ideas on how to actually get a scatterplot of the data?

Edit: executing

head(my_input)

returns

age. income. weight 1 56 63 185

2 38 72 156

3 28 75 178

4 49 59 205

5 69 65 235

6 19 70 19

Edit: plot is now produced but is incorrect:

enter image description here


Viewing all articles
Browse latest Browse all 201839

Trending Articles