similar to: Is there a better way than x[1:length(x)-1] ?

Displaying 20 results from an estimated 8000 matches similar to: "Is there a better way than x[1:length(x)-1] ?"

2005 Dec 06
3
reading in data with variable length
I have very large csv files (up to 1GB each of ASCII text). I'd like to be able to read them directly in to R. The problem I am having is with the variable length of the data in each record. Here's a (simplified) example: $ cat foo.csv Name,Start Month,Data Foo,10,-0.5615,2.3065,0.1589,-0.3649,1.5955
2007 Jan 25
2
Days of the week?
Hi WizaRds, What is the "standard" way to get the day of the week from a date such as as.Date("2006-12-01")? It looks like fCalendar has some functions but this requires a change in the R locale to GMT. Is there another way? Thanks! Jack. --------------------------------- Be a PS3 game guru. [[alternative HTML version deleted]]
2006 Nov 28
1
Can anyone read a S-PLUS .dmp file for me?
Hi WizaRds, I tried reading the S-PLUS file ftp://ftp.research.att.com/dist/bayes-meta/hblm.dmp into R using data.restore("hblm.dmp") but I got an error: Error in attributes(value) <- thelist[-match(c(".Data", ".Dim", ".Dimnames", : row names must be 'character' or 'integer', not 'double' In
2007 Sep 13
2
Multivariate, multilevel regression?
Dear WizaRds, This is mostly a statistics question, but I'm figuring that R is the right solution (even before I start!) I have some bio data of heart rate versus time (rats taken from resting to maximal heart rate). I want to regress heart rate on time. The data have been normalized such that resting heart rate is zero at time=0, so that all curves intersect at the origin (and at the origin
2006 Aug 01
1
Tcltk package
Hi WizaRds, I ran into trouble trying to install the "debug" package, which requires TCL/TK support. It seems like the tcltk package is not installed on my system. From: http://tolstoy.newcastle.edu.au/R/help/05/07/7993.html it seems that the tcltk is bundled with the base R distribution. I'm running R under linux: > version _ platform i686-pc-linux-gnu
2007 Sep 29
1
RODBC and Oracle
Hi WizaRds, I'm experiencing a problem connecting to an Oracle 10g database via RODBC (I'm getting this on Microsoft XP). The same SQL queries via PL/SQL Developer work just fine, but when I pump the query through sqlQuery in RODBC then I get a data frame back with 0 rows. I cut the query down alternating between PL/SQL and RODBC until I figured that it's some kind of row limit or
2006 Aug 02
1
MATLAB 6.5 under Wine
Hi, I'm completely new to Wine (I'm running version 0.9.9 under Ubuntu 6.06). I have been able to install and run Windows apps and I can see that Wine really rocks! For speed, I'd rather run Wine than VMware, especially when it comes to running MATLAB under linux. I'm having difficulty with getting MATLAB (6.5.0.180913a (R13)) to run. There are several threads in the Wine
2006 Mar 03
2
Command-line editing & history
Hi all, Are there any plans to add more functionality to command-line editing and history editing on the command line? In MATLAB (I know, comparisons are odious ...), you can type "p" and up-arrow on the command line and scroll through the recently entered commands beginning with "p". This is a very useful feature and something that I believe is not replicated in R. Please
2006 Jul 25
3
Overplotting: plot() invocation looks ugly ... suggestions?
Hi WizaRds, I'd like to overplot UK fuel consumption per quarter over the course of five years. Sounds simple enough? Unless I'm missing something, the following seems very involved for what I'm trying to do. Any suggestions on simplifications? The way I did it is awkward mainly because of the first call to plot ... but isn't this necessary, especially to set limits for the
2006 Mar 13
3
Incrementing a counter in lapply
Hi All, I'm looking for some hints on idiomatic R usage using 'lapply' or similar. What follows is a simple example from which to generalize my question... # Suppose, in this simple example, I want to plot a number of different lines in different colors; # I define the colors I wish to use and I plot them in a loop: d<-
2006 Feb 28
2
Elegant way to express residual calculation in R?
Hi All, I am illustrating a simple, two-way ANOVA using the following data and I'm having difficulty in expressing the predicted values succinctly in R. X<- data.frame(read.table(textConnection(" Machine.1 Machine.2 Machine.3 53 61 51 47 55 51 46 52 49 50
2005 Dec 06
1
array of lists? is this the best way to do it?
[Q.] How to create an array of lists, or structures the most elegant way? There have been questions in the past but none too recently...I want to know if the following looks OK to you guys or if there is a better way to create an array of lists: # PREAMBLE ... JUST TO GET THINGS GOING makeList<- function(data, anythingElse) { rval <- list( data = data, anythingElse =
2007 Mar 27
1
Source Code for zoo?
Hi, I downloaded the source code for the package zoo (zoo_1.2-2.tgz from CRAN). When I gunzip and untar the file I can't find the R / C / FORTRAN code for the library. In the R directory under zoo, the listing is for 3 files: zoo zoo.rdb zoo.rdx Is the code encoded in one of these files? I've had this problem with other packages too, trying to browse the source. Am I missing something
2008 Mar 08
1
plotting NAs
Hi WizaRds, (I've cross-posted to r-sig-finance because a lot of people there use 'zoo' objects). I'm trying to plot 2 time series lined up with par(mfrow=c(2,1)), so that the time index is the same for the two series. The data have monthly frequency. An example will illustrate: # data for these dates (monthly frequency) do not have NAs: require(zoo) monthly.dates<-
2008 Apr 30
8
Why R is 200 times slower than Matlab ?
I am switching from Matlab to R, but I found that R is 200 times slower than matlab. Since I am newbie to R, I must be missing some important programming tips. Please help me out on this. Here is the function: ## make the full pair-wise permutation of a vector ## input_fc=c(1,2,3); ## output_fc=( 1 1 1 2 2 2 3 3 3 1 2 3 1 2 3 1 2 3 ); grw_permute = function(input_fc){ fc_vector = input_fc
2006 May 08
3
Non repetitive permutations/combinations of elements
Hello all, I am trying to create a matrix of 1s and -1s without any repetitions for a specified number of columns. e.g. 1s and -1s for 3 columns can be done uniquely in 2^3 ways. -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 and for 4 columns in 2^4 ways and so on. I finally used the function combn([0 1],3) that I found at the following link
2012 Aug 22
3
help
Hi, As a beginner in R, I need some help on a programming problem which, I guess, will seem trivial to you: I am doing some Network analysis in which I need to calculate some metrics for all the weeks I have (each week the network evolves in terms of number of nodes etc...) For exemple, I need to calculate the degrees of the nodes each weak, and to repeat it in a loop for all the weeks ( for
2011 Mar 22
1
Characteristic Path length calculation
Hi, I wish to calculate the characteristic path length of a graph. Is average.path.length(g) in 'igraph' the same as calculating the characteristic path length of the graph? Thanks, Kumar -- View this message in context: http://r.789695.n4.nabble.com/Characteristic-Path-length-calculation-tp3398048p3398048.html Sent from the R help mailing list archive at Nabble.com.
2006 Aug 28
2
Help with Functions
Hello wizards, I need to convert the following functions (prestd, poststd, prepca) of matlab to R. Does Somebody knows how to do it. A description of the functions is: prestd preprocesses the network training set by normalizing the inputs and targets so that they have means of zero and standard deviations of 1. poststd postprocesses the network training set which was preprocessed by prestd. It
2007 May 09
3
Removing a list of Objects
Hi, I have a simple beginner's question on removing a list of objects. Say I have objects C243.Daily1, C243.Daily2...C243.Daily5 in my workspace. I'd like to remove these without using rm five times. So I write. > a <- list(paste("C243.Daily",sep="",1:5)) > rm(a) Obviously this wouldn't work, as it would only remove the object a. But is there any way