Displaying 20 results from an estimated 100 matches similar to: "returning dynamic variable names from function"
2003 Oct 16
3
indexing a particular element in a list of vectors
I have a "list" of character vectors. I'm trying to see if there is a way
(in a single line, without a loop) to pull out the first element of all the
vectors contained in the list.
listOfVectors[1:length(listOfVectors][1]
doesn't work.
==========================
If you want more details..
Here is my listOfVectors which is called "uuu"
>
2013 May 22
1
column width in .dbf files using write.dbf ... to be continued
Hello Arnaud,
You posted this question a long long time ago, however I found your answer so I decided to post it anyway in case somebody else have the same problem as you and me.
You were actually very close in finding your solution. The function DoWritedbf is an internal function from the foreign package. To access it outside of the package just do:
foreign:::DoWritedbf
so in your line:
2008 Jul 03
3
apply with a division
Hi,
I'd like to normalize a dataset by dividing each row by the first row.
Very simple, right?
I tried this:
> expt.fluor
X1 X2 X3
1 124 120 134
2 165 163 174
3 52 51 43
4 179 171 166
5 239 238 235
>first.row <- expt.fluor[1,]
> normed <- apply(expt.fluor, 1, function(r) {r / first.row})
>normed
[[1]]
X1 X2 X3
1 1 1 1
[[2]]
X1 X2 X3
1
2013 Jun 18
1
hist function in a for loop
Dear all,
I need to create a for-loop in which I can compute multiple histograms
My code is the following :
#singlefile includes huge csv file
#I want to specify the binsize
#I would like to compute in the for -loop the histograms
numfiles <- length(singlefile)
for (i in 1 :51)
{
binsize <- -20 :20/2
hist(singlefile(singlefile$GVC[singlefile$new_id==i]], break=seq(),
2006 Oct 03
2
pdf/ convert/ font problem
Background:
OS: Linux Ubuntu Dapper
R : Version 2.3.1 (2006-06-01)
Emacs 21.4.1
ESS
Colleagues
This is neither a bug report, nor a complaint, so I think this is the
appropriate list.
I am getting an odd font problem with a pdf generated using
pdf(file =
"../figures/PCNM.models.larvae.fluor.zoo.stability.2001.and.2002.pdf",
title="", family="serif",
2001 Apr 10
2
clear R-objects inside a function?
Using RedHat Linux 7.0, R-1.2.2, R-hdf5-1.2 library,
I want to load a dataset, do some stuff with it, then erase its objects,
get an other, repeat. My friend wrote a function which tried to clear
away all the objects. At the end, it uses rm() to remove objects. This
is the same way we do it interactively, from the R prompt:
testLoadSeveralHDF <- function(numFiles) {
for (i in
2010 Sep 15
2
Get File Names in Folder, Read Files, Update, and Write
Dear All,
Could you please recommend how I can do this?
I have several text files in one folder. Let's name them A0801.RSK,
A0802.RSK, ....
I would like R to
1) Know all file names in this folder
2) Update value in one column of these files
3) Write results in another text file with _xval in the file names
Below is R code for read, update, and write one file
2013 Apr 25
1
Linear Interpolation : Missing rates
Dear R forum
I have data.frame as
df = data.frame(rate_name = c("USD_1w", "USD_1w", "USD_1w", "USD_1w", "USD_1m", "USD_1m", "USD_1m", "USD_1m", "USD_2m", "USD_2m", "USD_2m", "USD_2m", "GBP_1w", "GBP_1w", "GBP_1w", "GBP_1w",
2011 Jan 24
2
normality and equal variance testing
I currently have a program that automates 2-way ANOVA on a series of endpoints,
but before the ANOVA is carried out I want the code to test the assumptions of
normality and equal variance and report along with each anova result in the
output file. How can I do this?
I have pasted below the code that I currently use.
library(car)
numFiles = x #
2007 Oct 01
3
mean of subset of rows
Dear list,
this must be an easy one:
I have a data.frame of two columns, "ID" with four different levels (A
to D) and numerical "size", and each of the 4 different IDs is
repeated a
different number of times. I would like to get the mean size for each
ID as another data.frame. I have tried the following:
>ID= as.character(unique(data[,1])) # I use unique() because
2013 Jun 26
6
[PROGS PATCH] Import btrfs-extent-same
Originally from
https://github.com/markfasheh/duperemove/blob/master/btrfs-extent-same.c
Signed-off-by: Gabriel de Perthuis <g2p.code+btrfs@gmail.com>
---
.gitignore | 1 +
Makefile | 2 +-
btrfs-extent-same.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 147 insertions(+), 1 deletion(-)
create mode 100644 btrfs-extent-same.c
diff
2006 Nov 03
4
read file problem
R-help,
I have the following file I want to import to R (some lines
removed)
Calibrated CTD data for station:00280001
Calibrated:23/8 2001, Salinity Unsmoothed, Fluorescence Uncalibrated
Maximum observed depth: 36 m
QUAL has one digit for each of pressure, temp., sal. and fluor.
QUAL=1:Uncal., QUAL=2:OK, QUAL=6:Interp., QUAL=9:No data
2009 Jun 12
3
Referencing data frames
Hi,
How do I use the string content of a string variable to reference a data frame of the same name? I want to do the typical tasks of 1) building a name with a string variable and using the string variable to create a data frame (or any object) whose name is the string value of the variable and 2) pass on a string to a function as a parameter, and then use that string to refer to an existing
2010 Jan 13
1
column width in .dbf files using write.dbf ... to be continued
Dear UseRs,
I did not have any answer to my previous message ("Is there a way to define
"manually" columns width when using write.dbf function from the library
foreign ?"), so I tried to modify write.dbf function to do what I want.
Here is my modified version :
write.dbfMODIF <- function (dataframe, file, factor2char = TRUE, max_nchar =
254, width = d)
{
2010 May 20
1
sqldf: issues with natural joins
Hello,
I'm having trouble discovering what's going wrong with my use of natural
joins via sqldf.
Following the instructions under 4i at http://code.google.com/p/sqldf/,
which discusses creating indices to speed joins, I have been only unreliably
able to get natural joins to work.
For example,
> Tid <- c('AES 01-01-02 10:58:00', 'AES 01-01-02 11:53:00', 'AES
2014 Jun 24
2
using C code to create data frame but always return as list
there is my code, expect return value is a data frame but R say it is list:
SEXP Julia_R_MD_NA_DataFrame(jl_value_t* Var)
{
SEXP ans,names,rownames;
char evalcmd[4096];
int i;
const char* dfname="DataFrameName0tmp";
jl_set_global(jl_main_module, jl_symbol(dfname), (jl_value_t*)Var);
//Get Frame cols
sprintf(evalcmd,"size(%s,2)",dfname);
jl_value_t*
2007 Oct 30
1
axis title on two lines
Hello,I am searching for the possibility to make a two lines axis title. This suggestion:ylab=expression(paste("log rate\n[ fluor.",inc. %.% cell^{-1} %.% sec^{-1}," ]"))results in two lines left not centered and with a large gap.any suggestions.ThanksMarcel
______________________________________________________________________________
Marcel Sandow
Leibniz Institute of
2004 Nov 01
2
stacking imported data
Hi all,
I have a question that I don't have a good answer for (note the word
"good"; I have an answer, but I consider it not "good"). Take the
following data in a single tab-delimited text file:
<text>
A
Labels Value SE 2.5% 97.5%
R90 0.231787 1.148044 0.035074 1.531779
R0 0.500861 0.604406 0.185336 1.353552
B
Labels Value SE 2.5% 97.5%
(Intercept) 1.367514
2005 Jul 28
2
lattice/ grid.layout/ multiple graphs per page
Background:
OS: Linux Mandrake 10.1
release: R 2.0.0
editor: GNU Emacs 21.3.2
front-end: ESS 5.2.3
---------------------------------
Colleagues
I have a set of lattice plots, and want to plot 4 of them on the page.
I am having trouble with the layout.
grid.newpage()
pushViewport(viewport(layout = grid.layout(2,2)))
pushviewport(viewport(layout.pos.col = 1, layout.pos.row = 1))
working trellis
2009 Nov 02
1
Using processed objects as arguments of a function
Dear R users,
I wish to utilise processed and saved objects as arguments of a function.
Specifically, I have created objects using *"assign"* & *"paste"* functions
with an incremental index i, the names of the objects are:
fund1, fund2, fund3,....., fund80,..... (where the numerical value
increments according to the index i & class of these objects are