On Fri, Feb 2, 2024, 01:37 TJUN KIAT TEO wrote:
> Is there a way to extract list of words in BioWordVec in R
>
library(text)
word_vectors <- textEmbed(texts = NULL, model = 'bioWordVecModel',
model_type = 'wordvectors')
word_list <- rownames(word_vectors$wordvectors)
[[alternative
I thought so too, but Google suggests there is at least one package on CRAN
with this symbol in it.
OP:
a) You should always mention which contributed package you are using. Most
references to this term online seem to be related to Python rather than R.
b) This seems like extremely
I *think* this might be better posted here:
https://bioconductor.org/help/support/
Cheers,
Bert
On Thu, Feb 1, 2024 at 4:37 PM TJUN KIAT TEO wrote:
> Is there a way to extract list of words in BioWordVec in R
>
> Thank you
>
> Tjun Kiat
>
> [[alternative HTML version deleted]]
>
>
Is there a way to extract list of words in BioWordVec in R
Thank you
Tjun Kiat
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do
Works like a charm.
Thanks so much.
--John Sparks
From: Bill Dunlap
Sent: Thursday, July 1, 2021 8:01 PM
To: Sparks, John
Cc: r-help@r-project.org
Subject: Re: [R] List / Matrix to Data Frame
Does this do what you want?
> df <- data.frame(check.names
8186
5 2016-09-30 45687 84263
6 2015-09-30 53394 93626
It may be easier to work with this, but again, if you need the dates to be
real dates, as in graphing.
Hope that helps.
-Original Message-
From: R-help On Behalf Of Bill Dunlap
Sent: Thursday, July 1, 2021 9:01 PM
To
Does this do what you want?
> df <- data.frame(check.names=FALSE,
lapply(c(Date="date",netIncome="netIncome",`Gross Profit`="grossProfit"),
function(nm)vapply(ISY, "[[", nm, FUN.VALUE=NA_character_)))
> str(df)
'data.frame': 36 obs. of 3 variables:
$ Date: chr "2020-09-30"
Hi R-Helpers,
I am taking it upon myself to delve into the world of lists for R. In no small
part because I appear to have discovered a source of data for an exceptionally
good price but that delivers much of that data in json format.
So over the last day or so I managed to fight the list
"I thought: why make this overly complicated,..."
Indeed, though "complicated" is in the eyes of the beholder.
One wonders whether any of this is necessary, though: see ?apply , as in
apply(a, 1, whatever...)
to do things rowwise.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind
On 2020-04-09 18:00 +, aiguo li wrote:
| That is awesome! Thanks.
Dear AiGuo,
I thought: why make this overly
complicated, when this is also
possible:
a <- matrix(LETTERS[1:16], nrow=4)
X <- split(x=a[,-1], f=a[,1])
lapply(X=X, FUN=as.factor)
Best,
Rasmus
On 2020-04-09 18:00 +, aiguo li wrote:
| That is awesome! Thanks.
I'm glad this was helpful for you!
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
On 2020-04-09 18:50 +0100, Rui Barradas wrote:
| Hello,
|
| Your post is unreadable, please repost in
| *plain text*, not HTML.
Hi! It was not so bad? I was able to
extract out the core parts at least to
prepare an answer ... maybe a bit hard with
no line breaks, but ...
Best,
Rasmus
Hello,
Your post is unreadable, please repost in *plain text*, not HTML.
Rui Barradas
Às 16:00 de 09/04/20, aiguo li via R-help escreveu:
Hello allI need to create a r list with each row as a list object and named with the
element in the first column. Illustrated below:> a<-
as.data
On 2020-04-09 15:00 +, aiguo li via R-help wrote:
| Hello allI need to create a r list with
| each row as a list object and named with
| the element in the first column.
Dear aiguo,
Perhaps this fits your bill?
a <- matrix(LETTERS[1:16], nrow = 4)
FUN <- function(x) { as.facto
Hello allI need to create a r list with each row as a list object and named
with the element in the first column. Illustrated below:> a<-
as.data.frame(matrix(LETTERS[1:16],nrow = 4))> a V1 V2 V3 V41 A E I M2 B
F J N3 C G K O4 D H L P
I want the list looks like
Hai Rui,
It seems doesnt work for me, the "" still there.
So I used this one (Bert suggestion),
test<-lapply(test,function(x){x$RR[x$RR==] <- NA; x})
Best,
Ani
On Sat, Oct 19, 2019 at 6:55 PM Rui Barradas wrote:
> Hello,
>
> Why not use read.xlsx argument 'na.strings', an
Hello,
Why not use read.xlsx argument 'na.strings', an argument that exists in
many file reading functions? (read.table, and derivatives.)
test <- lapply(sheets,function(i) {
read.xlsx("rainfall.xlsx", sheet = i,
startRow = 8, cols = 1:2,
na.strings = "")
})
Hi ani,
Sorry, a typo in the function - should be:
makeNA(x)<-function(x,varname,value) {
x[,varname][x[,varname]==value]<-NA
return(x)
}
Jim
On Fri, Oct 18, 2019 at 2:01 PM Jim Lemon wrote:
>
> Hi ani,
> You say you want to replace with NA, so:
>
> # it will be easier if you don't use
Hi ani,
You say you want to replace with NA, so:
# it will be easier if you don't use numbers for the names of the data frames
names(test) <- paste0("Y",1986:2015)
makeNA(x)<-function(x,varname,value) {
x[,varname][x[,varname]<-value]<-NA
return(x)
}
lapply(test,makeNA,list("RR",))
Thank you Mr. Bert, but my data frame is in the list,
here 'test' list of data frame have 30 data frames (elements), names '1986'
~ '2015', and each data frame contain two variables, date and R.
>a2<-rbind(test$`1987`)
>is.na(a2$RR)<- a2$RR==
Above is good enough but only for '1987'. Is it
I'm a little unclear, but maybe ?is.na .
As in:
> x <- c(1:3,)
> x
[1]123
> is.na(x) <- x== ## rhs is an "index vector" of logicals
> x
[1] 1 2 3 NA
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
--
Dear R-Help,
I have a list of data frame that I import from excel file using read.xlsx
command.
sheets <- openxlsx::getSheetNames("rainfall.xlsx")
test <- lapply(sheets,function(i) read.xlsx("rainfall.xlsx", sheet=i,
startRow=8, cols=1:2))
names(test) <- sprintf("%i", 1986:2015)
And I got a
On 7/20/19 5:17 PM, Jackson Rodrigues wrote:
Dear all,
My name is Jackson and I need a help in applying functions to a list of
tables.
Could anyone help me to use loop/array on a list of tables ?
I need to apply a group of functions (listed below) to a list of tables
I am not that good
?lapply
See also the"Intro to R" tutorial that ships with R. We(or at least I)
expect you to do your own homework learning basic R before posting here.
This is not a substitute for such efforts, but we are willing to help when
you get stuck. See the posting guide linked below and show us your own
Dear all,
My name is Jackson and I need a help in applying functions to a list of
tables.
Could anyone help me to use loop/array on a list of tables ?
I need to apply a group of functions (listed below) to a list of tables
I am not that good with loops or arrays or multiple functions.
So,
Thanks Rui and Ivan, works perfectly...
Andras
On Monday, February 4, 2019, 4:18:39 PM EST, Rui Barradas
wrote:
Hello,
Like this?
Map('[', listA, lapply(listB, '*', -1))
Hope this helps,
Rui Barradas
Às 21:01 de 04/02/2019, Andras Farkas via R-help escreveu:
> Hello everyone,
>
Hello,
Like this?
Map('[', listA, lapply(listB, '*', -1))
Hope this helps,
Rui Barradas
Às 21:01 de 04/02/2019, Andras Farkas via R-help escreveu:
Hello everyone,
wonder if you would have a thought on a function for the following:
we have
a<-sample(seq(as.Date('1999/01/01'),
On Mon, 4 Feb 2019 21:01:06 + (UTC)
Andras Farkas via R-help wrote:
> listA<-list(a,b,c)
> listB<-list(d,e,f)
>
> what I would like to do with a function <...> as opposed to manually
> is to derive the following answer
>
> listfinal<-list(a[-d],b[-e],c[-f])
The `Map` function, unlike
Hello everyone,
wonder if you would have a thought on a function for the following:
we have
a<-sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by="day"),5)
b<-sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by="day"), 4)
c<-sample(seq(as.Date('1999/01/01'),
Yes, exactly (heh, heh).
?fisher.test
is probably what is wanted.
For arbitrary rxc tables with fixed marginals, this is a difficult problem.
Mehta's efficient network algorithm to solve it can be found by a web
search on "algorithm for Fisher exact test."
-- Bert
On Fri, Nov 9, 2018 at
Seems like you are trying to recreate the calculations needed to perform
an exact test. Why not look at the code for that or even easier, just
use the function.
--
David.
On 11/8/18 8:05 PM, li li wrote:
Hi all,
I am trying to list all the 4 by 2 tables with some fixed margins.
For
Don't give up on for loops entirely... some of the largest time savings in
optimizing loops are achieved by managing memory effectively. [1]
[1] https://www.r-bloggers.com/r-tip-use-vectormode-list-to-pre-allocate-lists
On November 8, 2018 8:05:39 PM PST, li li wrote:
>Hi all,
> I am trying
Hi all,
I am trying to list all the 4 by 2 tables with some fixed margins.
For example, consider 4 by 2 tables with row margins 1,2,2,1 and
column margins 3,3. I was able to do it using the code below. However,
as seen below, I had to first count the total number of tables with
the specific
Hi Ferri,
Do you mean getting something like the vector of original values back?
boodat<-sample(LETTERS[1:4],100,TRUE)
bootab<-table(boodat)
untab<-function(x) {
lenx<-length(x)
newx<-NULL
for(i in 1:lenx) newx<-c(newx,rep(names(x)[i],x[i]))
return(newx)
}
untab(bootab)
Jim
On Thu, Sep 21,
Note that this data.frame(table(...)) makes a column for each argument to
table(...), plus a column for the frequencies so you can easily deal with
multiway tabulations.
> rawData <- data.frame(
+ sizes = c("Small", "Large", "Large", "Large"),
+ colors = c("Red", "Blue", "Blue", "Red"),
+
unique(x) will give you the distinct values in x. table(x) will give you
the distrinct values and their frequencies as an array with dimnames.
data.frame(table(x)) will give you a 2-column data.frame with the distinct
values and their frequencies.
> values <- c("Small", "Large", "Large",
y
Texas A University
College Station, TX 77843-4352
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ferri Leberl
Sent: Thursday, September 21, 2017 8:01 AM
To: r-help@r-project.org
Subject: [R] List of occuring values
Dear all,
ftable produces a list of
Dear all,
ftable produces a list of the frequencies of all occuring values.
But how about the occuring values?
How can I retrieve a list of occuring values?
How can I retrieve a table with both the list of occuring values and their
respective frequencies?
Thank you in advance,
Yours, Ferri
> On Sep 9, 2017, at 11:45 AM, Andre Mikulec wrote:
>
> list subselect by name ?
> -
>
> I have this 'list of two elements of named elements.'
>
>> list(letters=letters, LETTERS=LETTERS)[c("letters","LETTERS")]
>
> $letters
> [1] "a" "b" "c"
list subselect by name ?
-
I have this 'list of two elements of named elements.'
> list(letters=letters, LETTERS=LETTERS)[c("letters","LETTERS")]
$letters
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s"
[20] "t" "u" "v" "w" "x" "y" "z"
On Thu, 6 Apr 2017, Tintin wrote:
Hi
How do I create an element with specificiation " Class 'Date' num "
The problem arises when I try to construct my own data structure set in the
"termstrc" package. The model list should look like:
R> str(govbonds$GERMANY)
List of 8
$ ISIN
: chr [1:52]
Hi
How do I create an element with specificiation " Class 'Date' num "
The problem arises when I try to construct my own data structure set in the
"termstrc" package. The model list should look like:
R> str(govbonds$GERMANY)
List of 8
$ ISIN
: chr [1:52] "DE0001141414" "DE0001137131"
On 3/4/2017 7:54 AM, Tomás Pérez C. wrote:
I am working with raster images of modis of the satellites aqua and terra
and I need to combine the images by its day and year (originally in Julian
day). However, for the earth I have 6031 images and for aqua 5277. I want
to know how to create an
I am working with raster images of modis of the satellites aqua and terra
and I need to combine the images by its day and year (originally in Julian
day). However, for the earth I have 6031 images and for aqua 5277. I want
to know how to create an object that selects the images for both folders
| mashra...@yahoo.com
- Original Message -
From: André Luis Neves <andrl...@ualberta.ca>
To: r-help@r-project.org
Sent: Monday, 14 March 2016, 23:20
Subject: [R] List funtion
Dear,
I have the following data:
v1 <- c(8,4,9,12)
v2 <- c(7, 8, 11)
my_list <- list(v1,v2)
rep
Hello,
rep() is vectorized so you can do
rep (my_list, 2:3)
Hope this helps,
Rui Barradas
Citando André Luis Neves :
> Dear,
>
> I have the following data:
>
> v1 <- c(8,4,9,12)
> v2 <- c(7, 8, 11)
> my_list <- list(v1,v2)
> rep (my_list,3)
>
> My question is how I
Dear,
I have the following data:
v1 <- c(8,4,9,12)
v2 <- c(7, 8, 11)
my_list <- list(v1,v2)
rep (my_list,3)
My question is how I can modify my command line to create a list called my_list
containing two copies of the first vector (v1) and three copies of the vector
2 (v2).
The above command
Hi R users,
I am looking for examples of software that comes with an inbuilt connector
to Rserve. The only thing I have found so far is Tableau:
http://www.simafore.com/blog/bid/120209/Integrating-Tableau-and-R-for-data-analytics-in-four-simple-steps
Please let me know if anyone knows of more
Dear all,
I use Thunderbird 31.6.0 on Mac OS 10.6.8 to download my e-mails.
Since this morning, Thunderbird downloads several times the same e-mails
from the list, some even being from yesterday. It occurs only with
e-mails from the R-help and not with my other professional and private
Dear all,
I use Thunderbird 31.6.0 on Mac OS 10.6.8 to download my e-mails.
Since this morning, Thunderbird downloads several times the same e-mails
from the list, some even being from yesterday. It occurs only with
e-mails from the R-help and not with my other professional and private
I don't think you are correctly keeping track of the structure of your
objects.
(and my email software may mess up the indentation, but I can't prevent it)
I have not tested, but try replacing
out[i]$phi_0 - x$phi_0
out[i]$maxlike - x$maxlike
out[i]$bigp - x$bigp
with
out[[i]] -
Erin,
I think you'll have heard people requesting _reproducible_ examples several
times by now... This one isn't.
Offhand, I'd suspect that the issue has to do with your single-bracket indexing
of the list out. Try out[[i]].
-Peter
On 26 Mar 2015, at 19:22 , Erin Hodgess
Hello!
I am having some trouble with some list output.
Here is my code:
geobunch - function(y) {
out - vector(list,3)
aic - numeric(length=3)
print(str(out))
for(i in 1:3) {
x - geomin(y,i)
print(i)
print(x)
It's the double bracket issue.
I replaced that, and all is well.
Thanks to Peter and Don.
Sincerely,
Erin
On Thu, Mar 26, 2015 at 3:21 PM, MacQueen, Don macque...@llnl.gov wrote:
I don't think you are correctly keeping track of the structure of your
objects.
(and my email software may
On 16 Feb 2015, at 17:43 , Troels Ring tr...@gvdnet.dk wrote:
Dear friends - this is simple I know but I can figure it out without your
help.
I have for each of 2195 instances 10 variables measured at specific times
from 6 to several hundred, so if I just take one of the instances, I can
You have two named objects when your goal is to have one that contains five
others.
ASL - vector( list, 5 )
for (j in 1:5){
ASL[[j]] - vector( list, 5 )
for (i in 1:5) {
ASL[[j]][[i]] - i^j
}
}
---
Jeff Newmiller
Dear friends - this is simple I know but I can figure it out without
your help.
I have for each of 2195 instances 10 variables measured at specific
times from 6 to several hundred, so if I just take one of the instances,
I can make a list of the 10 variables together with their variable
times.
Is this what you mean:
ASL - list()
for (j in 1:5){
RES - list()
for (i in 1:5) RES[[i]] - i ^ j # create list
ASL[[j]] - RES # store 'list of list'
}
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to
Thanks to Jim, Peter and Jeff who all saw the solution!
Best wishes
Troels
Den 16-02-2015 kl. 18:46 skrev Jeff Newmiller:
You have two named objects when your goal is to have one that contains five
others.
ASL - vector( list, 5 )
for (j in 1:5){
ASL[[j]] - vector( list, 5 )
for (i in
You can let lapply() do the preallocation and the looping for you with
ASL - lapply(1:5, function(j) lapply(1:5, function(i) i^j))
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Feb 16, 2015 at 9:46 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us
wrote:
You have two named objects when
Thank you Jeff for your tips, I found what I was looking for.
Stefano
Da: Jeff Newmiller [jdnew...@dcn.davis.ca.us]
Inviato: lunedì 12 gennaio 2015 9.13
A: Stefano Sofia; r-help@r-project.org
Oggetto: Re: [R] list of vectors which are part of an initial
library(gtools)
running(1:5, fun=I, align=center, width=3, allow.fewer=TRUE)[c(-1,-7)]
Clue found at http://stackoverflow.com/questions/1311920/lagging-variables-in-r
---
Jeff NewmillerThe .
Dear list users,
given for example the vector a - c(1:5), which is the easiest way to create a
list of 5 vectors with three elements each apart from the head and the tail,
like
1 2
1 2 3
2 3 4
3 4 5
4 5
? I tried to use the split command, with no success. Could somebody show me
hints for an
Your 'x' has length 2, so x[[3]] cannot be calculated ('subscript out of
bounds' is what I get). You can check for this with length(x)3.
In general, you want to be more precise: 'does not have a value', 'is
NULL', and 'is empty' are not synonymous. I'm not sure what 'does not have
a value'
Hello,
Kindly I have a list of lists as follow
x
[[1]]
[1] 7
[[2]]
[1] 3 4 5
as showen x[[3]] does not have a value and it has NULL, how can I check on this
how to test if x[[3]] is empty.
thanks in advance
Ragia
[[alternative HTML version
Hi,
On Dec 20, 2014, at 10:58 AM, Ragia Ibrahim ragi...@hotmail.com wrote:
Hello,
Kindly I have a list of lists as follow
x
[[1]]
[1] 7
[[2]]
[1] 3 4 5
as showen x[[3]] does not have a value and it has NULL, how can I check on
this
how to test if x[[3]] is empty.
In general
Hello,
Your list seems to have only 2 elements. You can check this with
length(x)
Or you can try
lapply(x, is.null)
Hope this helps,
Rui Barradas
Em 20-12-2014 15:58, Ragia Ibrahim escreveu:
Hello,
Kindly I have a list of lists as follow
x
[[1]]
[1] 7
[[2]]
[1] 3 4 5
as showen x[[3]]
This can be tricky, because depending on what the missing object is, you can
get either NULL, NA, or an error. Moreover is.na() behaves differently when
evaluated on its own, or as the condition of an if() statement. Here is a
function that may make life easier. The goal is NOT to have to pass
Boris et. al:
Indeed, corner cases are a bear, which is why it is incumbent on any
OP to precisely define what they mean by, say, missing,
null,empty, etc.
Here is an evil example to illustrate the sorts of nastiness that can occur:
z - list(a=NULL, b=list(), c=NA)
with(z,{
+
This may be out of context, but on the face of it, this claim is wrong:
On 20/12/2014, 1:57 PM, Boris Steipe wrote:
Moreover is.na() behaves differently when evaluated on its own, or as
the condition of an if() statement.
The conditions in an if() statement are not evaluated in special
Thanks. This is what I was referring to:
x - rep(NA, 3)
is.na(x)
[1] TRUE TRUE TRUE
if (is.na(x)) {print(True)}
[1] True
Warning message:
In if (is.na(x)) { :
the condition has length 1 and only the first element will be used
You are of course right - the warning is generated by if(), not by
Hi
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Munjal Patel
Sent: Monday, July 14, 2014 8:45 PM
To: r-help@r-project.org
Subject: [R] List of Lists by for Loop
Dear Experts,
I have a one more doubt about making list
Munjal,
Something like this should work:
Digits = c(20, 30, 40, 50, 60)
result = vector(length(Digits), mode=list)
names(result) = Digits
for(j in seq(Digits)) {
a = vector(Digits[j], mode=list)
b = vector(Digits[j], mode=list)
for(i in 1:Digits[j]) {
#Do Calculation
a[[i]] = data.frame()
Dear Experts,
I have a one more doubt about making list of lists.
Here is the simple code i have made.
I am doing the following for only one digit=20
a=vector(20,mode=list)
b=vector(20,mode=list)
for (i in 1:20){
#Do Calculation
a[[i]]=data.frame()
b[[i]]=data.frame()
}
Now i have
Dear Experts,
I have a one more doubt about making list of lists.
Here is the simple code i have made.
I am doing the following for only one digit=20
a=vector(20,mode=list)
b=vector(20,mode=list)
for (i in 1:20){
#Do Calculation
a[[i]]=data.frame()
b[[i]]=data.frame()
}
Now i have to
It's documented in the Encodings section of ?file:
As from R 3.0.0 the encoding UTF-8-BOM is accepted for reading and
will remove a Byte Order Mark if present (which it often is for files
and webpages generated by Microsoft applications). If it is required
(it is not recommended) when writing it
This question was spawned by another thread entitled R on Windows
crashes when source'ing UTF-8 file.
The solution to that problem was to use the _proper_ encoding=
parameter of the source() function. But where are they documented? Or
how do I find them in R itself? I ask because the proper
On Mon, Apr 21, 2014 at 10:01 PM, arun smartpink...@yahoo.com wrote:
Hi,
#or you could use:
do.call(rbind,result)
A.K.
Excellent. Thank you. That also saves a library requirement sine I am
not using plyr anywhere else.
Cheers,
Tim
On Monday, April 21, 2014 4:48 PM, Timothy W. Cook
On Tue, Apr 22, 2014 at 12:24 AM, Jim Holtman jholt...@gmail.com wrote:
also
do.call(rbind, result)
Thanks Jim. I appreciate it.
Sent from my iPad
On Apr 21, 2014, at 16:47, Timothy W. Cook t...@mlhim.org wrote:
Okay, all day on this and I send the msg. and almost immediately
I am processing an arbitrary number of XML files and extracting specific
nodes. I then create a dataframe for each nodeset.
I return a list containing these dataframes.
Example:
str(result)List of 2
$ :'data.frame': 1 obs. of 5 variables:
..$ data-name : chr Etiologic diagnosis
Okay, all day on this and I send the msg. and almost immediately discover
that:
dat - ldply(result)
solves the problem.
On Mon, Apr 21, 2014 at 5:40 PM, Timothy W. Cook t...@mlhim.org wrote:
I am processing an arbitrary number of XML files and extracting specific
nodes. I then create a
Hi,
#or you could use:
do.call(rbind,result)
A.K.
On Monday, April 21, 2014 4:48 PM, Timothy W. Cook t...@mlhim.org wrote:
Okay, all day on this and I send the msg. and almost immediately discover
that:
dat - ldply(result)
solves the problem.
On Mon, Apr 21, 2014 at 5:40 PM, Timothy W.
also
do.call(rbind, result)
Sent from my iPad
On Apr 21, 2014, at 16:47, Timothy W. Cook t...@mlhim.org wrote:
Okay, all day on this and I send the msg. and almost immediately discover
that:
dat - ldply(result)
solves the problem.
On Mon, Apr 21, 2014 at 5:40 PM, Timothy W.
Many thanks:)
I have a list(), eg. named opt, I want to check and assign values to it:
if(is.null(opt$a)) opt$a = 'x'
if(is.null(opt$b)) opt$a = 'y'
...
I need to do a lot of these jobs, so I write a function to simplify it:
'%=%' = function(x, y){
if(is.null(x)) {
x - y
}
}
Look carefully at your output (and I don't think that you are showing
us the output of what you actually ran in the order that you ran it).
After running `x %=% 1` you should see that x has the value `1`, but
your output shows `2`, this is the result of the next command `y$a %=%
2`, see the `-`
See fortune(174).
It is best to avoid using '-', if you tell us what you are trying to
accomplish then we may be able to provide a better means to accomplish
it.
On Sat, Oct 19, 2013 at 10:28 PM, Taiyun Wei weitai...@gmail.com wrote:
Dear All,
opt = list()
opt$aa - TRUE
Error in opt$aa -
On Oct 19, 2013, at 9:28 PM, Taiyun Wei wrote:
Dear All,
opt = list()
opt$aa - TRUE
Error in opt$aa - TRUE : object 'opt' not found
Try _not_ using `-`
Why?
There wasn't an object by htat name in the enclosing environment.
--
David Winsemius
Alameda, CA, USA
Dear All,
opt = list()
opt$aa - TRUE
Error in opt$aa - TRUE : object 'opt' not found
Why?
--
Regards,
Taiyun
--
Taiyun Wei weitai...@gmail.com
Homepage: http://blog.cos.name/taiyun/
Phone: +86-15201142716
Renmin University of China
__
.
maybe
sapply(lapply(your.list, coef), rbind)
can do it.
Regards
Petr
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of eliza botto
Sent: Wednesday, September 11, 2013 4:23 PM
To: r-help@r-project.org
Subject: [R] list
,] 0.01788307 -0.5624307
A.K.
- Original Message -
From: eliza botto eliza_bo...@hotmail.com
To: r-help@r-project.org r-help@r-project.org
Cc:
Sent: Wednesday, September 11, 2013 10:22 AM
Subject: [R] list to matrix
Dear useRs,
If i have a list of the following form and i want to convert
Hi,
set.seed(249)
dat1- as.data.frame(matrix(sample(1:20,40*20,replace=TRUE),ncol=20))
#Based on your code:
vecNew-sort(t(as.data.frame(lapply(dat1,sum))),decreasing=TRUE)[1:10]
#or
vec1-sort(unlist(lapply(dat1,sum),use.names=FALSE),decreasing=TRUE)[1:10]
identical(vec1,vecNew)
#[1] TRUE
Re: [R] List of lists
Jim Lemon
of class c
('integer', 'numeric')
Thanks,
Mohan
Re: [R] List
Hi,
I am creating a list of 2 lists, one containing filenames
and the other file descriptors. When I retrieve them I am unable to close
the file descriptor.
I am getting this error when I try to call close(filedescriptors
[[2]][[1]]).
Error in UseMethod(close) :
no applicable
On 07/30/2013 10:05 PM, mohan.radhakrish...@polarisft.com wrote:
Hi,
I am creating a list of 2 lists, one containing filenames
and the other file descriptors. When I retrieve them I am unable to close
the file descriptor.
I am getting this error when I try to call
Dear all,
Could someone please point me to the definitive list of valid
characters that are allowed in object names in R? I believe that the
following list covers them:
_.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
but I would like to make sure.
Thank you,
Liviu
--
Do you
On 13-07-27 7:36 AM, Liviu Andronic wrote:
Dear all,
Could someone please point me to the definitive list of valid
characters that are allowed in object names in R? I believe that the
following list covers them:
_.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
but I would like
On Sat, Jul 27, 2013 at 3:08 PM, Duncan Murdoch
murdoch.dun...@gmail.com wrote:
Your question is a little ambiguous. All characters are allowed in object
names, but the parser will only recognize some of them if they are quoted in
backticks.
The ones it recognizes without the backticks are
Hello all.
I am interested in creating a mutable list object in R.
Ideally I would do it through something like this:
x - list(a = list(1:4), b = miao, c = 4:1)
x_RC - as.RefClass(x)
attr(x_RC[[2]], I am) - string
x_RC[[3]] - x_RC[[3]]+1
x_new - as.list(x_RC)
Is that reasonably possible to
Reference classes are implemented with environment objects, which are mutable.
Once you convert to list, the converted object is not mutable, since there is
no such thing as a mutable list. So I would say your request is not possible.
1 - 100 of 490 matches
Mail list logo