search for: namelist

Displaying 20 results from an estimated 81 matches for "namelist".

2005 Apr 16
2
String in data frame
...for d$num is just a normal list without any levels with it, and this is what i want. but the second d$name is a list with a levels with it. the list i have for d$name is: d$name = (bal bal bal bal bal bal), levlels:bal, however, when i want to have for following code, something different happens: namelist <- NA; a <- d$name[1]; #this will outputs a = bal, lelvels:bal namelist <- c(namelist, a); #this does not outptu (NA, bal), instead it outputs (NA, 1), if i keep #adding a to the namelist, it keeps adding 1 to the namelist instead of bal. However, i want to add bal to the namelist, not 1,...
2008 Dec 16
2
Problem assigning "NA" as a level name in a list
I want to generate a list (called "dataList" below) where each of its levels is named. These names are assigned to nameList, which contains all possible permutations of size two taking letters from a larger alphabet, e.g., "aa",...,"Fd",..,"Z1",... One of these permutations is the character string "NA". It seems that when I try to name one of the dataList levels "NA&quo...
2007 Nov 15
1
program I used to test xattrs
...lt;sys/time.h> #include <attr/xattr.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <dirent.h> #include <unistd.h> static int get_dir_list(char *dir, char ***filelist) { struct dirent **namelist; int n = 0, temp, i = 0, size = 0; struct stat buf; temp = n = scandir(dir, &namelist, NULL, alphasort); if (n < 0) { perror("scandir"); return -1; } if (n == 2) { while (n--) free(namelist[n]); free(namelist); return n; } /* we don't want '.' or...
2011 Apr 21
1
problem subsetting of a reference class
I am trying to define subset operator for a reference class and hitting some problem i am unable to diagnose.To give an example, here is a toy class generator that is a wrapper around a list tmpGEN<-setRefClass("TMP", fields=list( namelist="list" )) tmpGEN$methods('add'=function(obj, name){ namelist[[name]]<<-obj }) tmpGEN$methods('['=function(name){ if(class(name)!="character") stop('to return cache element need to pass its name') ind<-match(name, names(namelist))...
2009 Dec 07
0
Bunch of bugs in LibTheora, FFMPEG2THEORA, PNG2THEORA
...1); 682 } here ^^^ ... 146 #ifdef WIN32 147 int 148 alphasort (const void *a, const void *b) 149 { 150 return strcoll ((*(const struct dirent **) a)->d_name, 151 (*(const struct dirent **) b)->d_name); 152 } 153 154 int 155 scandir (const char *dir, struct dirent ***namelist, 156 int (*select)(const struct dirent *), int (*compar)(const void *, const void *)) 157 { 158 DIR *d; 159 struct dirent *entry; 160 register int i=0; 161 size_t entrysize; 162 163 if ((d=opendir(dir)) == NULL) 164 return(-1); 165 166 *namelist=NULL; 167 while ((entry=...
2007 Jul 31
1
[Bridge] brctl uses incorrect sysfs path
...;); if (f) { diff --git a/libbridge/libbridge_init.c b/libbridge/libbridge_init.c index e2eab77..f31addc 100644 --- a/libbridge/libbridge_init.c +++ b/libbridge/libbridge_init.c @@ -185,13 +185,18 @@ int br_foreach_port(const char *brname, int i, count; struct dirent **namelist; char path[SYSFS_PATH_MAX]; + struct stat st; - snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brport", brname); + snprintf(path, SYSFS_PATH_MAX, SYSFS_CLASS_NET "%s/brif", brname); count = scandir(path, &namelist, 0, alphasort);...
2001 Nov 29
0
a patch to tapply (PR#1186)
..."31" "R" ************** The patch: "tapply.new" <- function (X, INDEX, FUN = NULL, ..., simplify = TRUE) { FUN <- if (!is.null(FUN)) match.fun(FUN) if (!is.list(INDEX)) INDEX <- list(INDEX) nI <- length(INDEX) namelist <- vector("list", nI) names(namelist) <- names(INDEX) extent <- integer(nI) nx <- length(X) one <- as.integer(1) group <- rep(one, nx) ngroup <- one for (i in seq(INDEX)) { index <- as.factor(INDEX[[i]]) if (length(index) != nx) stop(&q...
2008 Apr 15
1
by inconsistently strips class - with fix
...lass. However, I haven't taken the time to work out if this will work in all cases. for example: function (X, INDEX, FUN = NULL, ..., simplify = TRUE) { FUN <- if (!is.null(FUN)) match.fun(FUN) if (!is.list(INDEX)) INDEX <- list(INDEX) nI <- length(INDEX) namelist <- vector("list", nI) names(namelist) <- names(INDEX) extent <- integer(nI) nx <- length(X) one <- 1L group <- rep.int(one, nx) ngroup <- one for (i in seq.int(INDEX)) { index <- as.factor(INDEX[[i]]) if (length(index) != nx)...
2004 Apr 08
1
Why are Split and Tapply so slow with named vectors, why is a for loop faster than mapply
...vector such as: tapply(actTime, chainId, function(x) x) Using the following function with a for loop accomplishes the job in a few seconds for all 70,000+ records: > splitWithNames <- function(dataVector, nameVector, factorVector){ + dataList <- split(dataVector, factorVector) + nameList <- split(nameVector, factorVector) + listLength <- length(dataList) + namedDataList <- list(NULL) + for(i in 1:listLength){ + x <- dataList[[i]] + names(x) <- nameList[[i]] + namedDataList[[i]] <- x + } + namedDataList + } > s...
1997 Dec 08
3
R-alpha: Bug in tapply in the Windows version of September
...t working in the Windows version of R=20 (Version 0.50 Beta (Sept 29, 1997)) In tapply <- function (x, INDEX, FUN=3DNULL, simplify=3DTRUE, ...)=20 ... The part: if (simplify && all(unlist(lapply(ans, length)) =3D=3D 1)) { ans <- unlist(ans, recursive =3D FALSE) names(ans)<-namelist[[1]] return(ans) } should be replaced by if (simplify && all(unlist(lapply(ans, length)) =3D=3D 1)) { ans <- unlist(ans, recursive =3D FALSE) if(length(INDEX) =3D=3D 1) { names(ans) <- namelist[[1]] } else { dim(ans) <- extent dimnames(ans) <- namelist }...
2011 Jul 29
3
[PATCH 1/3] klibc: Add scandir() and alphasort() support.
...libc/scandir.c diff --git a/usr/include/dirent.h b/usr/include/dirent.h index e324474..3b1ff59 100644 --- a/usr/include/dirent.h +++ b/usr/include/dirent.h @@ -30,4 +30,11 @@ static __inline__ int dirfd(DIR * __d) return __d->__fd; } +__extern int scandir(const char *dirp, struct dirent ***namelist, + int (*filter)(const struct dirent *), + int (*compar)(const struct dirent **, + const struct dirent **)); + +int alphasort(const struct dirent **a, const struct dirent **b); + #endif /* _DIRENT_H */ diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index af40367..40e61da 100...
2008 Nov 24
4
Calculating sum of letter values
Hi all If I have a string, say "ABCDA", and I want to convert this to the sum of the letter values, e.g. A -> 1 B -> 2 etc, so "ABCDA" = 1+2+3+4+1 = 11 Is there an elegant way to do this? Trying something like which(LETTERS %in% unlist(strsplit("ABCDA", ""))) is not quite correct, as it does not count repeated characters. I guess what I need is
2017 Jun 13
2
reading data
Hi all, I am using R to extract data on a regular basis. However, sometimes using the same script and the same data I am getting different observation. The library I am using and how I am reading it is as follows. library(stringr) namelist <- file("Adress1.txt",encoding="ISO-8859-1") Name <- read.fwf(namelist, colClasses="character", skip=2,sep="\t",fill=T, width =c(2,8,1,1,1,1,1,1,9,5)+1,col.names=ccol) Can some one suggest me how track the issue? Is it the lib...
2005 Jan 10
2
doing many commands within R
...all, I'm new to this list, so let me greet everyone. My problem is that I have several thousand data files which I want to perform a lot of R commands on, which are found in a seperate .R script. Now, what I did was within the R prompt, I used to read in a list of the data files. e.g. namelist <- readLines("list_of_names",n=-1) for (i in 1:100) { k <- function(namelist[i]) write(k,file="outputfile",append=TRUE) } Next, I tried automating the R commands by making a loop. Within the loop I called the R-script. Within ecery single loop R called the R-script and...
2006 Oct 03
2
strverscmp, scandir, alphasort and versionsort
...ir() function scans the directory dir, calling * filter() on each directory entry. Entries for which filter() * returns non-zero are stored in strings allocated via malloc(), * sorted using qsort() with the comparison function compar(), and * collected in array namelist which is allocated via malloc(). If * filter is NULL, all entries are selected. */ int scandir(const char *dir, struct dirent ***namelist, int(*filter)(const struct dirent *), int(*compar)(const void *, const void *)) { DIR *d; struct dirent *de, **list; int nl; if (!(d = opend...
2017 Jun 14
0
reading data
...gmail.com> wrote: > Hi all, > > I am using R to extract data on a regular basis. > However, sometimes using the same script and the same data I am > getting different observation. > The library I am using and how I am reading it is as follows. > > library(stringr) > namelist <- file("Adress1.txt",encoding="ISO-8859-1") > Name <- read.fwf(namelist, > colClasses="character", skip=2,sep="\t",fill=T, > width =c(2,8,1,1,1,1,1,1,9,5)+1,col.names=ccol) > > Can some one suggest me how track...
2002 Aug 01
2
RE: Missing files as seen by Explorer on a client (was Need help on this) **********FIXED******************
...no name list" > means > Whoops, I was wrong in the previous message: it looks like a samba-side problem! /******************************************************************* Utility function used to decide if the last component of a path matches a (possibly wildcarded) entry in a namelist. ********************************************************************/ BOOL is_in_path(char *name, name_compare_entry *namelist) The functiont looks for name in namelist, and almost every other list passed in is empty! This caused it to return false, and probably not return the name to Window...
1997 Aug 19
2
R-alpha: A few bugs in R-0.50-a3.
A few problems in R-0.50-a3 (which were also in R-0.49): 1) y <- c(10,11,12,13,14,NA,NA) n <- length(y) missed <- (1:n)[is.na(y)] notmissed <- (1:n)[!is.na(y)] blocks <- cut(missed,breaks=c(0,notmissed,n+1)) a <- function(v) { q <- range(v) c(q[1]-1,q[2]+1) } brackets <- tapply(missed,blocks,a) This codes gives the following in S: > brackets $"0+ thru 1":
2007 Nov 06
1
A suggestion for an amendment to tapply
...http://blogs.mbs.edu/fishing-in-the-bay/ -------------- next part -------------- ## The new function my.tapply <- function (X, INDEX, FUN=NULL, ..., simplify=TRUE) { FUN <- if (!is.null(FUN)) match.fun(FUN) if (!is.list(INDEX)) INDEX <- list(INDEX) nI <- length(INDEX) namelist <- vector("list", nI) names(namelist) <- names(INDEX) extent <- integer(nI) nx <- length(X) one <- as.integer(1) group <- rep.int(one, nx)#- to contain the splitting vector ngroup <- one for (i in seq.int(INDEX)) { index <- as.factor(IN...
2011 Aug 02
6
[PATCH v2 0/4] Support drop directories directly from kinit
This patchset applies to klibc mainline. This patchset introduces the ability to kinit to execute scripts or executable files present in in the initramfs before switching over to the root filesystem. It is implemented by first implementing scandir() and alphasort() as present in POSIX.1-2008 in klibc itself, and then using that as the basis for iterating and executing files via a run_scripts()