Displaying 20 results from an estimated 2000 matches similar to: "Problem assigning "NA" as a level name in a list"
2004 Apr 08
1
Why are Split and Tapply so slow with named vectors, why is a for loop faster than mapply
First, here's the problem I'm working on so you understand the context. I
have a data frame of travel activity characteristics with 70,000+ records.
These activities are identified by unique chain numbers. (Activities are
part of trip chains.) There are 17,500 chains.
I use the chain numbers as factors to split various data fields into lists
of chain characteristics with each element of
2005 Apr 16
2
String in data frame
hello,
how can take the string in the data frame.
right now i have a table that create as a data frame and stored in the file called "data.xls" and now i want to read data frame as a table in my another r program, i used the following command:
the first column of the data frame is just one number called "num", but the second one a list of string, called "name".
d
2012 Feb 21
3
Plot Many Data to same plot
Dear all,
I have a function that for a variable number of inputs plots them to the same plot
I am doing this quite simply by
plot(seq(from=start, to=stop, length.out=np), datalist[[1]]$dataset
xlim=c(start, stop), ylim=c(0, 1), type="l")
2007 Dec 20
1
auto named savings (pngs & data-frames)
Hello, i only got a small problem.
i try to create automatic new dataframes, or png?s. the main problem i
got is:
how can i create automatic a new name for a file (read out by simply
"for") -
i tried to use "(paste...) but theres an errormessage, about a wrong
declination. R told it is as.character, but need as.Real.
Should i use another method than "paste"?
i tried as
2012 May 22
1
confused with indexing
Dear all,
I have a code that looks like the following (I am sorry that this is not a reproducible example)
indexSkipped<-NULL
....code Skipped that might alter indexSkipped
if (length(indexSkipped)==0)
spatial_structure<-spatial_structures_from_measurements(DataList[[i]]$Lon,DataList[[i]]$Lat,meanVector)
else
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
})
2007 Jul 31
1
[Bridge] brctl uses incorrect sysfs path
Hi,
I noticed that brctl (or more accurately, libbridge) is using the wrong path
when doing various lookups in sysfs: e.g. /sys/class/net/brXXX/stp_state
when it should use /sys/class/net/brXXX/bridge/stp_state. This doesn't
cause any problems on most systems as it falls back to the ioctl when the
sysfs attempt fails; however the ioctl method is apparently deprecated. I
believe the
2013 Feb 03
2
Compare each element of a list to a vector
Hello R-helpers,
I have a vector
x<-c(1,2,3)
and a list that contains vectors
datalist<-list(c(1,2,3),c(2,3,4),c(3,4,5),c(4,5,6))
and I would like to identify those list elements that are identical to x.
I tried
> datalist %in% x
[1] FALSE FALSE FALSE FALSE
but I am obviously using %in% incorrectly. I also tried messing around with
lapply but I can't figure out how to specify
2004 Sep 14
1
Re: datalist
Hi,
The following is a cut/paste from http://developer.r-project.org/200update.txt:
...
3) When a package is installed, all the data sets are loaded to see
what they produce. If this is undesirable (because they are
enormous, or depend on other packages that need to be installed
later, ...), add a `datalist' file to the data subdirectory as
described in `Writing R
2008 Apr 15
1
by inconsistently strips class - with fix
summary:
The function 'by' inconsistently strips class from the data to which
it is applied.
quick reason:
tapply strips class when simplify is set to TRUE (the default) due to
the class stripping behaviour of unlist.
quick answer:
This can be fixed by invoking tapply with simplify=FALSE, or changing
tapply to use do.call(c instead of unlist
executable example:
1997 Dec 08
3
R-alpha: Bug in tapply in the Windows version of September
The function tapply is not 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
2013 Mar 23
1
sysdata.rda vs. rda files in data directory
Dear developeRs,
my package FrF2.catlg128 holds large catalogues and is supposed to gain
additional ones. All the catalogues are intended for the user.
So far, the catalogues were stored in the data directory, and LazyData
was "no". I understand that this is not considered wise any more (if it
ever was), so that I want to change to LazyData "yes" with the next
release
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",
2005 Jan 10
2
doing many commands within R
Dear 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 <-
2006 Feb 12
1
mean from list
hi all,
I have a simple problem that i am not able to solve. I've a list called
datalist with the following structure:
[...]
[[10]]
[[10]]$a
-1 0 1
-1 31 5 2
0 6 7 5
1 1 7 36
[[10]]$b
-1 0 1
-1 31 5 2
0 6 7 5
1 1 7 36
[[10]]$c
[1] 0.855
[[10]]$d
[1] 0.855
[...]
with [[1]] ... [[100]]. How can i get the mean value of datalist[[x]]$d,
where x
2017 Dec 04
0
Dynamic reference, right-hand side of function
The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
datanames <- paste0("aa_", 2000:2007)
datalist <- lapply(datanames, get)
names(datalist) <- datanames
col1 <- lapply(datalist, "[[", 1)
colnum <- lapply(col1, as.numeric)
(The 2nd
2006 Oct 03
2
strverscmp, scandir, alphasort and versionsort
Hello,
These are implementations of strverscmp, scandir, alphasort and
versionsort, and some test cases for them.
I know these aren't in POSIX, but they're useful, nonetheless, and
someone else might be interested in them.
Regards,
Luciano Rocha
--
lfr
0/0
-------------- next part --------------
/* ----------------------------------------------------------------------- *
*
*
2011 Jul 29
3
[PATCH 1/3] klibc: Add scandir() and alphasort() support.
Add support for scandir() and alphasort() as defined in POSIX.1-2008.
Signed-off-by: Mike Waychison <mikew at google.com>
---
usr/include/dirent.h | 7 +++++
usr/klibc/Kbuild | 2 +
usr/klibc/scandir.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 1 deletions(-)
create mode 100644 usr/klibc/scandir.c
diff --git
2017 Jun 14
0
reading data
You need to provide reproducible data. What does the file contain? Why
are you using 'sep=' when reading fixed format. You might be able to
attach the '.txt' to your email to help with the problem. Also you did not
state what the differences that you are seeing. So help us out here.
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what
2006 Feb 12
1
R: mean from list
great!! thanks very much, mean(unlist(lapply(listdata, function(z) z$c)))
works well.
and what about getting the average table $a (displaying the average elements
across all 1000 matrix)? could you please help me? I am struggling with
this...
thanks in advance
Roberto
mean(unlist(lapply(x, function(z) z$d))) should do the trick
On Sun, 12 Feb 2006 20:06:12 +0000, statistical.model at