Re: [R] simple question on data frames assignment

2016-04-08 Thread ruipbarradas
Hello, You're right, sorry, I missed the parenthesis: colordata$response <- (colordata$color == 'blue') + 0 Rui Barradas Quoting Michael Artz : > Fyi, This statement returned the following error   > 'Error in "Yes" + 0 : non-numeric argument to binary operator' > > > On Thu, Apr 7, 2

Re: [R] simple question on data frames assignment

2016-04-08 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael > Artz > Sent: Friday, April 8, 2016 3:50 AM > To: Hadley Wickham > Cc: r-help@r-project.org > Subject: Re: [R] simple question on data frames assignment > > Wh

Re: [R] simple question on data frames assignment

2016-04-08 Thread PIKAL Petr
ybe you shall use dput(yourdata) output together with desired result to help us better understand your task. Cheers Petr From: Michael Artz [mailto:michaelea...@gmail.com] Sent: Thursday, April 7, 2016 4:17 PM To: PIKAL Petr Subject: Re: [R] simple question on data frames assignment what about

Re: [R] simple question on data frames assignment

2016-04-07 Thread Michael Artz
Why am I better off with true and false? On Thu, Apr 7, 2016 at 8:41 AM, Hadley Wickham wrote: > == is also vectorised, and you're better off with TRUE and FALSE > rather than 1 and 0, so I'd recommend: > > colordata$response <- colordata$color == 'blue' > > Hadley > > On Thu, Apr 7, 2016 at 6:5

Re: [R] simple question on data frames assignment

2016-04-07 Thread Michael Artz
Fyi, This statement returned the following error 'Error in "Yes" + 0 : non-numeric argument to binary operator' On Thu, Apr 7, 2016 at 8:43 AM, wrote: > Hello, > > Or even simpler, without ifelse, > > colordata$response <- colordata$color == 'blue' + 0 > > Hope this helps, > > Rui Barradas > >

Re: [R] simple question on data frames assignment

2016-04-07 Thread Michael Artz
It all makes so much sense now On Thu, Apr 7, 2016 at 10:04 AM, Jeff Newmiller wrote: > lapply(colordata2[ -1 ], f ) > > When you put the parentheses on, you are calling the function yourself > before lapply gets a chance. The error pops up because you are giving a > vector of numbers (the answe

Re: [R] simple question on data frames assignment

2016-04-07 Thread Jeff Newmiller
lapply(colordata2[ -1 ], f ) When you put the parentheses on, you are calling the function yourself before lapply gets a chance. The error pops up because you are giving a vector of numbers (the answer f gave you) to the second argument of lapply instead of a function. -- Sent from my phone.

Re: [R] simple question on data frames assignment

2016-04-07 Thread Michael Artz
If you are not using an anonymous function and say you had written the function out The below gives me the error > 'f(colordata2$color1)' is not a function, character or symbol' But then how is the anonymous function working? f <- function(col){ ifelse(col == 'blue', 1, 0) } responses <- lapp

Re: [R] simple question on data frames assignment

2016-04-07 Thread ruipbarradas
Hello, Or even simpler, without ifelse, colordata$response <- colordata$color == 'blue' + 0 Hope this helps, Rui Barradas   Citando David Barron : > ifelse is vectorised, so just use that without the loop. > > colordata$response <- ifelse(colordata$color == 'blue', 1, 0) > > David > > On 7 Ap

Re: [R] simple question on data frames assignment

2016-04-07 Thread Hadley Wickham
== is also vectorised, and you're better off with TRUE and FALSE rather than 1 and 0, so I'd recommend: colordata$response <- colordata$color == 'blue' Hadley On Thu, Apr 7, 2016 at 6:52 AM, David Barron wrote: > ifelse is vectorised, so just use that without the loop. > > colordata$response <-

Re: [R] simple question on data frames assignment

2016-04-07 Thread Jeff Newmiller
Lapply is not a vectorized function. It is compact to read, but it would not be worth using for this calculation. However, if your data frame had multiple color columns in your data frame that you wanted to make responses for then you might want to use lapply as a more compact version of a for

Re: [R] simple question on data frames assignment

2016-04-07 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael > Artz > Sent: Thursday, April 7, 2016 1:57 PM > To: David Barron > Cc: r-help@r-project.org > Subject: Re: [R] simple question on data frames assignment > > Th

Re: [R] simple question on data frames assignment

2016-04-07 Thread Michael Artz
Thaks so much! And how would you incorporate lapply() here? On Thu, Apr 7, 2016 at 6:52 AM, David Barron wrote: > ifelse is vectorised, so just use that without the loop. > > colordata$response <- ifelse(colordata$color == 'blue', 1, 0) > > David > > On 7 April 2016 at 12:41, Michael Artz wrot

Re: [R] simple question on data frames assignment

2016-04-07 Thread David Barron
ifelse is vectorised, so just use that without the loop. colordata$response <- ifelse(colordata$color == 'blue', 1, 0) David On 7 April 2016 at 12:41, Michael Artz wrote: > Hi I'm not sure how to ask this, but its a very easy question to answer for > an R person. > > What is an easy way to che

[R] simple question on data frames assignment

2016-04-07 Thread Michael Artz
Hi I'm not sure how to ask this, but its a very easy question to answer for an R person. What is an easy way to check for a column value and then assigne a new column a value based on that old column value? For example, Im doing colordata <- data.frame(id = c(1,2,3,4,5), color = c("blue", "red",

Re: [R] SIMPLE question

2015-02-13 Thread S Ellison
> I want to do a boxcox transformation, but I got this: > Error: could not find function "boxcox" > > What can I do? Well, the recommended 'homework' in the posting guide would be a start. i) ??boxcox, if you have any packages installed that include something with that functionality. ii) RSite

