similar to: Data frame of different sized lists in a function call

Displaying 20 results from an estimated 2000 matches similar to: "Data frame of different sized lists in a function call"

2011 Nov 21
1
Creating a list from all combinations of two lists
R-helpers: Say I have two lists of arbitrary elements, e.g.: list1=list(c(1:3),"R is fun!",c(3:6)) list2=list(c(10:5),c(5:3),c(13,5),"I am so confused") I would like to produce a single new list that is composed of all combinations of the "top level" of list1 and list2, e.g.: listcombo=list(list(list1[[1]],list2[[1]]),list(list1[[1]],list2[[2]]
2009 Oct 23
2
splitting a vector of strings...
Quick question -- if I have a vector of strings that I'd like to split into two new vectors based on a substring that is inside of each string, what is the most efficient way to do this? The substring that I want to split on is multiple characters, if that matters, and it is contained in every element of the character vector. --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar
2009 Nov 02
2
"Safe" way to automatically install required packages...
R-helpers: I'm working on an r-package that I want to make as easy-to-use as possible for a novice R-user, which includes automatically installing required packages. I, myself, am a novice R-packager, so the solution I came up with was to embed: print("Loading required packages...") if (!require("reshape")) { install.packages("reshape") } if
2009 Mar 18
2
How do I set the Windows temporary directory in R?
I'm trying to redirect where temporary files go under R to D:\temp\somerandomname from its default (C:\Documents and Settings\username\Temp\somerandomname) -- how do I go about doing this? --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote Sensing (CSTARS) University of California, Davis One Shields Avenue The Barn, Room 250N Davis, CA 95616
2009 Aug 27
19
Best R text editors?
Quick informal poll: what is everyone's favorite text editor for working with R? I'd like to hear from people who are using editors that have some level of direct R interface (e.g. Tinn-R, Komodo+SciViews). Thanks! --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote Sensing (CSTARS) University of California, Davis One Shields Avenue The
2009 Mar 13
2
Using format to add leading zeroes
I have a numerical vector which contains a (poorly) formatted time column, which, in theory, should be HHMM, but was distributed as an integer, so, for 12:15 am, it is saved as "15" (e.g. HHMM = 0015 with the zeroes stripped). I'm trying to use this in conjunction with strptime, but I'm thinking because each time is an integer ranging from 1 to 4 digits, I probably need to
2011 Aug 23
5
Easier ways to create .Rd files?
R-helpers: Are there any ways to auto-generate R-friendly (e.g. will pass a compilation check) .Rd files given a set of .R code? How about GUIs that help properly format the .Rd files? Thanks! I want a basic set of .Rd files that I can update as I go, but as with most things my documentation typically lags behind my coding by a few days. --j -- Jonathan A. Greenberg, PhD Assistant Project
2010 Jan 20
1
x,y plot question (two sets of labels)
I'm trying to figure out the best way to do a scatterplot using the following data as an example: plothelp_x=1:10 plothelp_A1=sin(plothelp_x) plothelp_A2=tan(plothelp_x) plothelp_B=c("A","B","C","A","B","C","A","B","C","A") (note that all 4 of these vectors have 10 entries each) What I would
2009 Oct 28
1
Aggregate and cross tabulation
R-helpers: I have a data frame containing 4 factor variables (let's say A,B,C, and D) and 1 numerical variable (N). I would like to produce a cross-tabulated data frame in which A,B,C are individual columns, each factor of D is its own column, and the field is calculated as a given function of N (I would like to have two output data frames, one with the mean(N) and one with the
2010 Mar 15
1
rbind, data.frame, classes
Hi, This has bugged me for a bit. First question is how to keep classes with rbind, and second question is how to properly return vecotrs instead of lists after turning an rbind of lists into a data.frame list1=list(a=2, b=as.Date("20090102", format="%Y%m%d")) list2=list(a=2, b=as.Date("20090102", format="%Y%m%d")) rbind(list1, list2) #this loses the
2009 Jun 16
2
Statistically detecting thresholds...
Rers: I have some ecological data (stream velocity vs. % cover of submerged weeds) that shows strong evidence of a thresholding step-function, e.g. below some velocity, % cover ranges from 0% to 100% (with no apparent relationship to velocity within this range of velocities), but above a certain "threshold" velocity, the % cover does not appear to exceed, say, 10%. There are good
2009 Apr 07
1
Constrained, multiple response statistics
R'ers: I was hoping I could get some direction on this. I have a dataset of the form: Y1,Y2,...,YM = f(X1,X2,...,XN), where N is >>> M The response data (Y1,Y2,...,YM) is frequency data, such that the sum of all Yi = 1.0. Both Xj and Yi are continuous variables. I'm trying to figure out the best approach(es) to solving for the model f() -- any ideas? I could solve
2009 Jan 25
2
.Renviron for multiple hardwares...
Our lab has a lot of different unix boxes, with different hardware, and I'm assuming (perhaps wrongly) that by setting a per-user package installation directory, the packages will only work on one type of hardware. Our systems are all set up to share the same home directory (and, thus, the same .Renviron file) -- so, is there a way to set, in the .Renviron file, per-computer or
2011 Jun 29
1
Querying the path separator?
Hopefully this is a pretty easy fix -- I need to have R query the path separator for some code I'm trying to write (it involves using a system() call) -- the call requires a path and a wildcard, e.g.: command="mycommand /path/to/*.files" in the case of unix or, command="mycommand.exe C:\\path\\to\\*.files" on a windows box System.which is working correctly, so the
2010 Aug 25
2
Removing inter-bar spaces in barchart
Rhelpers: I'm trying to make a barchart of a 2-group dataset (barchart(x~y,data=data,groups=z,horizontal=FALSE)). My problem is that I can't, for the life of me, seem to get rid of the inter-bar space -- box.ratio set to 10000 doesn't do much. Any ideas? I'd ideally want zero space between the bars. Thanks! --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist
2010 Feb 26
3
Preserving lists in a function
Dear R users, A co-worker and I are writing a function to facilitate graph plotting in R. The function makes use of a lot of lists in its defaults. However, we discovered that R does not necessarily preserve the defaults if we were to input them in the form of list() when initializing the function. For example, if you feed the function codes below into R: myfunction=function( list1=list
2012 May 02
6
Quickest way to make a large "empty" file on disk?
R-helpers: What would be the absolute fastest way to make a large "empty" file (e.g. filled with all zeroes) on disk, given a byte size and a given number number of empty values. I know I can use writeBin, but the "object" in this case may be far too large to store in main memory. I'm asking because I'm going to use this file in conjunction with mmap to do parallel
2011 Nov 21
3
How do I query "..." in a function call?
This is probably a very noobish question, but if I want to create a function that allows an undetermined number of, say, numeric vectors to be fed to it, I would use: myfunction = function(...) { # Do something } Right? If so, how do I a) count the number of vectors "fed" to the function, and b) how do I treat those vectors as variables, e.g. for the call:
2012 Apr 05
4
Best way to search r- functions and mailing list?
R-helpers: It looks like http://finzi.psych.upenn.edu/search.html has stopped spidering the mailing lists -- this used to be my go-to site for searching for R solutions. Are there any good replacements for this? I want to be able to search both functions and mailing lists at the same time. Cheers! --j -- Jonathan A. Greenberg, PhD Assistant Professor Department of Geography University of
2007 Jul 05
1
(no subject)
I'm trying to hunt down an appropriate kriging package for my specific application, and I was hoping someone on the R list might have some pointers -- I'm interested in performing kriging and related spatial interpolations with one of the R packages, but I need to be able to provide my own point-to-point distances (e.g. I do not want to use standard between point distances, as calculated