Re: [R] New to R

2015-05-09 Thread Luis Fernando García
Dear Boris, I am new too, but got a lot of help from this webpage. I hope it will work for you too, All the best! http://tryr.codeschool.com/ 2015-05-09 23:44 GMT-03:00 Boris Chow : > Dear R users, > > I am new to R community and would like to dig into it. Would you advise > what are the appro

[R] New to R

2015-05-09 Thread Boris Chow
Dear R users, I am new to R community and would like to dig into it. Would you advise what are the appropriate steps to do so? I want to do a pricing of an American option as my first exercise. Can some experienced users give me some pointers to do so? Thanks a lot, Boris _

Re: [R] how to update a value in a list with lapply

2015-05-09 Thread David Winsemius
On May 9, 2015, at 4:35 PM, ce wrote: > Dear All, > > I have a list, using lapply I find some elements of the list, and then I want > to change the values I find. but it doesn't work: > > foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1)) > lapply(foo, function(x) if(x[1] == 1 ) x ) > $A > [1] 1 3

[R] how to update a value in a list with lapply

2015-05-09 Thread ce
Dear All, I have a list, using lapply I find some elements of the list, and then I want to change the values I find. but it doesn't work: foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1)) lapply(foo, function(x) if(x[1] == 1 ) x ) $A [1] 1 3 $B [1] 1 2 $C NULL lapply(foo, function(x) if(x[1]

Re: [R] Error importing data - wrapping?

2015-05-09 Thread Jim Lemon
Hi Kate, The following: x<-read.table(text="A B C D E A 1232 0.565 B 2323 0.5656 0.5656 0.5656 C 2323 0.5656 D 2323 0.5656 E 2323 0.5656 F 2323 0.5656 G 2323 0.5656 G 2323 0.5656 0.5656 0.5656",header=TRUE,fill=TRUE) works fine for me: x AB C D E 1 A 1232 0.5650 NA N

Re: [R] How to define fitness function to optimize the products price

2015-05-09 Thread Bert Gunter
Way way off topic. Ask your instructor for help or clarification. We do neither homework nor theses here. (But you may wish to search the Optimization task view here for packages that might be relevant: http://cran.r-project.org/web/views/Optimization.html 0 Cheers, Bert Bert Gunter Genentech N

[R] Package Build question for Bond Lab

2015-05-09 Thread Glenn Schultz
Hello All, I have set-up the \inst directory and now looking to the .onLoad and .onAttach for side Effects.  The Bond Lab data directories are all in \inst\BondLab.   The connection functions for BondLab are ~\users\BondLab\foo.   I would like to be able to create and copy the \inst\BondLab fo

[R] extract the parameters of the BMA distribution

2015-05-09 Thread maaba
Hi, i need to extract the parameters of the BMA predictive distribution. when i use modelParameters( fit, ...) i obtain the parameters of each member. In my case i would likte to extact the parameters for the global BMA gamma distribution (global model) and not for each member any help ! thanks

[R] How to define fitness function to optimize the products price

2015-05-09 Thread Rashmi Naik k
Dear Sir/Madam I'm Working on a research project called "Dynamic price optimization" using genetic algorithm to optimize product price's in an e-commerce store. I'm doing this project using R language (package GA). I need help in defining a Fitness function to optimize the products price. Can any

[R] rgamma NaN error message

2015-05-09 Thread maaba
hi, i need to generate 250 random values with rgamma function. The problem that i have a negative scale parameter (provided by ensembleBMAgamma0 function). i received a NaN error message any help ! thanks -- View this message in context: http://r.789695.n4.nabble.com/rgamma-NaN-error-message

Re: [R] Error importing data - wrapping?

2015-05-09 Thread William Dunlap
txt <- c("A B C D E", "A 1232 0.565", "B 2323 0.5656 0.5656 0.5656", "C 2323 0.5656", "D 2323 0.5656", "E 2323 0.5656", "F 2323 0.5656", "G 2323 0.5656", "G 2323 0.5656 0.5656 0.5656") z <- read.table(text=txt, fill=TRUE, header=TRUE) str(z) #'data.frame': 8 obs. of 5 variables: # $ A: Factor

Re: [R] Error importing data - wrapping?

2015-05-09 Thread Kate Ignatius
I've tried many things: read.csv("data.frame.txt", header=F, fill=T,stringsAsFactors=FALSE, sep="\t", colClasses="character") read.csv2("data.frame.txt", fill=T,stringsAsFactors=FALSE, sep="\t", as.is=T, colClasses="character") also with read.delim/2 read.table("data.frame.txt", header=F, fill=T

Re: [R] Error importing data - wrapping?

2015-05-09 Thread Kate Ignatius
I've tried colClasses="character", fill=T, as.is=T, header=F, sep="\t", read.csv; read.delim, read.csv2, read.delim2 don't know what else to try. On Sat, May 9, 2015 at 11:13 AM, MacQueen, Don wrote: > Some indication of what you have tried would be useful. Assuming you are > using read.table

Re: [R] Error importing data - wrapping?

2015-05-09 Thread MacQueen, Don
Some indication of what you have tried would be useful. Assuming you are using read.table(), then the "fill" argument of read.table() might be what you need. If you look at the help for read.table you will find: >From ?read.table: fill: logical. If 'TRUE' then in case the rows have unequal leng

Re: [R] Error importing data - wrapping?

2015-05-09 Thread Jeff Newmiller
There are many ways to import data into R, and I don't know any of them that would do what you are describing. You really need to give us some reproducible code if we are to follow along with your problem. --- Jeff Newmiller

[R] Error importing data - wrapping?

2015-05-09 Thread Kate Ignatius
I have some data that I've trouble importing... A B C D E A 1232 0.565 B 2323 0.5656 0.5656 0.5656 C 2323 0.5656 D 2323 0.5656 E 2323 0.5656 F 2323 0.5656 G 2323 0.5656 G 2323 0.5656 0.5656 0.5656 When I input the data it seems to go like this: SampleID ItemB ItemC ItemD ItemE A 1232 0.565 B 232

[R] ERROR: length of 'center' must equal the number of columns of 'x'

2015-05-09 Thread Barry King
I am attempting to predict tomorrow's rainfall, RISK_MM, with LASSO using a data set that I have partitioned into a train data set and a test data set. The structures of the two data sets are shown below and appear to be identical except the number of observations: str(train) 'data.frame': 262 ob