Displaying 20 results from an estimated 10000 matches similar to: "Convert a string to a variable name"
2013 Jan 24
3
ifelse to speed up loop?
Hello,
I'm not sure how to explain what I'm looking for but essentially I have a
test dataset that looks like this:
test:
V1
1 1
2 1
3 1
4 2
5 2
6 2
7 1
8 1
9 1
10 2
11 2
12 2
And what I want to be able to do is create another column that captures a
"grouping" variable that looks like this:
test
V1 group
1 1 1
2 1 1
3 1 1
4 2 2
5 2
2007 Dec 12
1
eliminating cancel button in winDialogString call
I would like to use the function winDialogString to get input from a user to
a program but would like to eliminate the cancel button option and just have
the OK button appear. The problem is that if a user enters data then
accidently hits Cancel instead of OK, the program may either run incorrectly
or quit due to the error of having NULL for a variable. I can think of some
unsophisticated ways
2005 Apr 15
4
aggregation question
Is length(unique()) what you are looking for?
Andy
> From: Christoph Lehmann
>
> Hi I have a question concerning aggregation
>
> (simple demo code S. below)
>
> I have the data.frame
>
> id meas date
> 1 a 0.637513747 1
> 2 a 0.187710063 2
> 3 a 0.247098459 2
> 4 a 0.306447690 3
> 5 b 0.407573577 2
> 6 b
2011 May 12
1
separate date and time
I have a combined date and time. I would like to separate them out into two
columns so I can do things such as take the mean by time across all dates.
meas<-runif(435)
nTime<-seq(1303975800, 1304757000, 1800)
nDateT<-as.POSIXct(nTime, origin="1970-01-01")
mat1<-cbind(nDateT,meas)
means1<- aggregate(mat1$meas, list(nDateT), mean)
This doesn't do anything as each day
2011 Mar 13
2
Having a problem with choose.files
I am relatively new to R, and am having a problem with the following
snippet of code, and I do not at all understand why it is behaving this
way. I am running Windows XP, with R 2.12.1.
I copy and paste these 4 lines into the R Console:
t<-c("a","b","c")
ans<-select.list(t)
txtNBS<-winDialogString("NBS","300")
choose.files()
I
2006 Jul 18
1
Reconfiguring wide frame to long frame
Greetings, fellow R'ers.
How can I get this frame in R:
ID meas ID.1 meas.1
1 1.1 3 1.2
2 2.1 4 2.2
to look like this (stacking):
ID meas
1 1.1
2 2.1
3 1.2
4 2.2
It's not really the reshape function (or is it?) because we can consider
the additional columns, viz., ID.1 and meas.1, as independent of ID and
meas so it is basically a stacking
2011 Jan 23
2
Ordering box plots
Hello all, I want box plots by group to display in order of increasing
mean (or median) of each group but can't seem to figure it out and
couldn't find anything on R-seek, either.
My data looks like this:
meas unit sid grade rsprti
1 2.24 1002 99999902 NA 0.8600000
2 3.04 1007 43589520 3 0.9400000
3 4.95 2002 39910470 5 1.5300000
4 2.24 2002 39986280 5
2000 Jul 28
4
Language element manipulation
I am very confused about this. I want to convert a string to a name so I can
use it to extract an element of a data frame using `$'. Here is my
(non-working) code:
do.graph <- function (meas)
{
fn <- paste("a", meas, ".dat", sep='')
themeas <- read.table(fn, header=F)
ameas <- as.name(paste("a", meas, sep=''))
2008 Jul 25
1
glht after lmer with "$S4class-" and "missing model.matrix-" errors
Hello everybody.
In my case, calculating multiple comparisons (Tukey) after lmer
produced the following two errors:
> sv.mc <- glht(model.sv,linfct=mcp(comp="Tukey"))
Error in x$terms : $ operator not defined for this S4 class
Error in factor_contrasts(model) :
no 'model.matrix' method for 'model' found!
What I have done before:
> sv.growth <-
2011 May 12
3
assigning creating missing rows and values
I have a dataset where I have missing times (11:00 and 16:00). I would like
the outputs to include the missing time so that the final time vector looks
like "realt" and has the previous time's value. Ex. If meas at time 15:30 is
0.45, then the meas for time 16:00 will also be 0.45.
meas are the measurements and times are the times at which they were taken.
meas<-runif(18)
2006 Sep 05
2
winDialog UNIX equivalent?
Hi all,
I'm using winDialog and winDialogString in scripts running on a XP-machine. Since we're using some Linux-machines (Suse 10.0 and 10.1 on x86) I'm interested in equivalents of the above functions usable under Linux-OS. Are there any?
Thanks, Richard
--
Richard Müller - Am Spring 9 - D-58802 Balve-Eisborn
www.oeko-sorpe.de
[[alternative HTML version deleted]]
2005 Sep 14
1
Long lines with Sweave
I have used Sweave a lot the latest year, but never really used any long
function calls.
If I have code which look like this
-------------------------------------------------------------
gof <- benthic.flux(ID="Gulf of Finland",
meas.conc=conc,
bw.conc=bw.conc,
time=times,
2005 Nov 04
1
t test on data frame
Hi,
I have constructed a dataframe as follows:
Oil <- rep(c("Oil1","Oil2","Oil3"),8)
Comp <- rep(rep(c("C1","C2"),c(4,4)),3)
Mth <- rep(c("M1","M1","M2","M2"),6)
Meas <- rep(c(1,2),12)
Result <- rnorm(24,mean=100, sd=5)
df <- data.frame(Oil, Comp, Mth, Meas, Result)
The same compound
2008 Mar 28
1
cpu usage high with windows change dir / winDialogString (PR#11045)
Good afternoon,
This is possibly a windows only bug, definitely of comparatively low
importance - but for the sake of completeness here we go. I've
searched http://bugs.R-project.org/ etc., but can find no mention.
For RGui.exe, the CPU usage goes to 100% for certain dialog boxes for
the duration that the dialog box is visible, e.g.
* check CPU usage is low
* On the RGui.exe menu chose
2000 Mar 29
2
Dialog boxes
Hello:
I am brand new to R, though I've used S-Plus for some time. I've
developed some specialized plotting functions that I want to distribute
and would like to provide users with a dialogbox for entering input
arguments. Has anyone developed functions in R for displaying
dialogboxes that could accept multiple inputs? I found winDialog and
winDialogString, but these only accept and
2005 Apr 12
1
adding R site search to Rgui
From: Gabor Grothendieck
> On Apr 11, 2005 11:28 AM, Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
> >
> > If you use R 2.1.0 beta (which you should consider seriously as
> > a good netizen ;-), this is as simple as
> >
> > > RSiteSearch("String manipulation---mixed case")
> > A search query has been submitted to
2004 Jul 28
1
R 1.9.1 Crash in Win2000 (PR#7139)
This probably should go to Duncan Murdoch ...
The following reliably crashes R Version 1.9.1 on Win2000:
winDialogString(paste(sample(letters,500,rep=TRUE),
collapse=""),default="")
(presumably because of the too lengthy message string; but what is the
length limit?).
--
Bert Gunter
Non-Clinical Biostatistics
Genentech
MS: 240B
Phone: 650-467-7374
"The business of
2008 Jul 01
1
select.list() cannot be used non-interactively
Hi. With the previous version of R, it was possible to execute the function 'select.list()' in BATCH mode. In this way, I could write my R code in a .R file and execute that with a double click on a .bat file, that contain the instruction tu run my R code in batch mode (R CMD BATCH myRcode.R). When I do that, a windows appear and I just have to select an item from the list.
Now I've
2007 Apr 16
1
Dataimport with readLines using skip= and nlines= ?
Hello,
I have a problem with readLines.
I have a data file with many informations added with a different number of measurments (example at the end).
I only want to read the measurments witch start with "START OF HEIGHT DATA" and end with "END OF HEIGHT DATA".
The difficulty is:
-I want to read the file with "readLines", because the measurments have letters and
2009 Jul 04
1
De que otra forma se puede hacer
Hola que tal alguien de ustedes me podría auxiliar, lo que pasa es que estoy tratando de hacer un programa en R utilizando la siguiente tabla:
x<1 km
x>1km
Estabilidad
a
c
d
f
c
d
f
A
213
440.8
1.94
9.27
459.70
2.094
-9.6
B
156
106.6
1.15
3.30
108.20
1.098
2.0
C
104
61.0
0.91
0.00
61.00
0.911
0.0
D
68
33.2
0.73
-1.70
44.50
0.516
-13.0
E
51
22.8
0.68
-1.30
55.40
0.305