Re: [R] About change columns and specific rows in R

2017-05-22 Thread Ivan Calandra
Hi, Actually, you don't need to create the column first, nor to use which: DF[DF$month==1, "product1_1"] = DF[DF$month==1, "product1"] * 3.1 The "[" is a great tool that you need to learn. In this case, you don't need to combine "[" and $: within the square brackets, the vector before the comm

Re: [R] About change columns and specific rows in R

2017-05-22 Thread William Michels via R-help
Hi Lily, You're on the right track, but you should define a new column first (filled with NA values), then specify the precise rows and columns on both the left and right hand sides of the assignment operator that will be altered. Luckily, this is pretty easy...just remember to use which() on the

[R] About change columns and specific rows in R

2017-05-22 Thread lily li
Hi R users, I have a question about manipulating the dataframe. I want to create a new dataframe, and to multiply rows with different seasons for different constants. DF year month day product1 product2 product3 1981 1 1 18 5620 1981 1

Re: [R] problem with system.file

2017-05-22 Thread Jeff Newmiller
Did not look to me like Windows was a factor here... OP referred to /home/paumarc/Bam. I think the issue was trying to access his own data using an inappropriate function. -- Sent from my phone. Please excuse my brevity. On May 22, 2017 3:22:06 PM PDT, Jim Lemon wrote: >Windows. A funny name f

Re: [R] problem with system.file

2017-05-22 Thread Jim Lemon
Windows. A funny name for a operating system that doesn't let you see anything. Jim On Mon, May 22, 2017 at 11:59 PM, Pau Marc Muñoz Torres wrote: > i could make it worl, thanks for your help, it was usefull > > Pau Marc Muñoz Torres > skype: pau_marc > http://www.linkedin.com/in/paumarc > http:

Re: [R] Duplicate row names are not allowed

2017-05-22 Thread Jeff Newmiller
Start with the Posting Guide mentioned at the bottom of this email. Note that only a very few types of attachments are permitted on this list... yours apparently were not. We generally find that providing a reproducible example that includes the data in the R code and the statements that cause

Re: [R] R truncating decimal places

2017-05-22 Thread William Dunlap via R-help
Do not compute the log likelihood as the log of the product of probabilities. Instead compute it as the sum of logs of probabilities. The latter is less likely to underflow (go below c. 0^-309). Most (all?) of the built-in probability density functions have a 'log' argument; when log=TRUE you get

[R] R truncating decimal places

2017-05-22 Thread Andrea Goijman
Hello list, I' trying to estimate a log likelihood function from my data. I apply the mean to all my simulations, and I get something like this: apply(likelihood, c(2, 3, 4), mean,na.rm=TRUE) , , 1 [,1] [,2] [,3] [,4] [,5][,6] [,7] [1,] 0.73162327 0.

[R] Duplicate row names are not allowed

2017-05-22 Thread ville iiskola via R-help
Hi I read a book where was shown an example how to create a probability model with mlogit. I tried to do like the instruction said but i get error message that "duplicate row names are not allowed". What could i do to fix it? I had the data in excel and imported it to R using R commander. I atta

Re: [R] [FORGED] Logical Operators' inconsistent Behavior

2017-05-22 Thread William Michels via R-help
Evaluation of the NOT, AND, OR logical statements below in MySQL 5.5.30-log Community Server (GPL) replicate R's truth tables for NOT, AND, OR. See MySQL queries (below), which are in agreement with R truth table code posted in this thread: bash-3.2$ mysql Welcome to the MySQL monitor. Commands

Re: [R] problem with system.file

2017-05-22 Thread Pau Marc Muñoz Torres
i could make it worl, thanks for your help, it was usefull Pau Marc Muñoz Torres skype: pau_marc http://www.linkedin.com/in/paumarc http://www.researchgate.net/profile/Pau_Marc_Torres3/info/ 2017-05-22 15:38 GMT+02:00 Pau Marc Muñoz Torres : > hi to you both > > You are right peter, I probably

Re: [R] problem with system.file

2017-05-22 Thread Pau Marc Muñoz Torres
hi to you both You are right peter, I probably miss understood the system.file function. I was trying to use it with a package from bioconductor and when i saw that it didn't work for me, I tested with readxl and still do not working, so I am doing something wrong with system.file the original s

Re: [R] How to extract text contexts after clustering.

2017-05-22 Thread David L Carlson
As Ismail notes, you did not give us your code, only a few disconnected bits of your code. Assuming that by "top 1 group" you mean the largest group, here is a reproducible example: # First create a reproducible set of data set.seed(42) mydata <- matrix(rnorm(300, 50, 10), 100, 3) # A matrix wit

