Displaying 20 results from an estimated 70 matches similar to: "Vectorise a for loop?"
2006 Jun 09
4
HTML nsmall vector format problem
Hello All
I am having a bit of trouble formatting my HTML with the desired number
of digits after the decimal place. Am I doing something
wrong/misunderstanding or is it a bug?
Looking at the example supplied with ?HTML.data.frame:
HTML(iris[1:2,1:2],nsmall=c(3,1),file="")
Gives html output that includes the lines:
</tr> <tr><td
2007 Nov 16
7
sorting factor levels by data frequency of levels
using an example from r online help
> state <- c("tas", "sa", "qld", "nsw", "nsw", "nt", "wa", "wa",
"qld", "vic", "nsw", "vic", "qld", "qld", "sa", "tas",
"sa", "nt", "wa", "vic",
2006 Nov 20
3
problem with loop to put data into array with missing data forsome files
Hi Jenny
If you want a general solution I understand.
However I just downloaded the file fine (as far as I can tell) so you
are welcome to have a copy. I can email it to you if you want.
I do not think your test for NA is valid. i.e
if(test != "NA"){
}
I think you should use
if(is.na(test)){
}
Or something similar.
J
---
John Seers
Institute of Food Research
Norwich
2006 Apr 20
2
R-Help
Dear r-users,
Suppose I have three datasets:
Dataset-1:
Date x y
Jan-1,2005 120 230
Jan-2,2005 123 -125
Jan-3,2005 -110 300
Jan-4,2005 114 -21
Jan-7,2005 11 299
Mar-5,2005 200 311
Dataset-2:
Date x y
Jan-2,2005 123 -125
Jan-3,2005 -110 300
Jan-4,2005 114 -21
2006 Nov 20
2
problem with loop to put data into array with missing data for some files
Dear R-help community,
My main goal of this message is to find a way of skipping a file of a month/year
in a loop that does not exist (and making it's output into an data.out array
would be NA) and moving onto the next year/month in the loop to carry on filling
data.out with real precipitation data.
The situation so far:
I downloaded 50 years worth of GRIB data files from the NCEP data
2008 Jul 10
2
false discovery rate !
Dear All,
It is not a typical R question (though I use R for this) but I thought someone will help me. For the list of P values, I have calculated FDR using p.adjust() in R (bioconductor). But my FDR values are same for all the P values. When do we get same FDR values? Does the smallest P values should less than 1/N? (where N is the number of P values)
Thanks in advance.
Kind regards,
Ezhil
2008 Feb 01
6
Accessing the elements of a list
Hi R,
I wanted to know how do we access the elements of a list. In particular,
v=list(c(1,2,3,4,5),c(1,2,33,4,5),c(1,2,333,4,5),c(1,2,3333,4,5))
I want to access all the thirds items of the elements of the list. i.e.,
I want to access the elements, 3,33,333,3333. This can be done through
sapply as:
sapply(v,function(x) x[3])
But I need to access this without using
2006 Nov 09
2
Closing R fails
Hello All
I cannot close R easily:
>
> q()
Error in .Last() : could not find function "finalizeSession"
>
This seems to have started after I used the R.utils package. If I load
the R.utils package I can close R successfully. But I do not want to
have to do this every time I run R.
Is there any way I can switch off /reverse this behaviour? (I have had a
look in the
2011 Mar 01
1
RWinEdt difficulties
Hello Everyone
I have just upgraded my PC to Windows 7 (64 bit) and I have installed R
2.12.2. R seems to be working fine.
I am having problems getting RWinEdt working with it though.
I have tried installing WinEdt 6.0 and WinEdt 5.5. But both fail with the
same error using R as 64 bit or 32 bit. I install the package using
Administrator rights.
> library(RWinEdt)
Warning message:
In
2008 May 16
2
Getting JRI/rJava to work
Hello All
I am trying to get the JRI examples from rJava to work on Windows XP and
failing. (And as a more general and connected question is there any
review/summary of front-end software for R?)
I have installed rJava from the Windows binary supplied. I compile and
run the example supplied (rtest.java) and get the results below. I do
not think the notes about a deprecated API are a problem. But
2007 Jul 04
2
Loop and cbind
Hi, I would like to apply the following function for i between 1 and 12, and
then construct a list of the return series.
for (i in 1:12){
ewma[i] <- emaTA(calm[[i]]^2,0.03)
standard[i]<- calm[[i]]/sqrt(ewma[i])
standard <- cbind(standard[i])
}
But it does not work. Could anyone give me some advice how can I achieve
this? Many thanks
--
View this message in context:
2009 Jan 19
2
How to assign names in a list
Hi All
How can you associate names with a list when names have not been
assigned? For example if you have a list like this:
list2<-list(1,2,3)
list2
[[1]]
[1] 1
[[2]]
[1] 2
[[3]]
[1] 3
How do you make it look like this with names? :
f1<-1
f2<-2
f3<-3
list1<-list(name1=f1, name2=f2, name3=f3)
list1
$name1
[1] 1
$name2
[1] 2
$name3
[1] 3
Thanks for any help.
I expect
2008 Feb 19
4
How to join path with arguments
Hi, all
How to format and join strings ?
For example, like following short python examples.
*********
name1 = 'sample-plot'
filename = '%s.png' % name1
inputdir = '/path/to/dir'
os.path.join(inputdir, filename)
**********
Best,
Hyunchul Kim
[[alternative HTML version deleted]]
2011 Jun 29
1
RWinEdt
I have a problem using RWinEdt 1.8.2 in Windows 7 Professional (64 bit).
System/software info:
R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-mingw32/x64 (64-bit)
WinEdt Build: 20071003 (v. 5.5)
After installing the R package and attempting to load I get:
> library(RWinEdt)
Warning message:
In
2002 Oct 30
0
sm packcage compilation problem fixed
I have discovered a problem with the compilation of the sm package.
On debian 2.2, sm was not compiling.
* Installing *source* package 'sm' ...
** libs
g77 -fPIC -g -O2 -c routines.f -o routines.o
gcc -shared -o sm.so routines.o -L/usr/lib/gcc-lib/i386-linux/2.95.4
-lreadline -ldl -lncurses -lg2c-pic -lm -L/usr/lib/R/bin -lR
/usr/bin/ld: cannot find -lg2c-pic
collect2: ld returned
2006 Nov 01
4
splitting very long character string
Hello,
I've a very long character array (>500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string.
The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this:
...
12345
2010 Sep 18
2
moving 1.2.13 system to another hard drive
Hi,
I am not very experienced with Dovecot (1,2,13) installed on Debian sid.
I have just set up a new system on a new hard drive on the same computer.
fetchmail is correctly putting mail in /var/mail/<username>. I have copied
my entire Maildir directory from the old hard drive. I have made what changes
I understood to dovecot.conf.
Dovecot was working on the other drive even though
2011 Jul 04
2
RWinEdt problem
Hi R Helpers,
I am a long time RWinEdt user and have just acquired a new laptop. I have
installed RWinEdt and things are going smoothly except for one small glitch
- file names are not appearing on the document tabs. When I use WinEdt (as
opposed to RWinEdt), they are appearing. Can anyone offer any advice on
this?
Thanks in advance,
Simon Knapp
OS: windows7
Arch: 64 bit
R version: 2.13.0
2007 Jul 11
2
Previously saved workspace restored
hi there,
i an beginner of R. some one have sent me a file (extension is .Rdata). i have installed R in my computer and i just double clicked the data. then it automatically opened R programme and displayed that [previously saved workspace restored]. the following message was displayed.
Type 'demo()' for some demos, 'help()' for on-line help, or'help.start()' for an
2012 Aug 27
2
Font size in geom_dl (using ggplot2)
Hey everyone,
I am an R-newby... so sorry for bothering you with simple-to-solve
questions;) I have the following issue: trying to add labels to my
scatterplots (with geom_dl in ggplot2). Everything works fine, but after
checking every resource I do not find a way to change the font size of my
labels. I tried size, cex, fontsize at every position... but it always stays
the same.
ggplot()+