Displaying 20 results from an estimated 2155 matches for "unlists".
Did you mean:
unlist
2008 Nov 06
3
unlist & dataframes
Dear all,
I would like to know whether it is possible to unlist elements and keep the
original format of the data.
To make it more clear, let me give an exemple:
I have a list l of dataframes that I created with apply but which looks like
this:
x1=data.frame(Name=LETTERS[1:2],Age=1:2)
x2=data.frame(Name=LETTERS[3:4],Age=3:4)
l=list(x1,x2)
l
[[1]]
Name Age
1 A 1
2 B 2
[[2]]
Name
2011 May 19
1
Feature request: extend functionality of 'unlist()' by args 'delim=c("/", "_", etc.)' and 'keep.special=TRUE/FALSE'
Dear list,
I hope this is the right place to post a feature request. If there's
exists a more formal channel (e.g. as for bug reports), I'd appreciate a
pointer.
I work a lot with named nested lists with arbitrary degrees of
"nestedness". In order to retrieve the names and/or values of "bottom
layer/bottom tier", I love the functionality of 'unlist()', or
2008 Aug 20
0
unlist on nested lists of factors (PR#12572)
Here is a description and a proposed solution for a bug in unlist().
I've used version 2.7.2 RC (2008-08-18 r46382) to look at this, under
linux.
unlist(recursive=TRUE) incorrectly returns a factor with zero levels
when passed either a nested list of factors, or a data frame
containing only factor columns. You can't print() the result.
x <- list(list(v=factor("a")))
2007 May 13
2
relist, an inverse operator to unlist
Hi all,
I wrote a function called relist, which is an inverse to the existing
unlist function:
http://www.econ.upenn.edu/~clausen/computing/relist.R
Some functions need many parameters, which are most easily represented in
complex structures. Unfortunately, many mathematical functions in R,
including optim, nlm, and grad can only operate on functions whose domain is
a vector. R has a
2008 Oct 24
1
unlist change the ordered type
Hi the list,
unlist respect the all the atomic type except orderd (it change of
ordered into factor) :
### integer
class(unlist(list(1:5,1:3)))
#[1] "integer"
### numeric
class(unlist(list(1.2,3.5)))
#[1] "numeric"
### character
class(unlist(list("e","e")))
#[1] "character"
### factor
2007 Jan 17
2
problem with unlist POSIX date at midnight
Dear R-users,
I use unlist of POSIX dates to extract the year, hour etc. With that I
can search for files in my database which are in the form
'yyyymmddhh_synops.txt'
However, I get stucked during midnight where unlist just gives NA's.
The script is given below, the problem accurs at acc.period[16]
(midnight). However when I write out the character, unlist works well.
But
2010 Sep 26
4
Problem with unlist
Hello I want to unlist the attached element getting only the first element
in each element of the list. The last element of the list looks as this:
[[5065]]
[[5065]]$Pluv3Meses
[1] 274.4
[[5065]]$PluvMesesMedio
[1] 378.2667
[[5065]]$Pluv2UltimosMeses
[1] 23.33333
So I would like to get for each element of the list the element called
Pluv3Meses. The whole list has 5065 elements but when I try to
2011 May 26
2
What am I doing wrong with sapply ?
Statement 9 using sapply does not seem to give the correct answer (or at
least to me). Yet I do what I think is the same thing with statement 11 and
I get the answer I'm looking for.
9 : s <-sapply(unlist(v[c(1:length(v))]), max)
11: for(i in 1 :length(v)) v1[i] <- max(unlist(v[i]))
Shouldn't I get the same answer ?
library(XML)
rm(list=ls())
url <-
2016 Dec 02
3
unlist strips date class
Is this a bug?
> unlist(list(as.Date("2015-01-01")))
[1] 16436
[[alternative HTML version deleted]]
2011 Feb 04
3
lapply, strsplit, and list elements
Hi there,
I have a problem about lapply, strsplit, and accessing list elements,
which I don't understand or cannot solve:
I have e.g. a character vector with three elements:
x = c("349/077,349/074,349/100,349/117",
"340/384.2,340/513,367/139,455/128,D13/168",
"600/437,128/903,128/904")
The task I want to perform, is to generate a list,
2013 Sep 27
2
Locating inefficient code
Hi,
I have been using R for a few months and I have this working
code. Don't seen any problem but this takes a long time. So if I have
about 30000 rows it takes a few minutes. If I have 100000 it does not seem
to complete.
Original Data:
Proto Recv-Q Send-Q Local-Address Foreign-Address State
tcp 0 0 172.20.100.2:60255
2012 Jun 19
1
need help with unlist(), losing NULL values
Hi,
I have a very rudimentary kind of question on using unlist(). I am
parsing a bunch of JSON text using rjson package. Some data elements in
a dictionary happen to be null which rjson parses correctly.
> fromJSON(json_str='{"query":{"A":10, "B":null, "C":"hello"},
"query":{"A":20, "B":null,
2006 Oct 29
1
Help with unlist
Dear r-helpers,
I have a list whose elements are
> str(durCut[[1]])
Ord.factor w/ 5 levels "vLow"<"low"<"med"<..: 3 2 5 2 2 2 4 4 3 5 ...
How do I unlist durCut into an ordered factor?
> str(unlist(durCut))
int [1:3024] 3 2 5 2 2 2 4 4 3 5 ...
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
2016 Dec 05
1
unlist strips date class
On 02 Dec 2016, at 23:13 , Herv? Pag?s <hpages at fredhutch.org> wrote:
> More generally one might reasonably expect 'unlist(x)' to be equivalent
> to 'do.call(c, x)' on a list 'x' where all the list elements are atomic
> vectors:
Well, both are generic, and e.g. there is no "Date" method for unlist(), but there is for c(). It is not clear that
2008 Aug 20
0
unlist on nested pairlists
unlist(recursive=FALSE) returns NULL elements when passed a nested
pairlist containing non-NULL data:
x <- pairlist(pairlist(1:2))
unlist(x, recursive=FALSE)
## [[1]]
## NULL
version 2.7.2 RC (2008-08-18 r46382) under linux
I'm unaware of any motivation for constructing the above data
structure, but if unlist is going to operate on it without error I
would be surprised if that is the
2010 Jun 26
2
Recursive indexing failed at level 2
Dear fellow R users,
I am replacing elements of a list like so:
pulse_subset[[1:20]]=unlist(pulse[i])[1:20]
where pulse is a list of lists, and pulse [i] has >20 values.
This gives the error "Recursive Indexing failed at level 2". But,
interestingly this instruction is part of a loop which has gone through
about 200,000 iterations before giving this error.
Actual code:
>
2011 Aug 30
4
weird apply() behavior
Hi, I had a weird results from using apply(). Here is an simple example:
> y<-data.frame(list(a=c(1,NA),b=c('2k','0')))
> y
??? a???? b
1? 1?? 2k
2 NA?? 0
> apply(y,1,function(x){x<-unlist(x); if (!is.na(x[2]) & x[2]=='2k' & !is.na(x[1]) & x[1]=='1') 1 else 0} )
This should print "1 0" as output, as demonstrated by:
>
2018 May 08
2
unlist errors on a nested list of empty lists
Reproducible example:
x <- list(list(list(), list()))
unlist(x)
*> Error in as.character.factor(x) : malformed factor*
What should happen:
unlist(x)
> NULL
R.version
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 5.0
year 2018
month 04
day
2008 Jun 12
2
numbers as part of long character
Hi,
I'm looking for some way to pick up the numbers which are contained and buried in a long character.
For example,
outtree.new="(((B:1204.25,E:1204.25):7581.11,F:8785.36):8353.85,C:17139.21);"
num.char =
2011 Sep 13
1
writing a loop using several list()-objects
Hi there,
I am looking for some help with a loop which uses three list()-objects:
"sequence" has got numbers, "start" and "end" have got the begin/end time
points which should be applied to the numbers in "sequence". length() of all
three objects is identical, length() of vectors stored in "sequence" is
longer than length() of "start"