Re: [R] identical() versus sapply()

2016-04-08 Thread Jeff Newmiller
I highly recommend making friends with the str function. Try str( 1 ) str( 1:2 ) for the clue you need, and then sapply( 1:2, identical, 1L ) -- Sent from my phone. Please excuse my brevity. On April 8, 2016 3:24:31 PM PDT, "Paulson, Ariel" wrote: >Sorry if this has been answered elsewhere,

Re: [R] sorting of files using system

2016-04-08 Thread Jeff Newmiller
Wrong list. This is not the Ubuntu shell support mailing list. The fact that you are using R to get at the operating system command line doesn't make this an R question. -- Sent from my phone. Please excuse my brevity. On April 8, 2016 2:18:40 PM PDT, Maria Ninova wrote: >Hello, I came acros

Re: [R] Generating random data with non-linear correlation between two variables

2016-04-08 Thread hd625b
Hello, I changed the last 3 lines from v1 and v2 to myData$v1 and myData$v2. Creating the vectors in not a problem. Where you will run into issues is when you create the data.frame. The length of v1 is 1001 and the length of v2 is 651. The warning message below is telling us that the lengths of

[R] sorting of files using system

2016-04-08 Thread Maria Ninova
Hello, I came across the following oddity when it comes to file order using the system command: different system commands return files in a different order: This is a real filenames example: > system("ls gw1kb_tables/rpkm_47*", intern=T) [1] "gw1kb_tables/rpkm_479_Input.tab" [2] "gw1kb_tables/r

[R] identical() versus sapply()

