[R] ERROR need finite 'ylim' values
Giuseppe
gbarbesino at gmail.com
Sun Jun 13 14:28:30 CEST 2010
Hello:
I use R with MAC
I have a simple data table, numeric and text columns, named dt. The table is
imported through read.csv from a csv file. Row numbers are automatically
assigned, header is set to TRUE. there are 599 rows and several columns.
I am trying to plot using the stripchart command: one numeric variable (say
dt$fnatg) vs a text column (say dt$pat). dt$pat contains one of 3 values:
"pos", "neg", ""
So I issue the following command:
>stripchart (dt$fnatg~dt$pat)
and works well. it works well also with several options and nuances:
>stripchart (dt$fnatg ~ dt$pat, method ="jitter", jitter = 0.3, vertical
=TRUE,log="y", pch=1, ylab="Thyroglobulin (ng/mL)",xlab="Surgical
Pathology")
Now I want my graph to exclude values for which dt$pat == ""
I tried:
>stripchart (dt$fnatg ~ dt$pat, method ="jitter", subset (dt,
dt$pat!=""),jitter = 0.3, vertical =TRUE,log="y", pch=1, ylab="Thyroglobulin
(ng/mL)",xlab="Surgical Pathology")
there is no effect: the plot contains the same values as before
the I tried first subsetting the table:
>patonly<-(dt, dt$pat!="") which works well in creating a new table
excluding the unwanted rows. I have noticed that the new table keeps the
same row numbers assigned in the previous table. So row numbers now go 1 to
599 but with some intervals (for example there is no row 475 etc.).
then I use:
>stripchart (patonly$fnatg ~ patonly$pat, method ="jitter", jitter = 0.3,
vertical =TRUE,log="y", pch=1, ylab="Thyroglobulin (ng/mL)",xlab="Surgical
Pathology")
and I get the following error:
Error in plot.window(...) : need finite 'ylim' 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
I f I try the same command but I use another text variable (for example
patonly$gr) in the same table to split the plot, it now works:
>stripchart (patonly$fnatg ~ patonly$gr, method ="jitter", jitter = 0.3,
vertical =TRUE,log="y", pch=1, ylab="Thyroglobulin (ng/mL)",xlab="Surgical
Pathology")
My question is two fold:
Why does not the subset command work within the stripchart command?
Why the subsetted table cannot be used in the stripchart command, when the
plotting variable is the same previously used in the subsetting process?
Thank you
Giuseppe
--
View this message in context: http://r.789695.n4.nabble.com/ERROR-need-finite-ylim-values-tp2253388p2253388.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list