Re: [R] Identyfing rows with specific conditions

2017-05-22 Thread Bert Gunter
You haven't said whether your "table" is a matrix or data frame. Presumably the latter. Nor have you answered my question about whether order of your meal code pairs matters. Another question: can meals be replicated for an ID or are they all different? Finally, is this a homework assignment or

Re: [R] problem with system.file

2017-05-22 Thread Ulrik Stervbo
What is your version of readxl? In my version 1.0, there is no directory called estdata, but there is one called extdata. However, in that directory there is no file called "results.xlsx" Either it was there once and has now gone missing or "results.xlsx" your own file? It looks like the latter -

Re: [R] problem with system.file

2017-05-22 Thread peter dalgaard
> On 22 May 2017, at 14:43 , Pau Marc Muñoz Torres wrote: > > Hello everybody > > I am trying to use system.file but it returns not file found > > what I have done is > >> sample <- system.file("results.xlsx","estdata", package = > "readxl",mustWork = TRUE) > Error in system.file("results.xls

[R] problem with system.file

2017-05-22 Thread Pau Marc Muñoz Torres
Hello everybody I am trying to use system.file but it returns not file found what I have done is > sample <- system.file("results.xlsx","estdata", package = "readxl",mustWork = TRUE) Error in system.file("results.xlsx", "estdata", package = "readxl", mustWork = TRUE) : no file found i have c

[R] problem with

2017-05-22 Thread Pau Marc Muñoz Torres
Hello everybody I am trying to use system.file but it returns not file found what I have done is > sample <- system.file("results.xlsx","estdata", package = "readxl",mustWork = TRUE) Error in system.file("results.xlsx", "estdata", package = "readxl", mustWork = TRUE) : no file found i have c

[R] R - datatable formatting with javascript

2017-05-22 Thread Krzysiek Gniady
I'm trying to format datatable in R using DT package. I have code like this: library(data.table) library(DT) data<-data.table(rbind(c(1,2,3),c(4,5,6))) colnames(data)<- c('A','B','c') datatable(data, rownames=F, colnames=c('A','B','C'), class='stripe cell-border hover', options=

Re: [R] Forecast using VAR model

2017-05-22 Thread Dhivya Narayanasamy
Hi Jon, sorry for the inconvenience. I have done it in plain text now. I am building a VAR model to forecast of bivariate time series. But it shows flat forecast and i am in need of correcting it. Is there any way to correct this flat forecast? or Do i have to go with other models? Code: > da

[R] JMdesign package

2017-05-22 Thread Bernard North
Dear R list I wonder please if anyone has experience they can share of the JMdesign package that performs sample sized for (surviival/longitudinal) joint models and is based on the paper "Sample size and power determination in joint modeling of longitudinal and survival data " by Chen et al (

Re: [R] Identyfing rows with specific conditions

2017-05-22 Thread Allaisone 1
Hi Again.., All of my 2 tables are data.frames and the order of meals does not matter. Meal A =2 and Meal B= 15 is the same as Meal A=15 and Meal B= 2. From: Bert Gunter Sent: 22 May 2017 03:19:57 To: Allaisone 1 Cc: r-help@r-project.org Subject: Re: [R] Identy

[R] RC class composition

2017-05-22 Thread Mohan.Radhakrishnan
Hi, The last line should give me the value of 'amount'. Is the syntax wrong ? Measurement <- setRefClass("Measurement", fields = list(subject = Subject, quantity = Quantity)) s <- Subject$new(id = 100) u <- CompoundUnit$new( micrograms = 100,

Re: [R] Error with installed.packages with R 3.4.0 on Windows

2017-05-22 Thread Martin Morgan
On 05/22/2017 05:10 AM, Patrick Connolly wrote: On Fri, 28-Apr-2017 at 07:04PM +0200, peter dalgaard wrote: |> |> > On 28 Apr 2017, at 12:08 , Duncan Murdoch wrote: |> > |> > On 28/04/2017 4:45 AM, Thierry Onkelinx wrote: |> >> Dear Peter, |> >> |> >> It actually breaks install.packages(). So i

Re: [R] Error with installed.packages with R 3.4.0 on Windows

2017-05-22 Thread Patrick Connolly
On Fri, 28-Apr-2017 at 07:04PM +0200, peter dalgaard wrote: |> |> > On 28 Apr 2017, at 12:08 , Duncan Murdoch wrote: |> > |> > On 28/04/2017 4:45 AM, Thierry Onkelinx wrote: |> >> Dear Peter, |> >> |> >> It actually breaks install.packages(). So it is not that innocent. |> > |> > I don't thin