2016-04-08 Thread Paulson, Ariel
Sorry if this has been answered elsewhere, but I can't find any discussion of it. Wondering why the following situation occurs (duplicated on 3.2.2 CentOS6 and 3.0.1 Win2k, so I don't think it is a bug): > sapply(1, identical, 1) [1] TRUE > sapply(1:2, identical, 1) [1] FALSE FALSE > sapply(1

Re: [R] [FORGED] Generating random data with non-linear correlation between two variables

2016-04-08 Thread Rolf Turner
On 09/04/16 06:57, Muhammad Bilal wrote: Hi All, I am new to R and don't know how to achieve it. I am interested in generating a hypothetical dataframe that is consisted of say two variables named v1 and v2, based on the following constraints: 1. The range of v1 is 500-1500. 2. The mean of v1

Re: [R] assign

2016-04-08 Thread Jeff Newmiller
You are not using that function as it was designed to be used. You should read the help for gsub... ?gsub And if you don't know what the term "regular expression pattern" that is mentioned there means then you will probably need to study one of the many fine tutorials that are available on th

Re: [R] assign

2016-04-08 Thread Fox, John
Dear Val, Your question isn't entirely clear (to me), but this is what I think you want to do: -- snip > strings <- c("ASk/20005-01-45/90", "Alldatk/25-17-4567/990") > location <- regexpr("-[0-9]*", strings) > x [1] "01" "17" > x <- substring(strings, location +

[R] assign

2016-04-08 Thread Val
Hi all I am trying t extract a variable from a column ASk/20005-01-45/90 Alldatk/25-17-4567/990 I want to assign a variable to the numbers coming the first"-" x=01 for the first and x=17 for teh second I tried using gsub but did not work x=gsub("-") any help? [[altern

Re: [R] Rcmdr will not load

2016-04-08 Thread peter dalgaard
Yes, that's annoying. I'm 99% sure that the root cause is that pbkrtest got upgraded and the new version depends on R >= 3.2.3. Since Rcmdr depends on car which imports pbkrtest, you get in trouble if your R is not at least at 3.2.3. The easiest way out is probably to upgrade R. -pd > On 08 Ap

[R] Rcmdr will not load

2016-04-08 Thread Kyra Suzuyo Uwate
Hi, I use Rcmdr for a lot of data analysis, but within the last month my computer had just shut down. It took a couple of days to get it up and running, but then R and Rstudio wouldn't load. I had to reinstall it but now whenever I try to access Rcmdr I get an error message. > library(Rcmdr) Loadi

[R] Generating random data with non-linear correlation between two variables

2016-04-08 Thread Muhammad Bilal
Hi All, I am new to R and don't know how to achieve it. I am interested in generating a hypothetical dataframe that is consisted of say two variables named v1 and v2, based on the following constraints: 1. The range of v1 is 500-1500. 2. The mean of v1 is say 1100 3. The range of v2 is 300-950.

Re: [R] R.squared in summary.lm with weights

2016-04-08 Thread Murray Efford
Thanks for these perfectly consistent replies - I didn't understand the purpose of m = sum(w * f/sum(w)) and saw it merely as a weighted average of the fitted values. My ultimate concern is how to compute an appropriate weighted TSS (or equivalently, MSS) for PRESS-R^2 = 1 - PRESS/TSS = 1 - PRE

Re: [R] Generating Hotelling's T squared statistic with hclust

2016-04-08 Thread David L Carlson
As Burt pointed out, your plan is not advisable (that is putting it diplomatically) and not about R, but we can use R to show you why it is not advisable. What you are doing is inherently circular. You use the data to create groups and then you test the groups against the data you used to create

[R] write a function inside the summation in a more condensed form

2016-04-08 Thread Mahmoud via R-help
Dear R Experts that's my original equation > x=c(2,4) > Y1=sum(sapply(1:2,function(i){sum(sapply(1:i,function(j){(3^(x[i]+x[j]))}))})) > > y1 [1] 7371 I want to write the inside function (3^(x[i]+x[j])) in a more condensed form cause this will help me when the multiple summations are more t

Re: [R] Generating Hotelling's T squared statistic with hclust

2016-04-08 Thread hd625b
I believe the package "rattle" can do this. If not, see page 5 of the PDF below. https://cran.r-project.org/web/packages/Hotelling/Hotelling.pdf On 04/08/2016 06:54 AM, Michael wrote: I am doing a cluster analysis with hclust. I want to get hclust to output the Hotelling's T squared statisti

Re: [R] Is this a bug in quantmod::OpCl?

2016-04-08 Thread Joshua Ulrich
On Fri, Apr 8, 2016 at 10:51 AM, James Hirschorn wrote: > > > On 04/06/2016 07:58 PM, Joshua Ulrich wrote: >> >> On Tue, Apr 5, 2016 at 9:17 PM, James Hirschorn >> wrote: >>> >>> OpCl works on xts objects but not on quantmod.OHLC objects. Is this a >>> bug? >>> >> Thanks for the minimal, reproduc

[R] p-value or the t-test value

2016-04-08 Thread Alaa Sindi
Hello, How can I print out the p-value or the t-test value for coefficients estimated from a likelihood function. Thanks __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] Generating Hotelling's T squared statistic with hclust

2016-04-08 Thread Bert Gunter
1. Where did you get the idea that this was a good thing to do? 2. Don't do it. 3. Do not reply to r-help: my comments are about statistics, not R, and so further discussion is off topic here. Either ignore me or post follow up to a statistics list like stats.stackexchange.com . Cheers, Bert

[R] Adding Two-Headed Arrow in map legend

2016-04-08 Thread Miluji Sb
I am trying to draw maps for the world using: library(rworldmap) library(maptools) library(RColorBrewer) tmp2<- dput(head(pece,10)) structure(list(iso3 = c("AUS", "AUT", "BEL", "CAN", "CHE", "CHL", "CZE", "DEU", "DNK", "ESP"), eps_score = c(0.877343773841858, 2.68984365463257, 1.31406247615814,

[R] Subject: tcl-tk error on Suse Linux R install

2016-04-08 Thread Griffiths, Michael
Dear R Forum, I have R installed on a SUSE Linux server. The version of R is 3.2.4 Revised. I have been trying to install R commander on the server to provide a GUI for code development, however when I come to install Rcmdr via install.packages(“”,repos=c(“ http://cran.revolutionanalytics.com”),d

Re: [R] R.squared in summary.lm with weights

2016-04-08 Thread peter dalgaard
On 08 Apr 2016, at 12:57 , Duncan Murdoch wrote: > On 07/04/2016 5:21 PM, Murray Efford wrote: >> Following some old advice on this list, I have been reading the code for >> summary.lm to understand the computation of R-squared from a weighted >> regression. Usually weights in lm are applied t

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] R.squared in summary.lm with weights

2016-04-08 Thread Duncan Murdoch
On 07/04/2016 5:21 PM, Murray Efford wrote: Following some old advice on this list, I have been reading the code for summary.lm to understand the computation of R-squared from a weighted regression. Usually weights in lm are applied to squared residuals, but I see that the weighted mean of the

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 > > Why am I better off with true and

Re: [R] simple question on data frames assignment

2016-04-08 Thread PIKAL Petr
Hi The question does not make much sense so as your code. Maybe you shall spend some time with R tutorials. 1. lapply or sapply is basically hidden cycle 2. function shall return something, yours does not So if you want some binary outcome from a vector you can use e.g. f <- func