[R] lm-step: use train-data model to validate test-data

2016-02-22 Thread Amoy Yang via R-help
I have model-data named as: model that is split as model.T(train) and model.V(test or validation). The least square model (from lm to step) is built withmodel.T and I like to see how model.T is robust by comparing predicted model.V toactual model.V. How do I get score for model.V based on model

[R] MACRO-LOOP in R

2016-02-18 Thread Amoy Yang via R-help
I am doing the data transpose with rename as shown below (step1 ~ step4) 1. Is any way in R similar to PROC TRANSPOSE used in SAS?2. How to use MACRO-LOOP to simplify the following procedure? THANK YOU FOR HELPS! # create data for test x<-data.frame(  a=c(1,2,3),  b=c("1","2","3")); x; str(x)# s

[R] Create macro_var in R

2016-02-05 Thread Amoy Yang via R-help
or helps! Amoy On Wednesday, February 3, 2016 5:25 PM, Gabor Grothendieck wrote: See   Example 5.  Insert Variables on the sqldf home page.   https://github.com/ggrothendieck/sqldf On Wed, Feb 3, 2016 at 2:16 PM, Amoy Yang via R-help wrote: > First, MVAR<-c("population

Re: [R] Create macro_var in R

2016-02-03 Thread Amoy Yang via R-help
Right! the following works to r but not sqldf. MVAR <- "population" tab[[ MVAR ]] sqldf("select tab[[MVAR]] from tab") On Wednesday, February 3, 2016 1:18 PM, Amoy Yang via R-help wrote: First, MVAR<-c("population) should be the same as "populatio

Re: [R] Create macro_var in R

2016-02-03 Thread Amoy Yang via R-help
pulation; In the following r-program, for instance, I cannot use ... tab$MVAR...or simply MVAR itself since MVAR is defined as "population" with double quotes if using MVAR<-c("population")    On Wednesday, February 3, 2016 11:54 AM, Duncan Murdoch wrote: On 03/02/2016 12:

Re: [R] Create macro_var in R

2016-02-03 Thread Amoy Yang via R-help
as "population" with double quotes if using MVAR<-c("population") On Wednesday, February 3, 2016 11:54 AM, Duncan Murdoch wrote: On 03/02/2016 12:41 PM, Amoy Yang via R-help wrote: >  There is a %LET statement in SAS: %let MVAR=population; Thus, MVAR can be >u

[R] Create macro_var in R

2016-02-03 Thread Amoy Yang via R-help
There is a %LET statement in SAS: %let MVAR=population; Thus, MVAR can be used through entire program. In R, I tried MAVR<-c("population"). The problem is that MAVR comes with double quote "" that I don't need. But MVAR<-c(population) did NOT work out. Any way that double quote can be remov

Re: [R] Error opening SHP file

2016-01-22 Thread Amoy Yang via R-help
Winsemius wrote: > On Jan 22, 2016, at 9:24 AM, Amoy Yang via R-help > wrote: > > This is the results that addresses David's advice. >> library(maptools) >> library(maps) >> state.map <- readShapeSpatial("maps/st24_d00.shp") > Error in getinfo.sha

Re: [R] Error opening SHP file

2016-01-22 Thread Amoy Yang via R-help
or directory" Barry On Fri, Jan 22, 2016 at 2:25 AM, boB Rudis wrote: > Agreed with the others. After finding that shapefile and getting it to > work you are definitely not in the proper working directory. > > On Thu, Jan 21, 2016 at 8:40 PM, David Winsemius > wrote: >> &

[R] Error opening SHP file

2016-01-21 Thread Amoy Yang via R-help
Any advice for the following errors? state.map <- readShapeSpatial("maps/st24_d00.shp") Error in getinfo.shape(fn) : Error opening SHP file [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, se

[R] Use SQL in R environment

2016-01-15 Thread Amoy Yang via R-help
Hi All, I am new here and a beginner for R. Can I use SQL procedure in R environment as it can be done in SAS starting with PROC SQL; Thanks for helps! Amoy [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUB