similar to: Read multiple files into dataframe?

Displaying 17 results from an estimated 17 matches similar to: "Read multiple files into dataframe?"

2009 Oct 22
1
Cairo package, png files within for loop are black?
Hello, I am generating .png images using the Cairo package in a for loop (looping on the number of zones, number of zones equals the number of plots to create based on different zone data). When I run the R script the .png files are created but they are all black? If I comment out the for loop and force my zones to equal one the png file is created correctly? Is there an issue with
2008 Oct 30
3
Save a function existing library
Hello all, I am fairly new to R and I have created a function that I use quit frequently. I was wondering if there is away to save this function in an existing library so I can call it by using the function name once the library is loaded? Thanks, Doug -- --------------------------------- Douglas M. Hultstrand, MS Senior Hydrometeorologist Metstat, Inc. Windsor, Colorado voice:
2010 Jun 23
2
Unique Data Frame Name?
Hello, I am trying to create a data frame with a unique name, based on indexing of for loop. I was wondering if there is a way to do this, I keep running into errors when I try to do this. Below is a brief example, I am trying to get two data frames (name1 and name2). Any suggestions are appreciated. Thanks, Doug # Example for (i in 1:2) { x=c(1,2,3,4) y=c(10,20,30,40)
2010 Jan 05
3
R matching lat/lon pairs from two datasets?
Hello, I am trying to match lat/lon from one dataset with the lat/lon from a second dataset and use that rows data for calculations. I am using match, but this is finding the first match and not comparing the pair, how can I determine if the lat/lon are the same? See example below. Is there a better way to determine to a matching pair of lat/lon values? Example Datasets: > data2
2010 Feb 04
3
Legend symbol?
Hello, I am creating a plot/image using different data and a couple fit lines (see attached image). In the legend, I want the Default and Exponential symbol to be a line. I am using the pch command, I tried to use "-" to represent a line but does not work so I currently have set as a "1". Any thoughts or suggestions would be greatly appreciated. Below are the commands
2010 Jun 28
3
data frame row statistics (mean)?
Hello, I am trying to calculate the mean value of each row in a data frame (d), I am having troubles and getting errors using the code I have written. Below is a brief example of the code, any thought or suggestions would be great. Thank you for your time, Doug # Example Code: d <- data.frame(st1=c(1,2,3,4), st2=c(2,5,6,7), st3=c(5,5,NA,7), st4=c(6,5,7,8)) avg <-
2009 Oct 15
2
Data frame search and remove questions
Hello, I have a couple questions about removing rows from a data frame and creating a new data frame with the removed values. I provided an example data frame (d) below. Questions: 1) How can I search for "-999.000" and remove the entire row from data frame "d"? (all -999 values will be in sd_diff) 2) Can I create a new data frame "d.new" that only contains the
2009 Dec 01
3
paste name in for loop?
Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout <- c(1,5,10,25,50,100) for(i in xout) { print(paste("Areal_Ppt_",xout[i],"sqmi.txt", sep="")) } [1] "Areal_Ppt_1sqmi.txt"
2010 Jan 20
2
Plot frame border to start at zero?
Hello, I am creating plots of hourly precipitation and accumulated precipitation (on different axis, see attached image). I was wondering how can I have the plot frame (black border) start at zero, it looks like it is plotted less than zero? The code I use to create the png files is below: CairoPNG(PNG_file,width=1000, height=600, pointsize=14, bg="white") opar <-
2008 May 20
3
R for loop question
Hello, I am trying to assign a variable name (x1,x2,x3...) in a loop statement that is based on a counter (counter is based on the number of hours within the datafile). The x1,x2 data will later be called for plotting the data. Below is a clip of the for loop I am using, any suggestions? k = 1 for (i in 1:length(stats$hour)) { "x(i)" = dataset[k,(3:15)] k = k+1 } Thanks,
2010 Jun 14
1
Times series data file?
Hello, I currently splitting a file into individual files (time series each separated into one file), the file I read in skips the first four lines and extracts the data columns I need. I was wondering if there is a way for R to automatically scan and separate the files based on the head information? The header delineates the observation with a 254 space time space day space month space
2009 Nov 13
2
data frame subsets?
Hello, I am trying to create data frame subsets based on binned temperature data. I have code working to create the bins (d.1 and d.2), but it takes two steps, I was wondering if I could merge into one step. See Below d n year mo da hr t td tw rh kPa 1 1 1945 3 1 0 1.1 0.0 0.6 92 101.7 2 2 1945 3 1 1 2.8 -1.1 1.1 76 101.8 3 3 1945 3 1 2 2.2 -1.7 0.6 75 101.9 4 4
2009 Mar 24
3
Display Equation on plot
Hello, I am using the lm to fit a linear model to data, I was wondering if there is a way to display the equation on a plot using the extracted lm coefficients? I am using the plot() function to create the plot/.png. Example: lm_mod <- lm(data1~data2) intercept = 48.54 slope = 0.4856 I want to display equation on a plot as y=0.4856x+48.54 Any thoughts or suggestions are appreciated.
2009 Oct 27
1
New vector based on if/else statement within for loop?
Hello, I am trying to create a new vector (w) that is based on comparing two vectors (P and Z). The compaison is simple (I created a for loop that reassigns w based on if statement), all Z values >= 24 and P values <=1, w=88 else w=77. I am not getting the correct results for w, see example code below. Any thoughts or suggestions on the correct method. Thank you, Doug P <-
2009 Nov 16
1
lmomco package and confidence limits?
Hello, I am using the lmomco package (lmom.ub and pargev) to compute the GEV parameters (location, scale, and shape), which are used to estimate return values. I was wondering how/if I can calculate upper and lower confidence (CI_u, CI_l) intervals for each return frequency using the GEV parameters to fill-in the table below? Xi (location) = 35.396 Alpha (scale) = 1.726 Kappa (shape) =
2013 Jan 29
2
Netcdf and Raster Package Questions, Need .asc File for GIS
Hello R-Group, I am new working with netcdf files and the raster package in R.I am trying to read in a netcdf file using the package "ncdf".I am able to get the lat, lon and parameter I need and can plot using fill.contour.Ultimately, I am trying to create a .asc file to reafd into GIS.I am using the package "raster" to read the parameter.When I read in with
2009 Jun 09
1
Cairo Package Installation
I am trying to install the Cairo package on a linux machine, the Cairo package did not install correctly (could not find cairo.h), I am new to R and linux any help on the installation would be great. Below are output from trying to install the Cairo package, thought this might help. > install.packages("Cairo") Warning in install.packages("Cairo") : argument