error message plotting a dataset

How can I resolve this? I am trying to graph a dataset.

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

It is hard to say without knowing what your code looks like. My guess is that you have no valid values in the data for either axis. Please provide more information about what you are trying to plot. If it is a data frame named DF, the output of


would be helpful

Hi thank you for replying. I'm trying to create a graph for a dataset from excel. These are some of the error codes im getting.

pres.counts<-data.frame(vetos,president) preTrump<-subset(pres.counts,n > 100)
Error: unexpected symbol in "pres.counts<-data.frame(vetos,president) preTrump"

ggplot(pres.preTrump,aes(n,reorder(president,n)))+ geom_point()+theme_minimal()
Error in ggplot(pres.preTrump, aes(n, reorder(president, n))) :
could not find function "ggplot"

Error in count(vetothreats, congress, majortopic) :
could not find function "count"

two.topics<-topic.counts %>% filter(majortopic==3|majortopic==16)
Error in topic.counts %>% filter(majortopic == 3 | majortopic == 16) :
could not find function "%>%"

ggplot(two.topics,aes(congress,n))+ geom_line(aes(linetype=as.factor(majortopic)))+theme_minimal()
Error in ggplot(two.topics, aes(congress, n)) :
could not find function "ggplot"

I also get this error when i import my dataset im trying to use
vetothreats <- read_csv("vetothreats.csv")
Parsed with column specification:
KeyID = col_double(),
Congress = col_double(),
President = col_character(),
BillNo = col_character(),
ThreatDate = col_double(),
Year = col_double(),
Month = col_double(),
Day = col_double(),
Chamber = col_double(),
ChamParty = col_double(),
PresParty = col_double(),
Divided = col_double(),
Approps = col_double(),
MajorTopic = col_double(),
subTopicCode = col_double(),
CAPMajorTopic = col_logical(),
CAPSubTopicCode = col_logical(),
BillTitle = col_character()

Im really new to this, is this what you mean?


KeyID Congress
Min. : 1.0 Min. : 99.0
1st Qu.: 406.2 1st Qu.:102.0
Median : 811.5 Median :106.0
Mean : 811.5 Mean :106.9
3rd Qu.:1216.8 3rd Qu.:112.0
Max. :1622.0 Max. :115.0
Class :character
Mode :character


Class :character
Mode :character

ThreatDate Year
Min. :19850301 Min. :1985
1st Qu.:19920310 1st Qu.:1992
Median :19990721 Median :1999
Mean :20012630 Mean :2001
3rd Qu.:20120187 3rd Qu.:2012
Max. :20181128 Max. :2055
Month Day
Min. : 1.000 Min. : 0.00
1st Qu.: 5.000 1st Qu.: 8.00
Median : 7.000 Median :15.00
Mean : 6.959 Mean :15.67
3rd Qu.: 9.000 3rd Qu.:23.00
Max. :40.000 Max. :31.00
Chamber ChamParty
Min. :1.000 Min. :100.0
1st Qu.:1.000 1st Qu.:100.0
Median :1.000 Median :200.0
Mean :1.284 Mean :154.9
3rd Qu.:2.000 3rd Qu.:200.0
Max. :2.000 Max. :200.0
PresParty Divided
Min. :100.0 Min. :0.0000
1st Qu.:100.0 1st Qu.:1.0000
Median :100.0 Median :1.0000
Mean :140.3 Mean :0.8434
3rd Qu.:200.0 3rd Qu.:1.0000
Max. :200.0 Max. :1.0000
Approps MajorTopic
Min. :0.0000 Min. : 1.00
1st Qu.:0.0000 1st Qu.: 7.00
Median :0.0000 Median :15.00
Mean :0.2312 Mean :12.93
3rd Qu.:0.0000 3rd Qu.:20.00
Max. :1.0000 Max. :21.00
subTopicCode CAPMajorTopic
Min. : 100.0 Mode:logical
1st Qu.: 701.5 NA's:1622
Median :1522.0
Mean :1302.4
3rd Qu.:2000.0
Max. :7009.0
CAPSubTopicCode BillTitle
Mode:logical Length:1622
NA's:1622 Class :character
Mode :character

For you posts quoting errors, I have these comments.

The code you wrote in the quote above is not valid. Did you mean

preTrump<-subset(pres.counts,n > 100)

All the other errors that are of the form "could not find function X", it looks like you have not loaded the ggplot2 and dplyr packages. You must run the library() function each time you restart R.


In your next post, the output listed after you run read_csv() does not look like an error. It is just information.

What exactly is the code you are running when you try to plot? Please post it between two lines that consist of only three back ticks.
Your code here

[quote="FJCC, post:6, topic:83220"]

preTrump<-subset(pres.counts,n > 100)


Error in data.frame(veto, President) : object 'veto' not found
preTrump<-subset(pres.counts,n > 100)
Error in n > 100 :
comparison (6) is possible only for atomic and list types

So I loaded the library(ggplot2) and library (dplyr) and then used the code you corrected because you said my code was not valid but I got these errors.

I'm trying to use ggplot to graph the number of veto threats by president, ordered from the most veto threats to the least. Excluding Trump from the data because he has not served a full term.


The above line does not work because the vector veto does not exist. I can't say why that is without seeing your complete code.

In this line

preTrump<-subset(pres.counts,n > 100)

you attempt to make a subset of pres.counts based on the value of a column named n. But pres.counts would only contain columns named veto and President if the call to data.frame() had worked. Again, I can't say what n is without seeing your code.
Please post you entire code, not just the lines causing the immediate problem.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.