bluesky315 at gmail.com
2010-Feb-10 23:34 UTC
[R] What is the difference between typeof and storage.mode?
S Programming by Venables and Ripley (2000) says on page 8, "R objects have another way to give information using the function \tttext{typeof}, which often gives the same information as \tttext{storage.mode}." It implies that there are some differences between typeof and storage.mode. However, according to ?typeof and ?storage.mode, it doesn't seem to be so. Could somebody let me know if there is any difference? If there is, what the difference is?
David Winsemius
2010-Feb-11 00:40 UTC
[R] What is the difference between typeof and storage.mode?
On Feb 10, 2010, at 6:34 PM, bluesky315 at gmail.com wrote:> S Programming by Venables and Ripley (2000) says on page 8, "R objects > have another way to give information using the function > \tttext{typeof}, which often gives the same information as > \tttext{storage.mode}." It implies that there are some differences > between typeof and storage.mode. > > However, according to ?typeof and ?storage.mode, it doesn't seem to be > so. Could somebody let me know if there is any difference? If there > is, what the difference is?Dear Peng Yu; There is a difference.> > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Heritage Laboratories West Hartford, CT
David Winsemius
2010-Feb-11 00:54 UTC
[R] What is the difference between typeof and storage.mode?
On Feb 10, 2010, at 7:47 PM, bluesky315 at gmail.com wrote:> On Wed, Feb 10, 2010 at 6:40 PM, David Winsemius <dwinsemius at comcast.net > > wrote: >> >> On Feb 10, 2010, at 6:34 PM, bluesky315 at gmail.com wrote: >> >>> S Programming by Venables and Ripley (2000) says on page 8, "R >>> objects >>> have another way to give information using the function >>> \tttext{typeof}, which often gives the same information as >>> \tttext{storage.mode}." It implies that there are some differences >>> between typeof and storage.mode. >>> >>> However, according to ?typeof and ?storage.mode, it doesn't seem >>> to be >>> so. Could somebody let me know if there is any difference? If there >>> is, what the difference is? >> >> Dear Peng Yu; >> >> There is a difference. > > Would you please give me an example when they will be different?It took me about 20 seconds to find an example where they were different using typical objects in my workspace. You have been at this for about a year now. I think you are taking the easy route out, rather than working some of these answers out by yourself. David Winsemius, MD Heritage Laboratories West Hartford, CT
David Winsemius
2010-Feb-11 02:44 UTC
[R] What is the difference between typeof and storage.mode?
On Feb 10, 2010, at 9:21 PM, bluesky315 at gmail.com wrote:> On Wed, Feb 10, 2010 at 7:05 PM, David Winsemius <dwinsemius at comcast.net > > wrote: >> >> On Feb 10, 2010, at 7:54 PM, David Winsemius wrote: >> >>> >>> On Feb 10, 2010, at 7:47 PM, bluesky315 at gmail.com wrote: >>> >>>> On Wed, Feb 10, 2010 at 6:40 PM, David Winsemius <dwinsemius at comcast.net >>>> > >>>> wrote: >>>>> >>>>> On Feb 10, 2010, at 6:34 PM, bluesky315 at gmail.com wrote: >>>>> >>>>>> S Programming by Venables and Ripley (2000) says on page 8, "R >>>>>> objects >>>>>> have another way to give information using the function >>>>>> \tttext{typeof}, which often gives the same information as >>>>>> \tttext{storage.mode}." It implies that there are some >>>>>> differences >>>>>> between typeof and storage.mode. >>>>>> >>>>>> However, according to ?typeof and ?storage.mode, it doesn't >>>>>> seem to be >>>>>> so. Could somebody let me know if there is any difference? If >>>>>> there >>>>>> is, what the difference is? >>>>> >>>>> Dear Peng Yu; >>>>> >>>>> There is a difference. >>>> >>>> Would you please give me an example when they will be different? >>> >>> It took me about 20 seconds to find an example where they were >>> different >>> using typical objects in my workspace. You have been at this for >>> about a >>> year now. I think you are taking the easy route out, rather than >>> working >>> some of these answers out by yourself. >> >> Furthermore the answer is readily available from the obvious help >> pages, >> which you have been repeatedly directed to. > > I just realized that I meant to ask the difference between data.class > and class, rather than typeof and storage.mode, as I have tried the > example from ?data.class. And I get no differences between data.class > and class. Would you please let me know the difference between them if > there is any? Sorry for the confusion. > >> x=LETTERS >> data.class(factor(x)) # has a class attribute > [1] "factor" >> class(factor(x)) # has a class attribute > [1] "factor" >> data.class(matrix(x, ncol = 13)) # has a dim attribute > [1] "matrix" >> class(matrix(x, ncol = 13)) # has a dim attribute > [1] "matrix" >> data.class(list(x)) # the same as mode(x) > [1] "list" >> class(list(x)) # the same as mode(x) > [1] "list" >> data.class(x) # the same as mode(x) > [1] "character" >> class(x) # the same as mode(x) > [1] "character"Yet another question which the help page answers.>> >>David Winsemius, MD Heritage Laboratories West Hartford, CT
Reasonably Related Threads
- Typeof for character vector in dataframe returns integer
- Why does typeof() modify an object's "named" field?
- Unclear documentation on 'numeric' and 'integer' (R-lang.pdf)
- typeof(getOption("warn")) is "integer" instead of "double" in R unstable (2019-09-27 r77229)? Reproducible?
- data.frame() creates list?