Re: [R] generating phi using function()

2015-03-30 Thread Daniel Nordlund
On 3/30/2015 12:30 PM, T.Riedle wrote: Hi, I am struggling with following function phi <- function(w1, w2, j, k, K){ + zaehler <- (k/K)^(w1-1)*(1-k/K)^(w2-1) + nenner <- sum( ((1:K)/K)^(w1-1)*(1-(1:K)/K)^(w2-1)) + return( zaehler/nenner ) + } phi(c(1, 1), 44L, 1) Error in phi(c(1, 1), 4

Re: [R] Multiple Plots using ggplot

2015-03-30 Thread Jeff Newmiller
This is no better because (a) you are still posting using HTML format, and (b) using printed output loses the internal representation of the data. The dput function is very helpful for solving this. [1] [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --

Re: [R] Multiple Plots using ggplot

2015-03-30 Thread Frederic Ntirenganya
Hi Stephen, Sorry, the data came in bad way. Here is the head of the data. > head(data)Date Number.of.Rain.Days Total.rain Start.of.Rain..i. > Start.of.Rain..ii. Start.of.Rain..iii. Start.Rain..iv. 1 1952-01-01 86 1139.95292 239 11

Re: [R] temporal autocorrelation in MCMCglmm

2015-03-30 Thread Ben Bolker
David Villegas Ríos gmail.com> writes: > Hi, > For a number of individuals, I have measured several behavioral traits in > the wild. Those traits (e.g. home range) can be estimated on different > temporal scales, for example daily, weekly or monthly. I want to estimate > repeatability of those tr

Re: [R] Help with POSIX

2015-03-30 Thread Ben Tupper
Hi, On Mar 30, 2015, at 9:15 PM, Doran, Harold wrote: > I�m struggling a bit with learning about POSIX objects to do some basic > things with objects of this class. Suppose I have the following simple example > > times <- c("03:20", "29:56", "03:30", "21:03", "56:26") > > aa <- strptime(time

[R] generating phi using function()

2015-03-30 Thread T.Riedle
Hi, I am struggling with following function > phi <- function(w1, w2, j, k, K){ + zaehler <- (k/K)^(w1-1)*(1-k/K)^(w2-1) + nenner <- sum( ((1:K)/K)^(w1-1)*(1-(1:K)/K)^(w2-1)) + return( zaehler/nenner ) + } > phi(c(1, 1), 44L, 1) Error in phi(c(1, 1), 44L, 1) : argument "k" is missing, with no

[R] how to deal with changing weighting functions

2015-03-30 Thread T.Riedle
Hi everybody, Does anybody have an idea how I can generate tau according to the attached formula? The point is that phi changes with k and I thought I could make it by using a for-function in R but I am not sure how to do that. Could anyone help me? Thanks in advance. __

Re: [R] Trying to understand a function passed to lapply

2015-03-30 Thread Jim Lemon
Hi John, What happens is that you have passed two named arguments to your function "myfun" along with the matrix "data". Because these arguments have associated values ("delta", "SE"), these values are substituted into the expression like this: x["delta"]/x["SE"] which is the return value of "myf

Re: [R] Trying to understand a function passed to lapply

2015-03-30 Thread William Dunlap
> I can't understand how the body of the function, x[c1]/x[c2] refers to the columns "data" and "SE" of the matrix data. If you put the line 'str(x)' at the start of myfun(), as in myfun <- function(x, c1, c2) { str(x) x[c1]/x[c2] } you would start to see why it works - extractin

Re: [R] Help with POSIX

2015-03-30 Thread David Wolfskill
On Tue, Mar 31, 2015 at 01:15:09AM +, Doran, Harold wrote: > I?m struggling a bit with learning about POSIX objects to do some basic > things with objects of this class. Suppose I have the following simple example > > times <- c("03:20", "29:56", "03:30", "21:03", "56:26") > > aa <- strptime

Re: [R] Help with POSIX

2015-03-30 Thread Jeff Newmiller
You seem to be trying to make POSIXt into something it isn't, as though this was Excel. First, POSIXt is not the same as numeric. You can convert between them, but they are not the same. If you want to do numeric operations, convert. Second, POSIXt is not time of day only. When you provide onl

Re: [R] Plotting using tapply function output

2015-03-30 Thread Jim Lemon
Hi Alexandra, This produces a rather messy plot, but it might get you started: finalData<-data.frame(ws=sample(0:100,1300,TRUE), stn=rep(1:13,each=100),hour=rep(1:24,length.out=1300)) statHour = tapply(finalData$ws,list(finalData$stn,finalData$hour),sd) # open a wide device x11(width=13) # leave

[R] Trying to understand a function passed to lapply

2015-03-30 Thread John Sorkin
Colleagues, I am trying to understand the syntax of a function passed to apply. The code below generates a matrix, and passes the matrix to a function that is called by apply. I don't understand the syntax of the function. In some way the function computes data[,"delta"]/data[,"SE"]. I can't und

[R] Help with POSIX

2015-03-30 Thread Doran, Harold
I�m struggling a bit with learning about POSIX objects to do some basic things with objects of this class. Suppose I have the following simple example times <- c("03:20", "29:56", "03:30", "21:03", "56:26") aa <- strptime(times, "%M:%S�) I can do means, and some other basic things, but I cannot

[R] Mann-Kendall test for many independent columns data set at a time

2015-03-30 Thread Desta Yoseph via R-help
I am analyzing trend test using Mann-kendall monotonic trendtest for 10,368 independent grid cell, each grid has 34 years dataset.  I supposed to find Kendall “tau” for each gridcell (each grid has 34 years data). The data is arranged in column wise (Iattached  part of the grid dataset  as a sam

[R] Plotting using tapply function output

2015-03-30 Thread Alexandra Catena
Hello, I am trying to plot the hourly standard deviation of wind speeds from 13 different measured locations over many years. I imported the data using readLines and into a dataframe called finalData. Using tapply, I determined the standard deviation of the windspeed (ws) for each hour (hour) from

Re: [R] multinomial probabilities with mlogit

2015-03-30 Thread Rolf Turner
Reproducible example??? cheers, Rolf Turner P.S. Where does "mlogit" come from? Note fortune(182). R. T. On 31/03/15 06:46, Ingrid Charvet wrote: Hello, When fitting a logit multinomial model with "mlogit" I can retrieve the response probabilities using fit$fitted.values (for a given ob

Re: [R] Debug package options

2015-03-30 Thread Duncan Murdoch
On 30/03/2015 1:50 PM, Keith S Weintraub wrote: > Folks, > > I would like change some of the options for the Tk window that pops up when > using the debug package. > > I know how to change the options: e.g. options(debug.font = "Courier 12 > italic”). > > Is there a way to “preset” these in my

[R] Debug package options

2015-03-30 Thread Keith S Weintraub
Folks, I would like change some of the options for the Tk window that pops up when using the debug package. I know how to change the options: e.g. options(debug.font = "Courier 12 italic”). Is there a way to “preset” these in my environment so when debug starts up I have all the options set u

[R] multinomial probabilities with mlogit

2015-03-30 Thread Ingrid Charvet
Hello, When fitting a logit multinomial model with "mlogit" I can retrieve the response probabilities using fit$fitted.values (for a given object "fit") However, I am trying to calculate those response probabilities myself using the maximum likelihood estimates (i.e. fit$coefficients) given by

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread MacQueen, Don
Regarding the averages, someone else mentioned that it's preferred to start a new question in a new post to the list. That said, you are confusing "inside" the list with "outside" the list. Try this: (the following R expression is supposed to be all on one line, but my email software may cause a

Re: [R] A problem someone should know about

2015-03-30 Thread Richard M. Heiberger
My error is Mac because I don't use R-Studio. The phrasing of Ian's error is similar to the error I reported and still occasionally get. As I said, it is random and therefore not reproducible. This is consistent with the comments on the rstudio link you pointed us to. Rich On Mon, Mar 30, 2015

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Sven E. Templer
On 30 March 2015 at 17:50, Sarah Goslee wrote: > On Mon, Mar 30, 2015 at 11:43 AM, Sven E. Templer > wrote: > > > > > > On 30 March 2015 at 17:31, Bert Gunter wrote: > >> > >> Sarah's statement is correct. > >> > >> So is yours. They are not contradictory, and I believe Sarah's point > >> was t

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Sarah Goslee
On Mon, Mar 30, 2015 at 11:43 AM, Sven E. Templer wrote: > > > On 30 March 2015 at 17:31, Bert Gunter wrote: >> >> Sarah's statement is correct. >> >> So is yours. They are not contradictory, and I believe Sarah's point >> was that the OP needed to learn the appropriate syntax. >> > > That's why

[R] Fwd: changing column labels for data frames inside a list

2015-03-30 Thread Bert Gunter
Sorry, I failed to cc the list. -- Bert -- Forwarded message -- From: Bert Gunter Date: Mon, Mar 30, 2015 at 8:36 AM Subject: Re: [R] changing column labels for data frames inside a list To: Vikram Chhatre You really really need to spend (more?) time with a good R tutorial

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Sven E. Templer
On 30 March 2015 at 17:31, Bert Gunter wrote: > Sarah's statement is correct. > > So is yours. They are not contradictory, and I believe Sarah's point > was that the OP needed to learn the appropriate syntax. > > That's why I pointed to ?return. Sarah's statement was not so clear (and might have

[R] Vennerable plot

2015-03-30 Thread gktahon
Hi all, I frequently use Vennerable to design diagrams of my data. However, when I want to make a weighed diagram for a set of 4 samples, type ChowRuskey, I get a nice view, but the font size of both numbers and sample names is too small. Furthermore, the place of the sample names isn't always tha

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Sven E. Templer
On 30 March 2015 at 17:19, Vikram Chhatre wrote: > First of all, thank you for all the quick replies. Here is a solution that > worked for me. > > mylist2 <- lapply(mylist, function(e){colnames(e) <- paste0('pop',1:12); > return(e)}) > > > head(mylist2[[1]]) > pop1 pop2 pop3 pop4 pop

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Bert Gunter
Sarah's statement is correct. So is yours. They are not contradictory, and I believe Sarah's point was that the OP needed to learn the appropriate syntax. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Vikram Chhatre
First of all, thank you for all the quick replies. Here is a solution that worked for me. mylist2 <- lapply(mylist, function(e){colnames(e) <- paste0('pop',1:12); return(e)}) > head(mylist2[[1]]) pop1 pop2 pop3 pop4 pop5 pop6 pop7 pop8 pop9 pop10 pop11 pop12 L0001.1 0.60 0.500 0.

[R] error MANOVA in R

2015-03-30 Thread Gian Maria Niccolò Benucci
Dear R-usrs, I am trying to perform a MANOVA on a data frame with 31 columns about soil parameters and 1 column containing the explanatory variable (Fraction) that have three levels. my code is the following: datam <- read.table("data_manova2.csv", header=T, sep=",") names(datam) manova_fraction

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Sven E. Templer
On 30 March 2015 at 16:47, Sarah Goslee wrote: > colnames(e) <- paste0('pop',1:12) > > isn't a function and doesn't return anything. > But function(e){colnames(e) <- paste0('pop', 1:2)} is a function and it returns something (the last evaluated expression! - here the paste0 return): > mylist2 <

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Ivan Calandra
I am not sure it would do it since there is no reproducible example, but try names() instead of colnames(). HTH, Ivan -- Ivan Calandra, ATER University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.calan...@univ-reims.

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread MacQueen, Don
Assuming that the elements of mylist are data frames, try this: mylist <- lapply(mylist, function(e) { names(e) <- paste0('pop',1:12) ; e}) With certain exceptions, the result of a function is the result of the last expression in the function body. As you defined it, the last expression was co

Re: [R] changing column labels for data frames inside a list

2015-03-30 Thread Sarah Goslee
colnames(e) <- paste0('pop',1:12) isn't a function and doesn't return anything. > mylist <- list( + data.frame(a = runif(10), b = runif(10)), + data.frame(c = runif(10), d = runif(10)), + data.frame(e = runif(10), f = runif(10))) > mylist2 <- lapply(mylist, function(e){colnames(e) <- paste0('pop'

Re: [R] Again: A problem someone should know about

2015-03-30 Thread David L Carlson
In your first example you created logfat.lm and then tried to plot logfat so you got an error indicating that logfat did not exist. In your second example we have no idea what body.fat. You must make your examples reproducible so that we can reproduce your error. It looks like you could also b

[R] Transformation of the circular variable into linear variable

2015-03-30 Thread Nasr Al-Dhurafi
I am working with a circular data ( wind direction ) and i have problem in transforming the circular variable into linear variable. I have found an equation that can be used to convert the circular variable into linear variable which is included in this paper *" ARMA based approaches for forecasti

Re: [R] Multiple Plots using ggplot

2015-03-30 Thread stephen sefick
Hi Frederic, Can you provide a minimal reproducible example including either real data (dput), or simulated data that mimics your situation? This will allow more people to help. Stephen On Mon, Mar 30, 2015 at 8:39 AM, Frederic Ntirenganya wrote: > Dear All, > > I want to plot multiple using g

Re: [R] Again: A problem someone should know about

2015-03-30 Thread Sarah Goslee
On Mon, Mar 30, 2015 at 1:59 AM, Ian Lester wrote: > i have no idea what to do One of the other responses already told you it was probably an Rstudio problem, so not using Rstudip seems like a good place to start. Sarah > >> plot(body.fat, BMI,xlab="Body fat",ylab="BMI",main=“Figure 2.1: BMI vs

Re: [R] vif in package car: there are aliased coefficients in the model

2015-03-30 Thread Rodolfo Pelinson
Thanks a lot for the answer and I'm sorry for the silly question! Also thanks for the conceptual advice! It was also a doubt of me and my advisors. Best! 2015-03-28 15:17 GMT-03:00 John Fox : > Dear Rodolfo, > > Sending the data helps, though if you had done what I suggested, you would > have

[R] Joint distribution of wind data

2015-03-30 Thread Nasr Al-Dhurafi
* Hi, ** I'm dealing with wind data and I'd like to model their** distribution.** Wind** direction * * are typically following a vonmises distribution and wind speeds **follow a weibull distribution. I'd like to build a joint** distribution** of directions and speeds as a VonMises-Weibull bivariate

[R] Again: A problem someone should know about

2015-03-30 Thread Ian Lester
i have no idea what to do > plot(body.fat, BMI,xlab="Body fat",ylab="BMI",main=“Figure 2.1: BMI vs Body > fat (n=252)”) Error: unexpected input in "plot(body.fat, BMI,xlab="Body fat",ylab="BMI",main=�" > plot(body.fat, BMI,xlab="Body fat",ylab="BMI") serious error. This application, or a librar

[R] changing column labels for data frames inside a list

2015-03-30 Thread Vikram Chhatre
> summary(mygenfreqt) Length Class Mode dat1.str 59220 -none- numeric dat2.str 59220 -none- numeric dat3.str 59220 -none- numeric > head(mylist[[1]]) 1 2 3 4 5 6 7 8 91011 12 L0001.1 0.60 0.500 0.325 0.675 0.600 0.500 0.500

Re: [R] generating phi using function()

2015-03-30 Thread JLucke
Your function phi has 5 arguments with no defaults. Your call only has 3 arguments. Hence the error message. > phi <- function(w1, w2, j, k, K){ + zaehler <- (k/K)^(w1-1)*(1-k/K)^(w2-1) + nenner <- sum( ((1:K)/K)^(w1-1)*(1-(1:K)/K)^(w2-1)) + return( zaehler/nenner ) + } > phi(c(1, 1), 44

Re: [R] Ayuda con un árbol de regresión

2015-03-30 Thread Jose Iparraguirre
Miguel, Sin tus datos es imposible brindarte una respuesta precisa pero ten en cuenta que la descripción del argumento 'fórmula' en la función tree del paquete del mismo nombre dice que la variable dependiente -PRECIO en tu caso- debe ser un vector numérico si quieres estimar un árbol de regre

[R] data.frame: data-driven column selections that vary by row??

2015-03-30 Thread David Wolfskill
Sorry if that's confusing: I'm probably confused. :-( I am collecting and trying to analyze data regarding performance of computer systems. After extracting the data from its repository, I have created and used a Perl script to generate a (relatively) simple CSV, each record of which contains: *

[R] Multiple Plots using ggplot

2015-03-30 Thread Frederic Ntirenganya
Dear All, I want to plot multiple using ggplot function from a data frame of many columns. I want to plot only str1, str2 and str3 and I failed to make it. What I want is to compare str1, str2 and str3 by plotting vertical line. I also need to add points to the plot to be able to separate them.

Re: [R] A problem someone should know about

2015-03-30 Thread Peter Claussen
Rich, You’ve probably reported the error to the wrong group. A quick search suggests this is not an R issue, but an RStudio issue. The error message is unique enough. Google returns this as the first link: https://support.rstudio.com/hc/communities/public/questions/200807456-Error-when-plotting

Re: [R] non-conformable arguments

2015-03-30 Thread Thierry Onkelinx
We need enough information to run your code on our computer and get the same error as you. In this case we are missing the data. See e.g. http://adv-r.had.co.nz/Reproducibility.html If you can't provide the original data, then try to make a (small) example which reproduces your problem. ir. Thierr

[R] Fwd: non-conformable arguments

2015-03-30 Thread Soheila Khodakarim
Dear Thierry Onkelinx, Thank you so much to answer me. But I do not know what information I should send for you I want to run neural network on my data.I run these codes and I saw this Error in the last line #load mydata dim(mydata) # 20 3111 library(neuralnet) fm <- as.formula(paste("resp ~", pa

Re: [R] non-conformable arguments

2015-03-30 Thread Thierry Onkelinx
You should sent us a commented, minimal, self-contained, reproducible code as the posting guide tells you to do. Your code is not self-contained. So we can only speculate what when wrong. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Bi

[R] non-conformable arguments

2015-03-30 Thread Soheila Khodakarim
Dear All, I want to run neural network on my data. i run these codes: #load mydata dim(mydata) # 20 3111 library(neuralnet) fm <- as.formula(paste("resp ~", paste(colnames(mydata)[1:3110], collapse="+"))) out <- neuralnet(fm,data=mydata, hidden = 4, lifesign = "minimal", linear.output = FALSE, t

[R] POSIX and ecdf()

2015-03-30 Thread Doran, Harold
Below is some working code that, generally speaking, accomplishes why I want, but am looking for a necessary improvement in the final step. The code below scrapes data from a website (thousands of pages actually) and organizes athlete�s scores in a data frame. The final variable, called Workout0

Re: [R] matrix manipulation question

2015-03-30 Thread peter dalgaard
> On 30 Mar 2015, at 09:59 , Stéphane Adamowicz > wrote: > > > However, in order to help me understand, would you be so kind as to give me a > matrix or data.frame example where « complete.cases(X)== T » or « > complete.cases(X)== TRUE » would give some unwanted result ? The standard proble

Re: [R] matrix manipulation question

2015-03-30 Thread Berend Hasselman
> On 30-03-2015, at 09:59, Stéphane Adamowicz > wrote: > > > Le 27 mars 2015 à 18:01, David Winsemius a écrit : > >> >> On Mar 27, 2015, at 3:41 AM, Stéphane Adamowicz wrote: >> >>> Well, it seems to work with me. >>> >> >> No one is doubting that it worked for you in this instance. What

Re: [R] matrix manipulation question

2015-03-30 Thread Stéphane Adamowicz
Le 27 mars 2015 � 18:01, David Winsemius a �crit : > > On Mar 27, 2015, at 3:41 AM, St�phane Adamowicz wrote: > >> Well, it seems to work with me. >> > > No one is doubting that it worked for you in this instance. What Peter D. was > criticizing was the construction : > > complete.cases(t(

[R] temporal autocorrelation in MCMCglmm

2015-03-30 Thread David Villegas Ríos
Hi, For a number of individuals, I have measured several behavioral traits in the wild. Those traits (e.g. home range) can be estimated on different temporal scales, for example daily, weekly or monthly. I want to estimate repeatability of those traits, assuming that the daily/weekly/monthly measur