[R] Missing Values

2012-09-13 Thread grond
I am using bootstrap and cannot figure how to tell R to ignore missing values
(NA)

I tried this syntax and it did not work.  The name of the file is banks the
column two.

bootmean(banks$two,na.rm = True, conf = 90,nrep = 1000)





--
View this message in context: 
http://r.789695.n4.nabble.com/Missing-Values-tp4643059.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Missing Values

2012-09-13 Thread grond
this worked

bootmean(na.omit(Xt$Y), conf = 90,nrep = 1000)

thanks



From:
"Jeff Newmiller [via R]" 
To:
grond 
Date:
09/13/2012 04:48 PM
Subject:
Re: Missing Values



Don't give it any. Instead of banks$two, use na.omit(banks$two). 
--- 

Jeff NewmillerThe .   .  Go 
Live... 
DCN:<[hidden email]>Basics: ##.#.   ##.#.  Live Go... 
  Live:   OO#.. Dead: OO#..  Playing 
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with 
/Software/Embedded Controllers)   .OO#.   .OO#. rocks...1k 

--- 

Sent from my phone. Please excuse my brevity. 

grond <[hidden email]> wrote: 

>I am using bootstrap and cannot figure how to tell R to ignore missing 
>values 
>(NA) 
> 
>I tried this syntax and it did not work.  The name of the file is banks 
>the 
>column two. 
> 
>bootmean(banks$two,na.rm = True, conf = 90,nrep = 1000) 
> 
> 
> 
> 
> 
>-- 
>View this message in context: 
>http://r.789695.n4.nabble.com/Missing-Values-tp4643059.html
>Sent from the R help mailing list archive at Nabble.com. 
> 
>__ 
>[hidden email] mailing list 
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide 
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code. 

__ 
[hidden email] mailing list 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code. 



If you reply to this email, your message will be added to the discussion 
below:
http://r.789695.n4.nabble.com/Missing-Values-tp4643059p4643072.html 
To unsubscribe from Missing Values, click here.
NAML 





--
View this message in context: 
http://r.789695.n4.nabble.com/Missing-Values-tp4643059p4643095.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Missing Values

2012-09-13 Thread grond
actually this is what worked

bootmean(na.omit(X$Y), conf = 90,nrep = 1000)



From:
"Nordlund, Dan (DSHS/RDA) [via R]" 

To:
grond 
Date:
09/13/2012 05:43 PM
Subject:
Re: Missing Values



> -Original Message- 
> From: [hidden email] [mailto:r-help-bounces@r- 
> project.org] On Behalf Of Jeff Newmiller 
> Sent: Thursday, September 13, 2012 1:46 PM 
> To: grond; [hidden email] 
> Subject: Re: [R] Missing Values 
> 
> Don't give it any. Instead of banks$two, use na.omit(banks$two). 
> --- 
>  
> Jeff NewmillerThe .   .  Go 
> Live... 
> DCN:<[hidden email]>Basics: ##.#.   ##.#.  Live 
> Go... 
>   Live:   OO#.. Dead: OO#.. 
> Playing 
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with 
> /Software/Embedded Controllers)   .OO#.   .OO#. 
> rocks...1k 
> --- 
>  
> Sent from my phone. Please excuse my brevity. 
> 
> grond <[hidden email]> wrote: 
> 
> >I am using bootstrap and cannot figure how to tell R to ignore missing 
> >values 
> >(NA) 
> > 
> >I tried this syntax and it did not work.  The name of the file is 
> banks 
> >the 
> >column two. 
> > 
> >bootmean(banks$two,na.rm = True, conf = 90,nrep = 1000) 
> > 
> > 
> > 
> > 

You haven't said where you got the function bootmean() and you have not 
provided a reproducible example, so I can't do any testing.  Jeff's 
solution may work for you.  However, in your call to bootmean you have 
na.rm=True.  R is case sensitive.  True is not equal to TRUE.  Try 
changing your code to 

bootmean(banks$two, na.rm = TRUE, conf = 90,nrep = 1000) 


Hope this is helpful, 

Dan 

Daniel J. Nordlund 
Washington State Department of Social and Health Services 
Planning, Performance, and Accountability 
Research and Data Analysis Division 
Olympia, WA 98504-5204 


__ 
[hidden email] mailing list 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code. 



If you reply to this email, your message will be added to the discussion 
below:
http://r.789695.n4.nabble.com/Missing-Values-tp4643059p4643080.html 
To unsubscribe from Missing Values, click here.
NAML 