Re: [R] SIMPLE question

2015-02-12 Thread JS Huang
Hi, Maybe the following link helps. http://r.789695.n4.nabble.com/box-cox-td4363944.html -- View this message in context: http://r.789695.n4.nabble.com/SIMPLE-question-tp4703176p4703180.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] SIMPLE question

2015-02-12 Thread Rui Barradas
Hello, Try the following. install.packages("sos") #if not yet Then, library(sos) findFn("boxcox") There are several hits, maybe you could start with package car Hope this helps, Rui Barradas Em 12-02-2015 16:19, CHIRIBOGA Xavier escreveu: Hi everybody! I want to do a boxcox transform

[R] SIMPLE question

2015-02-12 Thread CHIRIBOGA Xavier
Hi everybody! I want to do a boxcox transformation, but I got this: Error: could not find function "boxcox" What can I do? I am using R studio. Thanks!!! Xavier __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://s

Re: [R] simple question - mean of a row of a data.frame

2015-02-11 Thread Kehl Dániel
numeric data frames. HTH, daniel Feladó: R-help [r-help-boun...@r-project.org] ; meghatalmazó: Matthew Keller [mckellerc...@gmail.com] Küldve: 2015. február 11. 23:49 To: r help Tárgy: [R] simple question - mean of a row of a data.frame Hi all, Simple

[R] simple question - mean of a row of a data.frame

2015-02-11 Thread Matthew Keller
Hi all, Simple question I should know: I'm unclear on the logic of why the sum of a row of a data.frame returns a valid sum but the mean of a row of a data.frame returns NA: sum(rock[2,]) [1] 10901.05 mean(rock[2,],trim=0) [1] NA Warning message: In mean.default(rock[2, ], trim = 0) : argument

Re: [R] simple question on loop

2012-11-16 Thread Suzen, Mehmet
Use mapply instead On Fri, Nov 16, 2012 at 5:01 PM, billycorg wrote: > Hi R Users. > > I have a simple question on a loop. > > The following loop works fine: > > r_t=list() > for(i in 1:500) > { > r_t[[i]]=h_t_half[[i]]%*%matrix(*z_t_m*[i,]) > } > > But indeed I need also that *z_t_m* varies. Let

[R] simple question on loop

