similar to: Use of Apply to Change Values in Dataframe

Displaying 20 results from an estimated 10000 matches similar to: "Use of Apply to Change Values in Dataframe"

2002 May 24
3
Converting Character Strings into Object Names
Is there a function to convert character strings to object references. For example, I want to name sets of objects based on scenarios and the types of data being stored. So the scenarios might be something like c("a", "b", "c"), the types of data might have names like c("pass.trp", "trk.trp", "cmute.trp"), and I want to assign data to
2004 Apr 21
1
Error with 1.9.0 - winMenuAdd not usable in .Rprofile
I had this problem too. The documentation for the winMenus says that these functions are part of the utils package. R must be loading this library after it sources in Rprofile. If you add library(utils) to the beginning of your .First function, it should take care of the problem. Brian Gregor, P.E. Transportation Planning Analysis Unit Oregon Department of Transportation Brian.J.GREGOR at
2003 Feb 11
4
How "else" works
I have what is likely to be a simple question about the else keyword. The usage in the help pages is as follows: if(cond) cons.expr else alt.expr I would expect to be able to use it in the following way as well: if(cond){ cons.expr } else alt.expr This results a syntax error. Am I doing something wrong, or doesn't R support the spanning of the combination of if and else
2005 Apr 07
2
Zipping Rdata Files
Saving Rdata files in a zip archive form can in some cases save a considerable amount of disk space. R has the zip.file.extract function to extract files from zip archives, but appears not to have any corresponding function to save in zipped form. (At least I have not been able to find anything in the help files or through searching the mail archives.) The system function can be used to call gzip
2004 Apr 08
1
Why are Split and Tapply so slow with named vectors, why is a for loop faster than mapply
First, here's the problem I'm working on so you understand the context. I have a data frame of travel activity characteristics with 70,000+ records. These activities are identified by unique chain numbers. (Activities are part of trip chains.) There are 17,500 chains. I use the chain numbers as factors to split various data fields into lists of chain characteristics with each element of
2008 Mar 05
3
ipf function in R
Hi I have a 3 x 2 contingency table: 10 20 30 40 50 60 I want to update the frequencies to new marginal totals: 100 130 40 80 110 I want to use the ipf (iterative proportional fitting) function which is apparently in the cat package. Can somebody please advice me how to input this data and invoke ipf in R to obtain an updated contingency table? Thanks. By the way I am quite new to R. -- Dr
2004 Apr 06
4
how to learn R quickly?
i am new to R,so i post here to ask you how to learn R quickly? is there some usefull materials about using R. ps:though the manual is a good materials,but it is not the best for a newbie,i think. thank you !
2002 Mar 12
1
RArcInfo Package, get.bnddata()
I am having trouble using get.bnddata() in the RArcInfo package. I installed the version 0.2 binary of the package for Windows and am using R 1.4.1 on Windows NT 4.0. I have had no problems importing and plotting arc data with get.arcdata() and plotarc(). plotpal() also works fine. I've been able to use get.arcdata(), get.labdata(), get.paldata(), get.tablenames(), get.tablefields(),
2007 Apr 20
3
sequences extraction
Hello, I need to extract sequences from an ordered vector. For example, if a<-c(1,2,3,6,10,11,13) I need to get the followings 4 vectors (1,2,3),(6),(10,11),(13) Thank You -Bruno ------------------------------------------------------ Leggi GRATIS le tue mail con il telefonino i-mode? di Wind http://i-mode.wind.it/
2004 Aug 05
1
R interface to Python (in Windows)
I put a copy of R 1.8.1 for Windows on our FTP site at: ftp://ftp.odot.state.or.us/outgoing/Test/. It should be there for a few days before it gets deleted. Benjamin Stabler Transportation Planning Analysis Unit Oregon Department of Transportation 555 13th Street NE, Suite 2 Salem, OR 97301 Ph: 503-986-4104 -----Original Message----- From: Peter Wilkinson [mailto:pwilkinson at videotron.ca]
2003 Jul 23
2
paste and NAs
I understand how R treats NAs but in the situation below it would be nice to have a na.skip argument to paste so it does not convert the NAs to "NA"s and simply skips those elements of the vector for pasting. > x [1] "2.13" "2.3" NA NA "2.83" NA > paste(x, "0", sep="") [1] "2.130" "2.30"
2003 Oct 31
4
Array Dimension Names
I would like to reference array dimensions by name in an apply and a summary function. For example: apply(x, "workers", sum) Is there a better way to do this than creating a new attribute for the array and then creating new methods for apply and summary? I don't want to name the individual elements of each dimension (such as with dimnames) but rather name the dimensions. Thanks
2003 Jun 09
2
ESRI shapefiles and EMME/2 packages
I just uploaded two packages to CRAN. shapefiles_0.1.tar.gz - functions to read and write ESRI shapefiles (including dbfs) emme2_0.1.tar.gz - functions to read binary data from an EMME/2 databank data (EMME/2 is a transportation modeling program) Please let me know if you find any bugs or have some suggestions. Thanks. Regards, Benjamin Stabler Transportation Planning Analysis Unit Oregon
2012 Jun 07
3
conditional statement to replace values in dataframe with NA
Hello and thanks for helping. #some data L3 <- LETTERS[1:3] dat1 <- data.frame(cbind(x=1, y=rep(1:3,2), fac=sample(L3, 6, replace=TRUE))) #When x==1 and y==1 I want to replace the 1 values with NA #I can select the rows I want: dat2<-subset(dat1,x==1 & y==1) #replace the 1 with NA dat2$x<-rep(NA,nrow(dat2) dat2$y<-rep(NA,nrow(dat2) #select the other rows and rbind
2003 Sep 17
5
using matrix data for function
Hi All, I have a function, f(x,y) I have a matrix of data, m, with the 1st column is x and the 2nd column is y What's the best way to get f(x,y) for each row of the matrix? I tried result<-f(m[,1],m[,2]) but it doesn't work. Thanks! Bing --------------------------------- 1060 Commerce Park Oak Ridge National Laboratory P.O. Box 2008, MS 6480 Oak Ridge, TN 37831-6480 Phone:
2008 May 11
1
Finding unmatched data between two dataframe using several factors
Hi R users I am trying to find unmatched data from two dataframes. I would like to find unmatched data based on several factors. For the following data: dat1 <- data.frame(x = paste("A", 1:6, sep=""), y = c("andy","bob","ciaran","dan", "eion", "fred")) dat1 dat2
2012 Jul 01
2
list to dataframe conversion-testing for identical
HI R help, I was trying to get identical data frame from a list using two methods. #Suppose my list is: listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2)) #Creating dataframe using cbind dat1<-data.frame(do.call("cbind",listdat1)) colnames(dat1)<-c("Var1","Var2","Var3") #Second dataframe conversion
2005 Jun 10
2
Default Format for Dates?
Is there anyway to preset date formats? I have a date from a cover.dbf that is shown as this: > cover$FINALREPOR [1] "2003-06-24" The numeric value in cover$FINALREPOR is 12227. I'd rather not create another vector to hold the properly formatted date. When I put this in a WordPerfect merge, I want the date to be June 24, 2003. I could take care of the problem in a
2004 Apr 16
7
Turning windows screen buffering on and off
All, Does anyone know if there is an option I can set to turn screen-buffered output on and off with the win32 rgui? (Apart from the point and click method). I am running some simulations where it is useful to watch output but it gets mildly tiresome having to manually switch things on and off via the gui. Thanks Toby. > version _ platform i386-pc-mingw32 arch
2013 Apr 29
1
how to add new rows in a dataframe?
Hi, dat1<- read.table(text=" id??????????????? t???????????????????? scores 2???????????????? 0??????????????????????? 1.2 2???????????????? 2???????????????????????? 2.3 2???????????????? 3??????????????????????? 3.6 2???????????????? 4??????????????????????? 5.6 2???????????????? 6??????????????????????? 7.8 3???????????????? 0??????????????????????? 1.6 3????????????????