I have the following:
a #note that the 28 is a row.name
GHP GP T Tn
28 2.2194 2.6561 2.9007 3.2988
min(as.numeric(a))
2.9007
min(as.numeric(as.character(a)))
2.9007
as.numeric(as.character(a)) #What's going on here???
[1] 33. 29. 2.9007 3.2988
We can't say because we don't know how a was created.
Please email the output from
str(a)
and
dput(a)
Yours sincerely / Med venlig hilsen
Frede Aakmann Tøgersen
Specialist, M.Sc., Ph.D.
Plant Performance Modeling
Technology Service Solutions
T +45 9730 5135
M +45 2547 6050
a is ofcourse a subset of data.frame, a ROW of the original table specifically.
str(a)
'data.frame': 1 obs. of 4 variables:
$ GHP: Factor w/ 51 levels 0.0944,0.1446,..: 33
$ GP : Factor w/ 51 levels 0.1755,0.3582,..: 29
$ T : num 2.9
$ Tn : num 3.3
dput(a)
structure(list(GHP =
Now we are able to help you. What you see is an artefact of an object in T of
class 'factor'
## So please, see ?factor
## first 2 columns subset of a factor
str(a)
'data.frame': 1 obs. of 4 variables:
$ GHP: Factor w/ 51 levels 0.0944,0.1446,..: 33
$ GP : Factor w/ 51 levels
Hi,
Try:
min(sapply(lapply(a,as.character),as.numeric))
#[1] 2.2194
A.K.
On Wednesday, April 9, 2014 2:27 AM, Sachinthaka Abeywardana
sachin.abeyward...@gmail.com wrote:
a is ofcourse a subset of data.frame, a ROW of the original table specifically.
str(a)
'data.frame': 1 obs. of 4
I would suggest that unlist(lapply(... should always be preferable to
sapply(lapply... if you want to convert data in a data frame to a
vector. I can't see any reason to run the same loop twice. But check
timings -- maybe I'm overly sensitive to unimportant aesthetics.
Cheers,
Bert
Bert Gunter
6 matches
Mail list logo