1

enter image description here

I have hidden my student ID number which is also the text file name. I just want to know what I am doing wrong here. I am supposed to calculate the sample mean and sample standard deviation of the DBH (Tree.Diameter) of the trees in my text file. However I can not seem to import my text file into R with the code shown in the picture. it says there is no file in the directory. Also the text file contains data which should be read like a table because Tree.Diameter is a column and I need to find the mean for it. The code I used is

z******.txt <- read.csv(file.choose(), header=TRUE)
trees <- read.table("z******.txt", header=T, stringsAsFactors=TRUE)
Martin Gal
  • 16,640
  • 5
  • 21
  • 39
  • 3
    [See here](https://stackoverflow.com/q/5963269/5325862) on making a reproducible example that is easier for folks to help with. There's no picture here that you're referencing, but code should be in the post as text anyway, not an image – camille Jul 27 '21 at 20:05
  • Just to let you know: Combining all places where you hid your students ID makes it possible to get your ID... – Martin Gal Jul 27 '21 at 20:57
  • Why are you using `read.csv` _and_ `read.table`? Your `read.table`-function doesn't read `z****.txt` which you defined earlier. It looks for a file named `z****.txt` in your current working directory. – Martin Gal Jul 27 '21 at 21:04

0 Answers0