On Sun, Apr 30, 2017 at 10:05 PM, Duncan Murdoch
wrote:
> On 30/04/2017 12:26 PM, Ashim Kapoor wrote:
>
>> Dear All,
>>
>> This answer is very clear. Many thanks.
>>
>> I am now confused about how str*ucture works. Where can I read more about
>> when does it return language / logical / chr ? I w
No. You are not using the correct command. Time to read the manual:
?write.table
You will find the answer to your question by looking at the alternate forms of
write.*().
David L. Carlson
Department of Anthropology
Texas A&M University
From: abo dalash [mailto:abo_d...@hotmail.com]
Sent: Su
...
Some R tutorial recommendations can be found here:
https://www.rstudio.com/online-learning/#R
Hadley W.'s book might also be useful to you: http://adv-r.had.co.nz/
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into i
... and moreover, note that the assignment can even be shortened to:
> for ( i in 1:10 ) l[[c(i,1)]] <- 5
?"[[" contains details, but the relevant point is:
"[[ can be applied recursively to lists, so that if the single index i
is a vector of length p, alist[[i]] is equivalent to
alist[[i1]].
On 30/04/2017 12:26 PM, Ashim Kapoor wrote:
Dear All,
This answer is very clear. Many thanks.
I am now confused about how str*ucture works. Where can I read more about
when does it return language / logical / chr ? I would want to read that
so I can interpret the result of structure. I don't t
Show us the code you used. Don't just tell us what you did. It is likely that
something you did after creating the matrix converted it to a data frame. Copy
and paste your code to your emails.
> str(mydf)
'data.frame': 3 obs. of 3 variables:
$ x: int 0 NA NA
$ y: int 5 0 NA
$ z: int 67
Dear All,
This answer is very clear. Many thanks.
I am now confused about how str*ucture works. Where can I read more about
when does it return language / logical / chr ? I would want to read that
so I can interpret the result of structure. I don't think ?str contains
this.To me, logical and chr
My reaction is... why do you think this is a good approach to pursue?
Avoid using assign!
library( fortunes )
fortune( 236 )
If you really need another level of containment, put your multiple lists into
another list:
lst <- lapply( 1:10, list )
lst[[1]][[1]] <- 5
--
Sent from my phone. Plea
assign(paste("list_", i, "[[1]]", sep = ""), 5) creates a new variable with a
funny name.
You'd have to parse() and eval() to make that work, something like
eval(parse(text=paste("list_",i,"[[1]]<-",5, sep="")))
However,
---
> fortunes::fortune("parse")
If the answer is parse() you should
You did not give me any information about about your data using str() or
class() so I'll guess that you have a matrix, e.g.:
> class(moredata)
[1] "matrix"
> as.data.frame.table(moredata)
Var1 Var2 Freq
1xx0
2yx NA
3zx NA
4xy5
5yy0
6z
On 2017/4/30 23:17, Jinsong Zhao wrote:
Hi there,
I have a problem with assign(). Here is the demo code:
for (i in 1:10) {
# create a list with variable name as list_1, list_2, ..., etc.
assign(paste("list_", i, sep = ""), list())
# I hope to assign 5 to list_?[[1]], but I don't know h
Hi there,
I have a problem with assign(). Here is the demo code:
for (i in 1:10) {
# create a list with variable name as list_1, list_2, ..., etc.
assign(paste("list_", i, sep = ""), list())
# I hope to assign 5 to list_?[[1]], but I don't know how to code it.
# list_1[[1]] <- 5 # wo
12 matches
Mail list logo