search for: typeof

Displaying 20 results from an estimated 1092 matches for "typeof".

2014 Apr 02
3
Typeof for character vector in dataframe returns integer
...nt to know is this behavior expected and why is that ? Need some help gender <- c("F", "M", "M", "F", "F", "M", "F", "F") > age <- c(23, 25, 27, 29, 31, 33, 35, 37) > df<- data.frame(gender,age) > typeof(df[[1]]) [1] "integer" >>>>>>>>>>>>> Why is this integer . *Should not it be character ?* > typeof(df[[2]]) [1] "double" > typeof(gender) [1] "character" > typeof(age) [1] "double" > In my code i am tryi...
2004 Sep 08
4
factor always have type integer
typeof applied to a factor always seems to return "integer", independently of the type of the levels. This has a strange side effect. When a variable is "imported" into a data frame, its type changes. character variables automatically are converted to factors when imported into data fr...
2010 Feb 10
3
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, wh...
2013 Jan 22
1
c(), rbind and cbind functions - why type of resulting object is double
Hello Everyone, I am using R 2.15.0 and I came across this behaviour and I was wondering why I don't get an integer vector or and integer matrix with the following code: > z <- c(1, 2:0, 3, 4:8) > typeof(z) [1] "double" > z <- rbind(1, 2:0, 3, 4:8) Warning message: In rbind(1, 2:0, 3, 4:8) : number of columns of result is not a multiple of vector length (arg 2) > typeof(z) [1] "double" > z <- matrix(c(1, 2:0, 3, 4:8), nrow = 5) > typeof(z) [1] &quot...
2013 Mar 22
1
Why does typeof() modify an object's "named" field?
Hello, Doing typeof() on an object appears to reset the "named" field in its sxpinfo header to 2, which can change the way that subsequent subassignment operations are carried out: X <- 1:5e7 .Internal(inspect(X)) # @4eeb0008 13 INTSXP g0c7 [NAM(1)] (len=50000000, tl=0) 1,2,3,4,5,... system.time(X[1] &l...
2020 Jun 30
2
[PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y
...at kernel.org> wrote: > +#define __READ_ONCE(x) \ > +({ \ > + int atomic = 1; \ > + union { __unqual_scalar_typeof(x) __val; char __c[1]; } __u; \ > + typeof(&(x)) __x = &(x); \ > + switch (sizeof(x)) { \ ... > + atomic ? (typeof(x))__u.__val : (*(volatile typeof(x) *)__x); \ > +}) This...
2020 Jun 30
2
[PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y
...at kernel.org> wrote: > +#define __READ_ONCE(x) \ > +({ \ > + int atomic = 1; \ > + union { __unqual_scalar_typeof(x) __val; char __c[1]; } __u; \ > + typeof(&(x)) __x = &(x); \ > + switch (sizeof(x)) { \ ... > + atomic ? (typeof(x))__u.__val : (*(volatile typeof(x) *)__x); \ > +}) This...
2007 Aug 22
0
3 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_function.c test/trace
...== "__proto__" && o[prop] == undefined) + return true; #endif return false; @@ -260,71 +332,63 @@ function trace_properties_recurse (o, pr if (flags != "") flags = " (" + flags + ")"; - var id_string = ""; - if (typeof (o[prop]) == "object" || typeof (o[prop]) == "function") - id_string = "[" + o[prop]["mySecretId"] + "]"; - - // put things together - var output = prop + flags + " = " + typeof (o[prop]) + id_string; - + var value = "&q...
2011 Aug 07
2
[PATCH] kinit minor checkpatch cleanup
...ff --git a/usr/kinit/kinit.h b/usr/kinit/kinit.h index c2e67b7..71414b1 100644 --- a/usr/kinit/kinit.h +++ b/usr/kinit/kinit.h @@ -36,17 +36,17 @@ ssize_t freadfile(FILE *f, char **pptr); * "unnecessary" pointer comparison. * From the Linux kernel. */ -#define min(x,y) ({ \ - typeof(x) _x = (x); \ - typeof(y) _y = (y); \ - (void) (&_x == &_y); \ - _x < _y ? _x : _y; }) +#define min(x, y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) -#defin...
2016 Nov 25
2
[PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE()
On Fri, Nov 25, 2016 at 01:40:44PM +0100, Peter Zijlstra wrote: > #define SINGLE_LOAD(x) \ > {( \ > compiletime_assert_atomic_type(typeof(x)); \ Should be: compiletime_assert_atomic_type(x); > WARN_SINGLE_COPY_ALIGNMENT(&(x)); \ > READ_ONCE(x); \ > }) > > #define SINGLE_STORE(x, v) \ > ({ \ > compiletime_assert_atomic_type(typeof(x)); \ idem > WARN_SINGLE_COPY_ALIGNMENT(&...
2016 Nov 25
2
[PATCH 0/3] virtio/vringh: kill off ACCESS_ONCE()
On Fri, Nov 25, 2016 at 01:40:44PM +0100, Peter Zijlstra wrote: > #define SINGLE_LOAD(x) \ > {( \ > compiletime_assert_atomic_type(typeof(x)); \ Should be: compiletime_assert_atomic_type(x); > WARN_SINGLE_COPY_ALIGNMENT(&(x)); \ > READ_ONCE(x); \ > }) > > #define SINGLE_STORE(x, v) \ > ({ \ > compiletime_assert_atomic_type(typeof(x)); \ idem > WARN_SINGLE_COPY_ALIGNMENT(&...
2010 Oct 06
3
Empty data frame does not maintain column type
Does anyone know why a data frame created with empty character columns converts them to integer columns? > df<-data.frame(a=character(0),b=character(0)) > df<-rbind(df,c("a","a")) > typeof(df[1,1]) [1] "integer" AsIs doesn't help: > df<-data.frame(a=I(character(0)),b=I(character(0))) > df<-rbind(df,I(c("a","a"))) > typeof(df[1,1]) [1] "integer" Any suggestions on how to overcome this would be appreciated. Best wishes, Da...
2019 May 23
4
[RFC][PATCH] kernel.h: Add generic roundup_64() macro
...;torvalds at linux-foundation.org> wrote: > On Thu, May 23, 2019 at 7:00 AM Steven Rostedt <rostedt at goodmis.org> wrote: > > > > +# define roundup_64(x, y) ( \ > > +{ \ > > + typeof(y) __y = y; \ > > + typeof(x) __x = (x) + (__y - 1); \ > > + do_div(__x, __y); \ > > + __x * __y; \ > > +}...
2012 May 22
2
how to remove the 'promise' attribute of an R object (.Random.seed)?
Hi, The problem arises when I lazyLoad() the .Random.seed from a previously saved database. To simplify the process of reproducing the problem, see the example below: ## this assignment may not really make sense, but illustrates the problem delayedAssign('.Random.seed', 1L) typeof(.Random.seed) # [1] "integer" rnorm(1) # Error in rnorm(1) : # .Random.seed is not an integer vector but of type 'promise' typeof(.Random.seed) # [1] "integer" So there must be an "attribute" "promise" somewhere attached to .Random.seed, and I can...
2012 May 22
2
how to remove the 'promise' attribute of an R object (.Random.seed)?
Hi, The problem arises when I lazyLoad() the .Random.seed from a previously saved database. To simplify the process of reproducing the problem, see the example below: ## this assignment may not really make sense, but illustrates the problem delayedAssign('.Random.seed', 1L) typeof(.Random.seed) # [1] "integer" rnorm(1) # Error in rnorm(1) : # .Random.seed is not an integer vector but of type 'promise' typeof(.Random.seed) # [1] "integer" So there must be an "attribute" "promise" somewhere attached to .Random.seed, and I can...
2015 Jun 01
2
sum(..., na.rm=FALSE): Summing over NA_real_ values much more expensive than non-NAs for na.rm=FALSE? Hmm...
I'm observing that base::sum(x, na.rm=FALSE) for typeof(x) == "double" is much more time consuming when there are missing values versus when there are not. I'm observing this on both Window and Linux, but it's quite surprising to me. Currently, my main suspect is settings in on how R was built. The second suspect is my brain. I hop...
2020 Aug 06
0
[vhost:vhost 32/65] drivers/virtio/virtio_input.c:247:3: warning: comparison of distinct pointer types ('typeof (_Generic((virtio_cread_v), __u8: (virtio_cread_v), __le16: (__builtin_constant_p((__u16)((__u16)(__le16)(virtio_cread_v)))
...LER=clang make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp at intel.com> All warnings (new ones prefixed by >>): >> drivers/virtio/virtio_input.c:247:3: warning: comparison of distinct pointer types ('typeof (_Generic((virtio_cread_v), __u8: (virtio_cread_v), __le16: (__builtin_constant_p((__u16)((__u16)(__le16)(virtio_cread_v))) ? ((__u16)((((__u16)((__u16)(__le16)(virtio_cread_v)) & (__u16)255U) << 8) | (((__u16)((__u16)(__le16)(virtio_cread_v)) & (__u16)65280U) >> 8))) : __fswab1...
2011 Feb 02
3
Applying multiple functions to one object
Dear list members, I recall seeing a convenience function for applying multiple functions to one object (i.e., almost the opposite of 'mapply?) somewhere. Example: If the function was named ?fun? the output of fun(3.14, mode, typeof, class) would be identical to the output of c(mode(3.14), typeof(3.14), class(3.14)) Is my memory failing me, or does such a function already exists in a package? Of course, it?s not difficult to define a summary function and apply this to the object, but writing, for example, fun(x, mean,...
2008 May 19
6
obtaining table cell text data
I''m writing some code to subset a table based on the contents of particular columns. My event handler starts off like this: subsetChange: function(e) { var subset = $F(''subsetSelector''); var rows = $$(''.content-row''); rows.each(function(row) { var value = row.down(''.Platform_Category'').childNodes[0].data;
2014 Jan 03
2
class() on substitute(...) output?
...oes it make sense to talk about the class of the output of substitute(...)? I'm puzzled by the following outputs: ee <- list( A = substitute( a <- 1 ), B = substitute({ a <- 1 }), C = substitute(( a <- 1 )), D = substitute( a == 1 ) ) > t(sapply(ee, FUN=function(e) { c(typeof=typeof(e), mode=mode(e), class=class(e)) })) typeof mode class A "language" "call" "<-" B "language" "call" "{" C "language" "(" "(" D "language" "call" "call" That...