--
View this message in context: 
http://r.789695.n4.nabble.com/Missing-Values-tp4643059p4643096.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Identifying tidygraph subgraphs

2021-04-05 Thread Wolfgang Grond
Dear all,

imagine the following situation:

I want to create a tidygraph consisting of several subgraphs like in 
this example:

gr1  <-  create_notable 
<https://rdrr.io/cran/tidygraph/man/create_graphs.html>('bull')  %>%
   activate <https://rdrr.io/cran/tidygraph/man/activate.html>(nodes)  %>%
   mutate <https://rdrr.io/cran/tidygraph/man/reexports.html>(name 
<https://rdrr.io/r/base/name.html>  =  letters 
<https://rdrr.io/r/base/Constants.html>[1:5])
gr2  <-  create_ring 
<https://rdrr.io/cran/tidygraph/man/create_graphs.html>(10)  %>%
   activate <https://rdrr.io/cran/tidygraph/man/activate.html>(nodes)  %>%
   mutate <https://rdrr.io/cran/tidygraph/man/reexports.html>(name 
<https://rdrr.io/r/base/name.html>  =  letters 
<https://rdrr.io/r/base/Constants.html>[4:13])

gr1  %>%  graph_join <https://rdrr.io/cran/tidygraph/man/graph_join.html>(gr2) 
when the merged graph is plotted with ggraph afterwards, I would like to 
identify the former graphs gr1 and gr2 by their node color, so that it 
is possible to see which node originates from which source. The result 
will be as follows: nodes a, b, c have i. e. color blue as they 
originate from gr1, nodes f, g, h, i, j, k, l, m have i. e. color red as 
they originate from gr2, nodes d, e either have color blue or color red 
(depending in which sequence the graphs are joined), or nodes d. e have 
a third color, i. e. green as the belong to both graphs How can this be 
done? Thanks in advance. Wolfgang Grond


[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Dear all,

I'm creating a list (which is a tbl_graph) by a function, and assign the 
result to a variable:

subnet_MYSUBNET <- my_function(MYSUBNET)

# MYSUBNET: a tbl_graph

Because there are multiple subnets to create, I can get the names of the 
subnets (MYSUBNET1, MYSUBNET2, MYSUBNET3, etc.) from a row in a 
dataframe column.

subnet_MYSUBNET <- my_function(datatable$column[i])

Because I know how many subnets to create - nrow(dataframe) I want to 
assign the subnets to variables whose names contain the name of the subnet

For this to work I have to assign a variable name which is contained in 
an other variable name:

#

for(i in 1:nrow(datatable)) {

val <- datatable$column[i]

result <- assign(paste("subnet_",  val, sep = "")

result <- my_function(val)

}

this works in bash, but seems not to work in R - I don't succeed at least.

Am I wrong?

Where is my mistake?

Many thanks in advance for any hint.

Wolfgang



[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Dear Ivan,

when I try your solution with lapply as below I get the following error message:

Error in eval ... : object 'function' not found ( I think anything about 
my_function is meant).

Am 9. April 2021 13:43:57 MESZ schrieb Ivan Krylov :
>Dear Wolfgang,
>
>On Fri, 9 Apr 2021 11:48:55 +0200
>Wolfgang Grond  wrote:
>
>> I want to assign the subnets to variables whose names contain the
>> name of the subnet
>
>Apologies if this sounds too opinionated, but creating variable names
>from variable values is a FAQ in a different dynamic language:
>
>https://perldoc.perl.org/perlfaq7#How-can-I-use-a-variable-as-a-variable-name?
>
>Most of the explanation doesn't apply to R, of course, but the main
>idea here is to use data structures instead of causing (potential,
>unlikely, but still) conflicts in the variable namespace. What if you
>create a list of function values instead of just a bunch of variables?
>
>results <- list()
>for(i in 1:nrow(datatable)) {
>   val <- datatable$column[i]
>   results[[as.character(val)]] <- my_function(val)
>}
>
>Or even
>
>results <- lapply(setNames(nm = datatable$column), my_function)
>
>Wouldn't that be more convenient?
>
>-- 
>Best regards,
>Ivan
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Ivan,

same situation when I try your list() solution:

Error in eval ... : object 'function' not found ( I think anything about 
my_function is meant).


Am 9. April 2021 13:43:57 MESZ schrieb Ivan Krylov :
>Dear Wolfgang,
>
>On Fri, 9 Apr 2021 11:48:55 +0200
>Wolfgang Grond  wrote:
>
>> I want to assign the subnets to variables whose names contain the
>> name of the subnet
>
>Apologies if this sounds too opinionated, but creating variable names
>from variable values is a FAQ in a different dynamic language:
>
>https://perldoc.perl.org/perlfaq7#How-can-I-use-a-variable-as-a-variable-name?
>
>Most of the explanation doesn't apply to R, of course, but the main
>idea here is to use data structures instead of causing (potential,
>unlikely, but still) conflicts in the variable namespace. What if you
>create a list of function values instead of just a bunch of variables?
>
>results <- list()
>for(i in 1:nrow(datatable)) {
>   val <- datatable$column[i]
>   results[[as.character(val)]] <- my_function(val)
>}
>
>Or even
>
>results <- lapply(setNames(nm = datatable$column), my_function)
>
>Wouldn't that be more convenient?
>
>-- 
>Best regards,
>Ivan
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


-
Numberland - Dr. Wolfgang Grond
Diplomphysiker, TQM-Assessor (EFQM)
Six Sigma Green Belt
Ingenieurbüro / Engineering Consultancy
Lohfeld 20, DE-95326 Kulmbach, Germany
Phone: +49 9221 6919131
Fax: +49 9221 6919156
Mail: gr...@numberland.com
URL: http://www.numberland.com
[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Greg,

here I get the error message:

Error my_function(val) :

cannot find function my_function.

Am 9. April 2021 12:35:40 MESZ schrieb Greg Minshall :
>Wolfgang,
>
>> result <- assign(paste("subnet_",  val, sep = "")
>> 
>> result <- my_function(val)
>
>i don't understand why you are twice assigning to =result=.  also, the
>first assignment doesn't seem well formatted (t's missing a value?).
>
>did you mean something like
>
>: assign(paste("subnet_",  val, sep = ""), my_function(val))
>
>(which i would think should work)?
>
>cheers, Greg
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


-
Numberland - Dr. Wolfgang Grond
Diplomphysiker, TQM-Assessor (EFQM)
Six Sigma Green Belt
Ingenieurbüro / Engineering Consultancy
Lohfeld 20, DE-95326 Kulmbach, Germany
Phone: +49 9221 6919131
Fax: +49 9221 6919156
Mail: gr...@numberland.com
URL: http://www.numberland.com
[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
Folks,

first of all - thanks a lot for your hints!

I will try each again and think about, why I get error messages.

But to resume: if I understand you right:

there is no way to do something like this:

$name = $result?

Regards

Wolfgang

Am 9. April 2021 15:43:27 MESZ schrieb Rui Barradas :
>Hello,
>
>my_function seems to be a function you have defined somewhere in your
>code.
>In your original post you mention it 3 times, this is the first one:
>
>
>subnet_MYSUBNET <- my_function(MYSUBNET)
>
>
>So Ivan's and Greg's code should work, they use a function you haven't 
>posted but is assumed to exist.
>
>Note: if you are more comfortable with for loops than with *apply, I 
>would rewrite Ivan's for loop solution as
>
>
>results <- vector("list", length = nrow(datatable))
>for(val in datatable$column) {
>   results[[as.character(val)]] <- my_function(val)
>}
>
>
>To keep extending a vector or list object in a loop is inefficient,
>this 
>creates the list with the right length beforehand.
>
>
>Hope this helps,
>
>Rui Barradas
>
>Às 13:21 de 09/04/21, Wolfgang Grond escreveu:
>> Greg,
>> 
>> here I get the error message:
>> 
>> Error my_function(val) :
>> 
>> cannot find function my_function.
>> 
>> Am 9. April 2021 12:35:40 MESZ schrieb Greg Minshall
>:
>>> Wolfgang,
>>>
>>>> result <- assign(paste("subnet_",  val, sep = "")
>>>>
>>>> result <- my_function(val)
>>>
>>> i don't understand why you are twice assigning to =result=.  also,
>the
>>> first assignment doesn't seem well formatted (t's missing a value?).
>>>
>>> did you mean something like
>>>
>>> : assign(paste("subnet_",  val, sep = ""), my_function(val))
>>>
>>> (which i would think should work)?
>>>
>>> cheers, Greg
>>>
>>> __
>>> 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
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
>> -
>> Numberland - Dr. Wolfgang Grond
>> Diplomphysiker, TQM-Assessor (EFQM)
>> Six Sigma Green Belt
>> Ingenieurbüro / Engineering Consultancy
>> Lohfeld 20, DE-95326 Kulmbach, Germany
>> Phone: +49 9221 6919131
>> Fax: +49 9221 6919156
>> Mail: gr...@numberland.com
>> URL: http://www.numberland.com
>>  [[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 read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
David,

I don't think that this is the case.

When I do the calculation like this

subnet_MYSUBNET <- my_function(MYSUBNET),

i.e. assigning a variable by hand to each function result, all is fine.



Am 9. April 2021 17:22:05 MESZ schrieb David Winsemius :
>
>On 4/9/21 5:21 AM, Wolfgang Grond wrote:
>> Greg,
>>
>> here I get the error message:
>>
>> Error my_function(val) :
>>
>> cannot find function my_function.
>
>I'm guessing that you are following someone else's blog and have failed
>
>one of two things:
>
>- understand that what was meant by the author was that you were
>assumed 
>to have a function in mind to use for a programming strategy being 
>illustrated
>
>- or you were copying and pasting only part of a blog and failed to 
>paste in the code from above where there was earlier code defining 
>`my_function`
>
>>
>> Am 9. April 2021 12:35:40 MESZ schrieb Greg Minshall
>:
>>> Wolfgang,
>>>
>>>> result <- assign(paste("subnet_",  val, sep = "")
>>>>
>>>> result <- my_function(val)
>>> i don't understand why you are twice assigning to =result=.  also,
>the
>>> first assignment doesn't seem well formatted (t's missing a value?).
>>>
>>> did you mean something like
>>>
>>> : assign(paste("subnet_",  val, sep = ""), my_function(val))
>>>
>>> (which i would think should work)?
>>>
>>> cheers, Greg
>>>
>>> ______
>>> 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
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> -
>> Numberland - Dr. Wolfgang Grond
>> Diplomphysiker, TQM-Assessor (EFQM)
>> Six Sigma Green Belt
>> Ingenieurbüro / Engineering Consultancy
>> Lohfeld 20, DE-95326 Kulmbach, Germany
>> Phone: +49 9221 6919131
>> Fax: +49 9221 6919156
>> Mail: gr...@numberland.com
>> URL: http://www.numberland.com
>>  [[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 read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Assigning several lists to variables whose names are contained in other variables

2021-04-09 Thread Wolfgang Grond
As I wrote before, I calculate tbl_graph objects, which will be joined 
afterwards. Not too much, the number of graphs to calculate is in the range 
between 5 to 20.

Further steps are not automated, because they depend on how the single graphs 
look like, and which of them will be joined.

For this reason I thought it would be nice to have the single tbl_ graph 
objects stored in variables having the name of the graph.

For this reason I tried to find a better solution instead of assigning each 
graph by hand:

subnet_MYSUBNET <- my_function(MYSUBNET)

To my understanding it is therefore neccessary to assign the result of the 
function to a variable whose name consists of a fixed string and the content of 
a further variable.

That was the intention for me to ask.

Am 9. April 2021 17:22:05 MESZ schrieb David Winsemius :
>
>On 4/9/21 5:21 AM, Wolfgang Grond wrote:
>> Greg,
>>
>> here I get the error message:
>>
>> Error my_function(val) :
>>
>> cannot find function my_function.
>
>I'm guessing that you are following someone else's blog and have failed
>
>one of two things:
>
>- understand that what was meant by the author was that you were
>assumed 
>to have a function in mind to use for a programming strategy being 
>illustrated
>
>- or you were copying and pasting only part of a blog and failed to 
>paste in the code from above where there was earlier code defining 
>`my_function`
>
>>
>> Am 9. April 2021 12:35:40 MESZ schrieb Greg Minshall
>:
>>> Wolfgang,
>>>
>>>> result <- assign(paste("subnet_",  val, sep = "")
>>>>
>>>> result <- my_function(val)
>>> i don't understand why you are twice assigning to =result=.  also,
>the
>>> first assignment doesn't seem well formatted (t's missing a value?).
>>>
>>> did you mean something like
>>>
>>> : assign(paste("subnet_",  val, sep = ""), my_function(val))
>>>
>>> (which i would think should work)?
>>>
>>> cheers, Greg
>>>
>>> ______
>>> 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
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> -
>> Numberland - Dr. Wolfgang Grond
>> Diplomphysiker, TQM-Assessor (EFQM)
>> Six Sigma Green Belt
>> Ingenieurbüro / Engineering Consultancy
>> Lohfeld 20, DE-95326 Kulmbach, Germany
>> Phone: +49 9221 6919131
>> Fax: +49 9221 6919156
>> Mail: gr...@numberland.com
>> URL: http://www.numberland.com
>>  [[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 read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] geom_node_point color in ggraph

2021-04-15 Thread Wolfgang Grond
Dear all,

I'm joining differnts graphs to one with command graph_join from ggraph,

and try to color the nodes depending on the subgraph they come from.

To do that, I have these commands in my ggraph:



...
geom_node_point(size = 8, aes(colour = project_all$Acronym)) +
     scale_color_discrete(name="Project / Projekt") +
...



All works well, but

how to define the colors to use for the nodes?

Is it possible to either

- define the colors explicitely, or

- define a color palette to use?

Please point me to where I should look how to do it.

Many thanks in advance

Wolfgang


[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] geom_node_point color in ggraph

2021-04-15 Thread Wolfgang Grond
Rui,

thanks a lot, I'll try it this way.

Best regards

Wolfgang

Am 15. April 2021 21:19:27 MESZ schrieb Rui Barradas :
>Hello,
>
>To define the colors, remove the data set name from the aesthetic.
>This
>
>aes(colour = project_all$Acronym)
>
>
>should be this
>
>aes(colour = Acronym)
>
>
>Then choose the colours in the usual ggplot way. Here is a reproducible
>
>example.
>
>
>library(igraph)
>library(ggraph)
>
>project_all <- make_graph("bull")
>vertex_attr(project_all, "Acronym", index = V(project_all)) <- "red"
>vertex_attr(project_all, "Acronym", index = V(project_all)[[3]]) <-
>"blue"
>
>ggraph(project_all, layout = "igraph", algorithm = "kk") +
>   geom_edge_link() +
>   geom_node_point(aes(colour = Acronym), size = 8) +
>   scale_color_manual(name = "Project / Projekt",
>  values = c("blue", "red"))
>
>
>Hope this helps,
>
>Rui Barradas
>
>
>Às 15:57 de 15/04/21, Wolfgang Grond escreveu:
>> Dear all,
>> 
>> I'm joining differnts graphs to one with command graph_join from
>ggraph,
>> 
>> and try to color the nodes depending on the subgraph they come from.
>> 
>> To do that, I have these commands in my ggraph:
>> 
>> 
>> 
>> ...
>> geom_node_point(size = 8, aes(colour = project_all$Acronym)) +
>>       scale_color_discrete(name="Project / Projekt") +
>> ...
>> 
>> 
>> 
>> All works well, but
>> 
>> how to define the colors to use for the nodes?
>> 
>> Is it possible to either
>> 
>> - define the colors explicitely, or
>> 
>> - define a color palette to use?
>> 
>> Please point me to where I should look how to do it.
>> 
>> Many thanks in advance
>> 
>> Wolfgang
>> 
>> 
>>  [[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 read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>__
>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
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[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 read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Interactive 3D Plot with non-numeric axis tick labels

2023-01-09 Thread Wolfgang Grond

Dear all,

What I want to create is an interactive 3D plot from a data frame like this:

#: number
TLD: Countrycode
Date: date
String: a label

Because plot3d can only deal with numbers I converted Date to Year and
TLD as well as String to a numeric value like this:

numTLD <- as.numeric(factor(df$TLD))



#   TLD DateString  YearnumTLD  numString
1   DE  1988-11-07  B23K19883   74
2   DE  1984-09-06  B23K19843   74
3   DE  1996-03-21  B23K19963   74
4   DE  1996-03-21  B23K19963   74
5   DE  1996-03-21  B23K19963   74
6   DE  1996-03-21  B23K19963   74
7   DE  1996-03-21  B23K19963   74
8   DE  1996-03-21  B23K19963   74
9   DE  1996-03-21  B23K19963   74

To create an interactive 3D plot I use:

plot3d(df$numTLD, df$Year, df$numString)

The plot then shows numeric axis ticks labels, which is what I want to 
get in the case of Year. But for numTLD and numString I want to have


- DE instead of 3 for TLD
- B23K instead of 74 for String

(axis ticks labeled with strings, not with numbers).

I didn't succeed to figure out how this can be reached.

Thanks in advance for any help.

Regards

__
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 http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.