search for: datanew

Displaying 7 results from an estimated 7 matches for "datanew".

Did you mean: datanet
2012 May 13
1
Help writing function in R....
...x","y","z","y","x","a"),type=c("iron","ball","helmet","shoe","driver","iron"), retail=c(124,.60,80,75,150,108),actual=c(112,.60,72,75,135,100)) retailsum=funtion(segment,brand,type){ datanew=dataold[which(dataoldsegment='segment' & dataoldbrand='brand' & dataold$type='type'),c("retail","actaul")] summary=c(dim(datanew)[1],colMeans(datanew)) return(summary) } The code inside the function braces works on its own, but once I wrap a fun...
2012 May 30
2
Sorting a data set
...o assign that variable. Is there a reason R would not accept "0" or "00" as a numeric value? I have tried using the order function but the examples I have seen don't seem to translate for me. I tried something like this assuming my dataset is called "data". datanew<-data[order(var1, var2),] print(datanew) This generates an "incorrect number of dimensions" error in the order function. I also tried listing all the variables in the parentheses. Your help is appreciated.
2011 Apr 18
2
SQLDF syntax
Hi, I am new to R and trying to migrate from SAS. I am trying to use sqldf to create a new table from existed table and change some of the columns. I have table called DataOld with columns commodity, rate and total and I am trying to create new table called DataNew with columns commodity, ratenew and totalNew. > sqldf("create table datanew as select commodity, ratenew as rate * 10, > totalnew as total *10 from DataOld") I got error message " Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement:...
2013 Apr 13
2
Comparison of Date format
...D","Status",names(x1))] else NULL}) ?lst2<-lapply(lst1,data.frame) lst2<-lst2[lapply(lst2,nrow)!=0] ?lst2 #[[1]] #? ID Status??? Date2 #3? 1????? A 3-Sep-01 #[[2]] #? ID Status???? Date2 #5? 1????? C 26-Feb-04 #[[3]] #? ID Status??? Date1 #9? 2????? A 6-Mar-02 library(plyr) ?dataNew<-do.call(rbind,lapply(lst2,function(x) {colnames(x)[3]<- colnames(DataB)[2];x})) res<-join(dataNew,DataB,by=c("Date.Accident","ID"),type="right") ?res #? Date.Accident ID Status #1????? 3-Sep-01? 1????? A #2???? 20-Jan-05? 1?? <NA> #3???? 26-Feb-04? 1???...
2013 Dec 13
2
how do I separete coloumns by comma?
Hi every one, I have a text file like this: 1    4   4    1    6    23 1   4    2    2    3    28 1    4    5    1    2    24 1    2    3    1    1    24 1   2    3    1    2     40 1   2   3    1    4      22 I want to separate columns by comma, like this: 1,4,4,1,6,23 1,4,2,2,3,28 1,4,5,1,2,24 1,2,3,1,1,24 1,2,3,1,2,40 1,2,3,1,4,22   I used this code:
2009 Oct 26
2
help with linear model
Dear list, I have been searching for a week to fit a simple linear model to my data. I have looked into the previous posts but I haven't found anything relevant to my problem. I guess it is something simple...I just cannot see it. I have the following data frame, named "data", which is a subset of a microarray experiment. The columns are the samples and the rows are the probes. I
2010 Nov 17
3
stacking consecutive columns
I have a file, each column of which is a separate year, and each row of each column is mean precipitation for that month. Looks like this (except it goes back to 1964). month X2000 X2001 X2002 X2003 X2004 X2005 X2006 X2007 X2008 X2009 1 1.600 1.010 4.320 2.110 0.925 3.275 3.460 0.675 1.315 2.920 2 2.960 3.905 3.230 2.380 2.720 1.880 2.430 1.380