Displaying 20 results from an estimated 5000 matches similar to: "Index alternative to nasty FOR loop?"
2009 Jan 19
3
download/retain text file structure with RCurl/getURL()
Dear list,
I'm trying to download a text file directly from the internet using the RCurl package and the command getURL. Duncan Lang graciously helped me solve the first step in this problem using the following command:
#################
txtfile <- getURL('ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho/13e19.txt',
ftp.use.epsv = FALSE)
#################
2009 Apr 14
2
subset dataframe by rows using character vector?
Dear List,
I'm stuck on what seems like a simple indexing problem, I'd be very grateful to anyone willing to help me out.
I queried a dataframe which returns a character vector called "plot". I have another dataframe from which I want to subset or select only those rows that match "plot". I've tried subset, and also the "which" command.
plot
2008 Aug 04
3
backslash in character string?
Dear list,
After searching many old posts, I can't find the solution to a simple problem.
can someone tell me how to create a character string with multiple backslashes, as in:
file_dir <- c("C:\files\data\")
I need to create this string and then paste it to many files names for batch processing in another software program. R won't accept the backslash and removes
2008 Feb 29
2
while loop syntax help
Dear list,
I'm trying to write my first looping function in R. After many hours of searching help files and previous posts, I'm at wits end. Please forgive my programming ignorance...any help is greatly appreciated.
I need to sort through a vector (x) and identify the point at which 2 successive values become smaller than the previous value.
I've written a "while"
2009 Jan 12
2
problems with download.file() from ftp?
Dear list,
I am trying to download a text file from an ftp site using download.file().
I used the following code:
url <- "ftp://ftp.wcc.nrcs.usda.gov/data/snow/snow_course/table/history/idaho/13e19.txt"
dest <- "c:/test/downloadtest.txt"
download.file(url, dest)
I get this error message, indicating that R is unable to open the connection:
trying URL
2008 Dec 17
4
Plot multiple lines, same plot, different axes?
Dear list,
I would like to plot 2 series of numbers with very different ranges/scales as lines on the same plot. I assumed this is commonly done and easy, but I have not found any help files (e.g. axis() or matplot() that show how. I've searched many old posts to no avail.
I'll be very grateful for any suggestions on how this is done.
Best,
Zack
2008 Mar 31
1
APPLY as alternate to FOR loop?
Dear list,
Below I've written a clunky for loop that counts NA's in a row, replacing all with NA if there are
more than 3 missing values, or keeping the values if 4 or more are present. This is sample code from a very large
dataframe I'm trying to clean up.
I know there are many simpler more elegant solutions to this little problem.
Would someone be willing to show me how to
2006 Jul 04
1
[Fwd: formatting using the write statement]
>I have a series of write statements because
>i am writing to a file
>where the characters strings are the column names of a dataframe
>and the numbers are the elements in a particular row.
>So, a file might look like
>
>AAA 2.1
>BB 3.1
>AHLZ 0.2
>
>and it would be named "rowname".mls.
>
>so, each time i get to a new row, i create a new file and
2008 Apr 23
1
64 bit Linux/Ubuntu memory limit problem?
Dear list,
I've recently installed R on a 64 bit machine with 8 GB of RAM. I set this computer up as a dual-boot system, with windows XP 64 and Ubuntu 7.10. I downloaded the Linux 64 bit version of R and installed it.
I'm trying to run rather large Random forest models and was running into severe memory limitations with my old windows 32 bit machines.
When I run Random Forest models
2009 Nov 25
1
Error in parse(outFile)
Hi all
I have made some changes to a package (SimHap) I wrote a couple of years
ago, and it has passed R CMD check under windows, but under linux
(ubuntu jaunty) I am getting the following error:
* installing *source* package 'SimHap' ...
** R
Error in parse(outFile) : 2:1: unexpected $end
ERROR: unable to collate files for package 'SimHap'
Does anyone know what the
2008 Oct 01
1
regexpr syntax question
Greetings R list,
I am stuck on a simple syntax problem. I want to list all files in a directory, excluding files of a certain type. I have tried pattern matching as follows:
a <- list.files(data, full.name = TRUE, pattern != ".xml") # exclude all .xml files
The warning returns that my syntax is incorrect. I have read the regexpr help files and search old posts to no
2010 May 24
1
retrieve path analysis coefficients (package agricolae)
Dear list,
I'd like to use path.analysis in the package agricolae in batch format on
many files, retrieving the path coefficients for each run and appending them
to a table. I don't see any posts in the help files about this package or
the path.analysis package. I've tried creating an object out of the call to
path.analysis, but no matter what I try, the function automatically prints
2016 May 18
2
Cargar un paquete propio
Hola,
Al intentar instalar un paquete de R creado por mí, me da el siguiente
problema. Utilizando rstudio en local me funciona, pero al intentar
instalarlo en rstudio-server es cuando me da este error. He probado
cosillas que he leído en internet, pero no han funcionado. ¿Alguna idea?
* installing *source* package ?mipaquete? ...** RError in
parse(outFile) : invalid multibyte character in parser
2012 May 18
2
Failure building any package
Hello,
I'm attempting to build a package using R 2.15.0 on OS X
I am getting a generic failure when performing a cran type check on the package. Even with a very simple test package, it still fails int he same place.
Example:
In R:
rm(list=ls())
foo <- function(x){print(x)}
package.skeleton(name="foo")
Then, at the command line:
R CMD build foo
R CMD check --as-cran
2007 Apr 30
3
Read every second line from ASCII file
Dear all,
I have an ASCII file where records are separated by a blank. I would like to
read those data; however, only the data in rows 1, 3, 5, 7, ... are
important; the other lines (2,4,6,8,....) contain no useful information for
me.
So far I used awk/gawk to do it:
gawk '{if ((FNR % 2) != 0) {print $0}}' infile.txt > outfile.txt
What is the recommended way to accomplish this in R?
2011 Dec 06
1
Unable to collate and parse R files with R CMD check
Hi all,
I'm trying to build a package on Windows 7 (64 bit) and although R cmd
build worked fine and I got pkg.tar.gz with no errors, but when I tried
doing R CMD check everything turns out ok except for the warning:
"checking whether package 'pkg' can be installed ... ERROR.
Installation failed."
It then refers me to the error file "00install.out" which reads as
2008 Mar 05
1
FOR LOOP w/IFELSE statement help
Dear list,
I'm trying to query a string of numbers to identify where in the string the numbers stop increasing (where x[i] == x[i+1]). In example 1 below, I've adapted code from Jim Holt to do this. However, I run into situations where the condition is not met, as in example 2, where the number string is continuous. In this case, I need to specify an alternative outcome, where if in the
2007 Nov 08
2
Sweaving single master file to get multiple individualised reports
Hi
Apologies in advance if I've missed something obvious. I have read the
Sweave manual, the first article in R News, looked at the Help pages,
googled Sweave and words like loop, output, files, multiple, done much
the same on R site search (in case I missed something on Google) and I
couldn't find exactly what I'm after.
What I'm trying to do
?----------------------
Make
2012 Nov 27
1
virtio for 9.1-R
Hi guys,
I can't see virtio in releng/9.1, is there any particular reason why it
isn't going to be included given that it works reasonable well (and is
optional anyway, so not likely to be detrimental)?
Thanks,
Joe
2016 Jan 20
1
linking icecast to ios and android phones
.PLS files should work for iOS devices. See sample text:
[playlist]
numberofentries=1
File1=http://91.121.91.172:31090/LG73
Title1=LG73 Vancouver's Best Music Mix!
Length1=-1
Version=2
On Wed, Jan 20, 2016 at 1:27 PM, Holden Stanford <hstanford1 at gmail.com>
wrote:
> You can create a .m3u or .mp3 container linking to the stream URL. I can't
> remember the exact tags