2012-11-16 Thread billycorg
Hi R Users. I have a simple question on a loop. The following loop works fine: r_t=list() for(i in 1:500) { r_t[[i]]=h_t_half[[i]]%*%matrix(*z_t_m*[i,]) } But indeed I need also that *z_t_m* varies. Let us suppose that *z_t_m* has 1000 replicates, I have written the following loop that (natural

Re: [R] Simple Question

2012-09-28 Thread Bert Gunter
On Fri, Sep 28, 2012 at 11:15 AM, Bhupendrasinh Thakre wrote: > Thanks a ton Berend. That worked like a charm.. > R comes with thousands of Sweet Surprises everyday -- Not for those who read the docs. :-o -- Bert > > > Bhupendrasinh Thakre > > > > > On Sep 28, 2012, at 12:00 PM, Berend

Re: [R] Simple Question

2012-09-28 Thread Bhupendrasinh Thakre
Thanks a ton Berend. That worked like a charm.. R comes with thousands of Sweet Surprises everyday Bhupendrasinh Thakre On Sep 28, 2012, at 12:00 PM, Berend Hasselman wrote: > > On 28-09-2012, at 18:40, Bhupendrasinh Thakre wrote: > >> Hi Everyone, >> >> Sorry for coming back ag

Re: [R] Simple Question

2012-09-28 Thread Berend Hasselman
On 28-09-2012, at 18:40, Bhupendrasinh Thakre wrote: > Hi Everyone, > > Sorry for coming back again with a new problem. > Editing question, session info and data so you don't have to scroll till > the end of page. > > *Situation :* > > I have a data frame and it's name is df. Now I want to ad

Re: [R] Simple Question

2012-09-28 Thread Bhupendrasinh Thakre
Hi Everyone, Sorry for coming back again with a new problem. Editing question, session info and data so you don't have to scroll till the end of page. *Situation :* I have a data frame and it's name is df. Now I want to add Time Stamp to the end of *"name" of "data Frame" i.e. "df_system_time"*.

Re: [R] Simple Question

2012-09-28 Thread Bhupendrasinh Thakre
Hi Everyone, Sorry for coming back again with a new problem. Editing question, session info and data so you don't have to scroll till the end of page. *Situation :* I have a data frame and it's name is df. Now I want to add Time Stamp to the end of *"name" of "data Frame" i.e. "df_system_time"*.

Re: [R] Simple Question

2012-09-28 Thread Bhupendrasinh Thakre
Many thanks Dr. Winsemius , Kimmo and Pascal All of them are working and really beautiful... Best Regards, Bhupendrasinh Thakre *Disclaimer :* The information contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual

Re: [R] Simple Question

2012-09-27 Thread David Winsemius
On Sep 27, 2012, at 11:13 PM, Bhupendrasinh Thakre wrote: > > Hi Everyone, > > I am trying a very simple task to append the Timestamp with a variable name > so something like > a_2012_09_27_00_12_30 <- rnorm(1,2,1). If you want to assign a value to a character-name you need to use ... `assig

Re: [R] Simple Question

2012-09-27 Thread Pascal Oettli
Hello, Try the following: b <- unclass(Sys.time()) eval(parse(text=paste("c_",b," <- rnorm(1,2,1)",sep=""))) ls() Regards, Pascal Le 28/09/2012 15:13, Bhupendrasinh Thakre a écrit : Hi Everyone, I am trying a very simple task to append the Timestamp with a variable name so something like

Re: [R] Simple Question

2012-09-27 Thread K. Elo
Hi! 28.09.2012 09:13, Bhupendrasinh Thakre wrote: Statement I tried : b <- unclass(Sys.time()) b = 1348812597 c_b <- rnorm(1,2,1) Do you mean this: --- code --- > df<-data.frame("x"=0,"y"=0) > colnames(df) [1] "x" "y" > colnames(df)[2]<-paste("b",unclass(Sys.time()),sep="_") > colnames(df)

[R] Simple Question

2012-09-27 Thread Bhupendrasinh Thakre
Hi Everyone, I am trying a very simple task to append the Timestamp with a variable name so something like a_2012_09_27_00_12_30 <- rnorm(1,2,1). Tried some commands but it doesn't work out well. Hope someone has some answer on it. Session Info R version 2.15.1 (2012-06-22) Platform: i386-

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread Rui Barradas
Hello, In the help page for ?hclust you will see the return values. It has an element order, "a vector giving the permutation of the original observations suitable for plotting". From the first example on that page: hc <- hclust(dist(USArrests), "ave") plot(hc) ix <- hc$order rownames(USArre

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread David L Carlson
un...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of RCar > Sent: Wednesday, September 26, 2012 4:12 PM > To: r-help@r-project.org > Subject: [R] Simple Question About Exporting Back to Excel > > All, > Relatively new R user so this is probably an easy quest

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread ilai
On Wed, Sep 26, 2012 at 3:11 PM, RCar wrote: > All, > Relatively new R user so this is probably an easy question to answer. > I am able to generate a cluster for my dataset using hclust() then ploting > the data with plot(). > This results in an image with a dendrogram with my sample names along t

[R] Simple Question About Exporting Back to Excel

2012-09-26 Thread RCar
All, Relatively new R user so this is probably an easy question to answer. I am able to generate a cluster for my dataset using hclust() then ploting the data with plot(). This results in an image with a dendrogram with my sample names along the bottom. Great! However, I now need a way to get th

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread Joshua Wiley
On Fri, Aug 10, 2012 at 9:16 AM, S Ellison wrote: >> > R in general tries hard to prohibit this behavior (i.e., including an >> > interaction but not the main effect). When removing a main effect and >> > leaving the interaction, the number of parameters is not reduced by >> > one (as would be ex

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread Bert Gunter
Sheesh! Yes. ... and in the case where B is a factor with k levels and x is continuous, the model ~B:x yields k+1 parameters, which in default contrasts would be a constant term, x, and k-1 interactions between x and the corresponding k-1 "contrasts"(which they aren't really) for B. ~B*x would add

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread S Ellison
> > R in general tries hard to prohibit this behavior (i.e., including an > > interaction but not the main effect). When removing a main effect and > > leaving the interaction, the number of parameters is not reduced by > > one (as would be expected) but stays the same, at least > > when using

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread David Winsemius
necdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-pro

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread Joshua Wiley
y.onkel...@inbo.be >>> www.inbo.be >>> >>> To call in the statistician after the experiment is done may be no more >>> than asking him to perform a post-mortem examination: he may be able to say >>> what the experiment died of. >>> ~ Sir Ronald Aylmer

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread Henrik Singmann
Johan Haasnoot Verzonden: vrijdag 10 augustus 2012 9:15 Aan: r-help@r-project.org Onderwerp: [R] Simple question about formulae in R!? Good morning reader, I have encountered a, probably, simple issue with respect to the *formulae* of a *regression model* I want to use in my research. I&#x

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread R. Michael Weylandt
f some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of data. > ~ John Tukey > > > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Namens Joh

Re: [R] Simple question about formulae in R!?

2012-08-10 Thread ONKELINX, Thierry
nden: vrijdag 10 augustus 2012 9:15 Aan: r-help@r-project.org Onderwerp: [R] Simple question about formulae in R!? Good morning reader, I have encountered a, probably, simple issue with respect to the *formulae* of a *regression model* I want to use in my research. I'm researching allian

[R] Simple question about formulae in R!?

2012-08-10 Thread Johan Haasnoot
Good morning reader, I have encountered a, probably, simple issue with respect to the *formulae* of a *regression model* I want to use in my research. I’m researching alliances as part of my study Business Economics (focus Strategy) at the Vrije Universiteit in Amsterdam. In the research model I

Re: [R] Simple question on finding duplicates

2012-07-25 Thread arun
ct.org Cc: Sent: Wednesday, July 25, 2012 4:05 PM Subject: [R] Simple question on finding duplicates   I'm  trying  to find duplicate values in a column of a data frame. For   example, dataframe (a) below has two 3's. I would like to mark each value of   each row as either not being a d

Re: [R] Simple question on finding duplicates

2012-07-25 Thread Peter Ehlers
duplicate <- c(0, diff(a[,"col1"]) == 0) Peter Ehlers On 2012-07-25 13:05, Jeff wrote: I'm trying to find duplicate values in a column of a data frame. For example, dataframe (a) below has two 3's. I would like to mark each value of each row as either not being a duplicate of th

Re: [R] Simple question on finding duplicates

2012-07-25 Thread Bert Gunter
o:r-help-bounces@r- >>> project.org] On Behalf Of Jeff >>> Sent: Wednesday, July 25, 2012 3:06 PM >>> To: r-help@r-project.org >>> Subject: [R] Simple question on finding duplicates >>> >>> >>>I'm trying to find duplicate valu

Re: [R] Simple question on finding duplicates

2012-07-25 Thread Bert Gunter
mp;M University > College Station, TX 77843-4352 > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Jeff >> Sent: Wednesday, July 25, 2012 3:06 PM >> To: r-help@r-project.org >> Subj

Re: [R] Simple question on finding duplicates

2012-07-25 Thread David L Carlson
Minor correction: duplicate <- ifelse(c(0, a$col[-length(a$col)])==a$col, 1, 0) --- David > -Original Message- > From: David L Carlson [mailto:dcarl...@tamu.edu] > Sent: Wednesday, July 25, 2012 3:23 PM > To: 'Jeff'; 'r-help@r-project.org' &g

Re: [R] Simple question on finding duplicates

2012-07-25 Thread David L Carlson
org [mailto:r-help-bounces@r- > project.org] On Behalf Of Jeff > Sent: Wednesday, July 25, 2012 3:06 PM > To: r-help@r-project.org > Subject: [R] Simple question on finding duplicates > > >I'm trying to find duplicate values in a column of a data frame. > For >

[R] Simple question on finding duplicates

2012-07-25 Thread Jeff
I'm trying to find duplicate values in a column of a data frame. For example, dataframe (a) below has two 3's. I would like to mark each value of each row as either not being a duplicate of the one before (0), or as a duplicate (1) - for example, as in dataframe (b). In SPSS, I would

Re: [R] Simple Question?

2012-06-21 Thread Rui Barradas
Hello, Try the following. dd <- read.table(text=" chromlength 1 chr1 249250621 2 chr2 243199373 [... etc ...] 22 chr19 59128983 23 chr22 51304566 24 chr21 48129895 ", header=TRUE) str(dd) dd$chrom <- as.character(dd$chrom) dd$chrom <- sub("chr", "", dd$chrom) # This 'chrom' is

Re: [R] Simple Question?

2012-06-21 Thread Bert Gunter
?? ggplot did not reorder the columns -- it just plotted them in the order of the levels of factor(chrom), which is exactly what you wanted afaics. There is no need to reorder to do what you want. Comment: ?dput to put reproducible data into an email that people can conveniently copy and paste int

[R] Simple Question?

2012-06-21 Thread Kevin Parrish
Greetings, I am new to R, but trying to put in the time to learn. I have read the R manual and several other introductory texts; however, there is nothing like actually putting it into practice. So here is my problem, and its more of a learning exercise for myself than anything else, but I'm stuck

Re: [R] simple question about max(x,y)

2012-05-15 Thread David Winsemius
On May 15, 2012, at 8:42 PM, lapertem4 wrote: x <- 3 y <- 4 max(x,y) 4 how can i get the greater variable name y Option one: > test <- function(x,y) { c("x","y")[which.max(c(x,y))]} > test(3,4) [1] "y" > test(4,3) [1] "x" Option two: > test <- function(x,y) { xn <- depar

[R] simple question about max(x,y)

2012-05-15 Thread lapertem4
x <- 3 y <- 4 max(x,y) 4 how can i get the greater variable name y thanks -- View this message in context: http://r.789695.n4.nabble.com/simple-question-about-max-x-y-tp4630201.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-26 Thread chad.mills
Yes! Thanks. It was just the "NA" value instead of the "as.null" that does the trick. Correct code for the original piecewise I stated (for those who might be looking later) is: f <- function(x){ ifelse((-1 < x & x < 1),x^2,ifelse((2http://r.789695.n4.nabble.com/Simple-questio

Re: [R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-26 Thread Rolf Turner
Does f <- function(x){ ifelse((-1 < x & x < 1) | (2 < x & x < 3),x^2,NA) } plot(f,xlim=c(-3,5)) give you what you want? cheers, Rolf Turner On 26/03/12 11:08, chad.mills wrote: I am a novice R user. I would like to be able to graph some simple

[R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-25 Thread chad.mills
I am a novice R user. I would like to be able to graph some simple piecewise functions/functions with domain restrictions in R, but I'm having trouble defining such functions. For example, I would like to define the following function: f(x)={x^2 if -1http://r.789695.n4.nabble.com/Simple-question

Re: [R] Simple question regarding to specifying model

2011-10-12 Thread BvZ
Tried this, it does not seem to work. It is really simple what I am trying to do. I have a pre-specified best-fit line, and wish to run some diagnostic tests for goodness of fit. I will play around with the predict function, thanks a lot David! -- View this message in context: http://r.78969

Re: [R] Simple question regarding to specifying model

2011-10-12 Thread David Winsemius
On Oct 12, 2011, at 2:25 PM, BvZ wrote: I have hunted around but cannot find the command which allows me to specify parameters of a model. For example, model.m1 <- nls(y ~ alpha * x1/(beta + x1), data = data, start = list(beta = 20, alpha = 120), trace = TRUE) This will estimate the par

[R] Simple question regarding to specifying model

2011-10-12 Thread BvZ
I have hunted around but cannot find the command which allows me to specify parameters of a model. For example, model.m1 <- nls(y ~ alpha * x1/(beta + x1), data = data, start = list(beta = 20, alpha = 120), trace = TRUE) This will estimate the parameters, which allows to investigate the residual

Re: [R] Simple question about symbols()

2011-04-20 Thread murilofm
Thank you for the answer and sorry about the bad post i'll remember that in the future. By the way, the line code i used to read the data was inv <- read.csv("data.csv", header=TRUE, sep=";") I tried before to use the bg, but for some reason it wasn't working out for me. But now i got it. Th

Re: [R] Simple question about symbols()

2011-04-20 Thread David Winsemius
On Apr 20, 2011, at 8:45 AM, murilofm wrote: The link to the csv file is http://www.filedropper.com/data_5 I use the "d" variable to create the radius: radius <- sqrt( inv$d/ pi ) and i tried symbols(inv$a, inv$b, circles=radius, inches=0.35, fg="white", bg="red", xlab="aa", ylab="bb",

Re: [R] Simple question about symbols()

2011-04-20 Thread murilofm
The link to the csv file is http://www.filedropper.com/data_5 I use the "d" variable to create the radius: radius <- sqrt( inv$d/ pi ) and i tried symbols(inv$a, inv$b, circles=radius, inches=0.35, fg="white", bg="red", xlab="aa", ylab="bb", col=c("blue","red")[inv$c+1]) Thanks for the

Re: [R] Simple question about symbols()

2011-04-20 Thread Ben Bolker
David Winsemius comcast.net> writes: > > > On Apr 19, 2011, at 10:51 PM, murilofm wrote: > > > Thanks for the answer; I see that col=c("blue","red")[inv$c+1] > > creates a > > vector of "red" and "blue" associated with the binnary c. > > But still I got everything red. > > If you want teste

Re: [R] Simple question about symbols()

2011-04-19 Thread David Winsemius
On Apr 19, 2011, at 10:51 PM, murilofm wrote: Thanks for the answer; I see that col=c("blue","red")[inv$c+1] creates a vector of "red" and "blue" associated with the binnary c. But still I got everything red. If you want tested solution, submit test data. -- View this message in context:

Re: [R] Simple question about symbols()

2011-04-19 Thread murilofm
Thanks for the answer; I see that col=c("blue","red")[inv$c+1] creates a vector of "red" and "blue" associated with the binnary c. But still I got everything red. -- View this message in context: http://r.789695.n4.nabble.com/Simple-question-about-symbols-tp3461676p3462013.html Sent from the R he

Re: [R] Simple question about symbols()

2011-04-19 Thread Ben Bolker
murilofm gmail.com> writes: > > I'm new to R and i'm having some trouble with a bubble chart. > Basically I have 3 series (a,b,c), but the third one is a binnary variable > (assumes only 0 or 1 to the entire data). > How can I use these binnary information to make 2 different colours in a > bubb

[R] Simple question about symbols()

2011-04-19 Thread murilofm
I'm new to R and i'm having some trouble with a bubble chart. Basically I have 3 series (a,b,c), but the third one is a binnary variable (assumes only 0 or 1 to the entire data). How can I use these binnary information to make 2 different colours in a bubble chart?. I.e., I'm using this code: sym

Re: [R] Simple question

2011-04-19 Thread Peter Ehlers
Seconded. Peter Ehlers On 2011-04-19 14:11, Marc Schwartz wrote: On Apr 19, 2011, at 4:08 PM, Rolf Turner wrote: On 20/04/11 07:19, Steven Wolf wrote: [...snip...] It sounds to me like you don't understand lists. If you are going to use R you really should understand them. They are a w

Re: [R] Simple question

2011-04-19 Thread peter dalgaard
On Apr 19, 2011, at 21:56 , David Winsemius wrote: > > On Apr 19, 2011, at 3:19 PM, Steven Wolf wrote: > >> I am trying to convert a string to a vector, and I'm stuck! >> >> >> >> Suppose you have a string of numbers (string) that you want to convert to a >> vector (vec). I am able to split

Re: [R] Simple question

2011-04-19 Thread Marc Schwartz
On Apr 19, 2011, at 4:08 PM, Rolf Turner wrote: > On 20/04/11 07:19, Steven Wolf wrote: >> I am trying to convert a string to a vector, and I'm stuck! >> >> >> >> Suppose you have a string of numbers (string) that you want to convert to a >> vector (vec). I am able to split the string turning

Re: [R] Simple question

2011-04-19 Thread Rolf Turner
On 20/04/11 07:19, Steven Wolf wrote: I am trying to convert a string to a vector, and I'm stuck! Suppose you have a string of numbers (string) that you want to convert to a vector (vec). I am able to split the string turning it into a list by using strsplit, but this makes a list, which I ca

Re: [R] Simple question

2011-04-19 Thread David Winsemius
On Apr 19, 2011, at 3:19 PM, Steven Wolf wrote: I am trying to convert a string to a vector, and I'm stuck! Suppose you have a string of numbers (string) that you want to convert to a vector (vec). I am able to split the string turning it into a list by using strsplit, but this makes a

[R] Simple question

2011-04-19 Thread Steven Wolf
I am trying to convert a string to a vector, and I'm stuck! Suppose you have a string of numbers (string) that you want to convert to a vector (vec). I am able to split the string turning it into a list by using strsplit, but this makes a list, which I can't seem to access the way that I'd lik

Re: [R] Simple question on eval

2010-12-01 Thread Joshua Wiley
Here are two options that might work for you given the little bit you've said: ## If its the same parameter all 30 times ## say, for example, base = 4.5 to log for(i in 1:30) { print(log(1:10, base = 4.5)) } ## if they are different parameters, you could try lapply(X = c(1.3, 3, 2.2, 4, 5), FUN

Re: [R] Simple question on eval

2010-12-01 Thread Ivan Calandra
Isn't it what do.call() does? Ivan Le 12/1/2010 16:39, Lamke a écrit : Thank you so much Joshua. That's exactly what I am looking for. What I wanted to do is to pass a parameter to a function and I have to run the functions 30 times. Instead of typing them all out, I created a long string of

Re: [R] Simple question on eval

2010-12-01 Thread Lamke
Thank you so much Joshua. That's exactly what I am looking for. What I wanted to do is to pass a parameter to a function and I have to run the functions 30 times. Instead of typing them all out, I created a long string of "f(a);f(b);f(c) ..." using paste() and use eval and parse to evaluative t

Re: [R] Simple question on eval

2010-11-30 Thread Joshua Wiley
Hi Kel, Try this: eval(parse(text = a)) x Many times (though certainly not all), it may be easier/cleaner to rethink what you are doing (the step before you get a <- "x <- 2^2") to see if there is a simpler way. Cheers, Josh On Tue, Nov 30, 2010 at 2:24 PM, Lamke wrote: > > Hi group, > > I d

[R] Simple question on eval

2010-11-30 Thread Lamke
Hi group, I did some searches about this very simple question. Hope someone can help me out. If I have the following: a <- "x <- 2^2" a [1] "x <- 2^2" How do I evaluate the expression that gets me an answer of 4? I tried the following: > eval(a) [1] "x <- 2^2" > get(a) Error in get(a) : obj

Re: [R] Simple question, name of the variable as string.

2010-09-17 Thread Barry Rowlingson
On Fri, Sep 17, 2010 at 7:54 AM, C.H. wrote: > Dear R users, > > I have a very simple question and I've tried to search for the answer. > (But failed.) > > there should be a function (func) that work like > >> abc <- c(1,2,3,4) >> func(abc) > "abc" > > I would like to know the name of that functio

Re: [R] Simple question, name of the variable as string.

2010-09-17 Thread David Winsemius
On Sep 17, 2010, at 2:54 AM, C.H. wrote: Dear R users, I have a very simple question and I've tried to search for the answer. (But failed.) there should be a function (func) that work like abc <- c(1,2,3,4) func(abc) "abc" > func <- function(xyz) deparse(substitute(xyz)) > func(abc) [1]

[R] Simple question, name of the variable as string.

2010-09-16 Thread C.H.
Dear R users, I have a very simple question and I've tried to search for the answer. (But failed.) there should be a function (func) that work like > abc <- c(1,2,3,4) > func(abc) "abc" I would like to know the name of that function. Thank you very much for your help. Regards, CH -- CH Chan

Re: [R] Simple question regarding name of column headers

2010-07-16 Thread jim holtman
subset(miceTrainSample, select = -plD50) On Fri, Jul 16, 2010 at 11:22 AM, Addi Wei wrote: > > names(miceTrainSample) > [1] "b_double"  "KierA2"    "KierFlex"  "Q_VSA_POS" "pID50" > > In the above code, how do I delete "pID50" column to store the resulting > object without indicating column "5".

Re: [R] Simple question regarding name of column headers

2010-07-16 Thread Erik Iverson
Anyway, I have often wished that something like new.mt.sample <- miceTrainSample[, -"pID50"] would return miceTrainSample without the pID50 column. Here are three alternative ways to do it. # Method 1: Assign NULL to the column new.mt.sample <- miceTrainsSample new.mt.sample$pID50 <- NULL # Me

Re: [R] Simple question regarding name of column headers

2010-07-16 Thread Ista Zahn
Hi Addi, On Fri, Jul 16, 2010 at 3:22 PM, Addi Wei wrote: > > names(miceTrainSample) > [1] "b_double"  "KierA2"    "KierFlex"  "Q_VSA_POS" "pID50" > > In the above code, how do I delete "pID50" column to store the resulting > object without indicating column "5".  The code below does the trick, b

[R] Simple question regarding name of column headers

2010-07-16 Thread Addi Wei
names(miceTrainSample) [1] "b_double" "KierA2""KierFlex" "Q_VSA_POS" "pID50" In the above code, how do I delete "pID50" column to store the resulting object without indicating column "5". The code below does the trick, but I wish to delete the column by specifying "-pID50" instead of "5".

Re: [R] Simple question on binning data

2010-05-15 Thread Bernardo Rangel Tura
On Thu, 2010-05-13 at 17:31 -0400, Carl Witthoft wrote: > It's very simple to write a "binit()" function. If all you want to do > is e.g., bin 107 values into sums of 10 at a time, then write a loop > that sums x[10*i:11*i-1] (not tested and not syntactically correct). > > The one I wrote for

Re: [R] Simple question on binning data

2010-05-14 Thread Frank E Harrell Jr
On 05/14/2010 07:35 PM, kMan wrote: Wow! This definitely contributed to my evening. If you could indulge, I would like some clarification on this matter of binning and distortion, particularly wrt time series (perhaps related to long-memory processes?). I had thought binning was standard practic

Re: [R] Simple question on binning data

2010-05-14 Thread kMan
Wow! This definitely contributed to my evening. If you could indulge, I would like some clarification on this matter of binning and distortion, particularly wrt time series (perhaps related to long-memory processes?). I had thought binning was standard practice in spectral analysis and ANPOW. ..

Re: [R] Simple question on binning data

2010-05-13 Thread Dennis Murphy
I second it! Made me lol :) Dennis On Thu, May 13, 2010 at 3:03 PM, Rolf Turner wrote: > > On 14/05/2010, at 9:54 AM, Frank E Harrell Jr wrote: > > > > > Binning is seldom needed and usually distorts. It is > > the statistical equivalent of a former governor from Alaska. > > >

Re: [R] Simple question on binning data

2010-05-13 Thread Rolf Turner
On 14/05/2010, at 9:54 AM, Frank E Harrell Jr wrote: > Binning is seldom needed and usually distorts. It is > the statistical equivalent of a former governor from Alaska. I nominate this for a fortune. cheers, Rolf Turner

Re: [R] Simple question on binning data

2010-05-13 Thread Frank E Harrell Jr
Cc: r-help@r-project.org Subject: Re: [R] Simple question on binning data There would be several people who could help if you gave us a minimal, reproducible example like the posting guide asks for. If you have a vector of continuous data, and need to create a categorical variable (in R, a factor)

Re: [R] Simple question on binning data

2010-05-13 Thread Carl Witthoft
It's very simple to write a "binit()" function. If all you want to do is e.g., bin 107 values into sums of 10 at a time, then write a loop that sums x[10*i:11*i-1] (not tested and not syntactically correct). The one I wrote for myself discards any partial bin (101-107 in my example) and leav

Re: [R] Simple question on binning data

2010-05-13 Thread Bert Gunter
lto:r-help-boun...@r-project.org] On Behalf Of Erik Iverson Sent: Thursday, May 13, 2010 1:51 PM To: george5000 Cc: r-help@r-project.org Subject: Re: [R] Simple question on binning data There would be several people who could help if you gave us a minimal, reproducible example like the posting guid

Re: [R] Simple question on binning data

2010-05-13 Thread Erik Iverson
There would be several people who could help if you gave us a minimal, reproducible example like the posting guide asks for. If you have a vector of continuous data, and need to create a categorical variable (in R, a factor) from that continuous variable, then ?cut can help you. george5000

[R] Simple question on binning data

2010-05-13 Thread george5000
Hello everyone, I have a data set, and I need to bin my data using a bin width of say g(n). Would anyone be willing to tell me how to do this in R? Thanks -- View this message in context: http://r.789695.n4.nabble.com/Simple-question-on-binning-data-tp2202644p2202644.html Sent from the R help

  1   2   >